Skip to content

Instantly share code, notes, and snippets.

@gmodena
Created October 8, 2025 21:22
Show Gist options
  • Select an option

  • Save gmodena/1d13bdd9fdf86856ea35431a96e8cd8f to your computer and use it in GitHub Desktop.

Select an option

Save gmodena/1d13bdd9fdf86856ea35431a96e8cd8f to your computer and use it in GitHub Desktop.
A nix flake to build millenium db
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
# ANTLR4 runtime. Already vendored in third_party/antlr4-runtime-4.13.1
antlr4-runtime = pkgs.fetchFromGitHub {
owner = "antlr";
repo = "antlr4";
rev = "4.13.1";
hash = "sha256-CJXnQx5eZNTUV1eThGH8jwgJWrMFH1CE1Pqy4JVaC98=";
};
# Boost 1.82.0. Vendored in third_party/boost_1_82
boost_1_82 = pkgs.fetchurl {
url = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz";
hash = "sha256-ZqRptuYIpR+DRyNvSRLifcXGDGDX1Trpv+RoMxbG8Ew=";
};
installBoostScript = ''
TMPDIR=$(mktemp -d)
tar -xf ${boost_1_82} -C $TMPDIR
mkdir -p $MDB_HOME/third_party/boost_1_82/include
mv $TMPDIR/boost_1_82_0/boost $MDB_HOME/third_party/boost_1_82/include/
rm -rf $TMPDIR
echo "Boost 1.82.0 installed to $MDB_HOME/third_party/boost_1_82/include"
'';
setup-boost = pkgs.writeShellScriptBin "setup-boost" ''
set -e
echo "Setting up Boost 1.82.0..."
${installBoostScript}
'';
in {
packages.default = pkgs.stdenv.mkDerivation {
pname = "millenniumdb";
version = "1.0.0";
src = ./.;
nativeBuildInputs = with pkgs; [
cmake
ninja
pkg-config
];
buildInputs = with pkgs; [
boost185
icu
openssl
ncurses
];
preConfigure = ''
export MDB_HOME=$PWD
${installBoostScript}
'';
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-GNinja"
];
meta = with pkgs.lib; {
description = "A graph oriented database management system supporting RDF/SPARQL and Property Graphs/GQL";
homepage = "https://github.com/MillenniumDB/MillenniumDB";
license = licenses.mit;
platforms = platforms.unix;
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
cmake
ninja
pkg-config
boost
icu
openssl
ncurses
# Development tools
gdb
clang-tools
];
shellHook = ''
export MDB_HOME="''${MDB_HOME:-$PWD}"
# Auto-setup Boost 1.82.0 if not already installed
if [ ! -d "$MDB_HOME/third_party/boost_1_82/include/boost" ]; then
echo "Setting up Boost 1.82.0..."
${installBoostScript}
else
echo "Boost 1.82.0 already installed"
fi
echo ""
echo "MillenniumDB development environment"
echo "Build with: cmake -B build/Release -D CMAKE_BUILD_TYPE=Release && cmake --build build/Release/ -j <n>"
'';
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment