Created
October 8, 2025 10:59
-
-
Save gmodena/2481daee64ceaea95d456b4100372c87 to your computer and use it in GitHub Desktop.
a nix flake to build the qlever rdf store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| 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; | |
| }; | |
| # Pre-fetch CMake FetchContent dependencies to avoid network access during build | |
| googletest-src = pkgs.fetchFromGitHub { | |
| owner = "google"; | |
| repo = "googletest"; | |
| rev = "7917641ff965959afae189afb5f052524395525c"; | |
| hash = "sha256-Pfkx/hgtqryPz3wI0jpZwlRRco0s2FLcvUX1EgTGFIw="; | |
| }; | |
| nlohmann-json-src = pkgs.fetchzip { | |
| url = "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz"; | |
| hash = "sha256-zGnGdxBar2dQmWYhqywdC4xBgPxerqDv8GtdMQ+k7mQ="; | |
| stripRoot = false; | |
| }; | |
| antlr-src = pkgs.fetchFromGitHub { | |
| owner = "antlr"; | |
| repo = "antlr4"; | |
| rev = "cc82115a4e7f53d71d9d905caa2c2dfa4da58899"; | |
| hash = "sha256-XuE/nalt2HEYaII9NytUs0rCLGHOUFEclO+0h7pu4V0="; | |
| }; | |
| range-v3-src = pkgs.fetchFromGitHub { | |
| owner = "joka921"; | |
| repo = "range-v3"; | |
| rev = "5ae161451ec1baaac352d7567298d3ac143bccae"; | |
| hash = "sha256-r7wxSE8dX3hCxtHn8bwAOc3hM8Eodi9V28HaT53AUH8="; | |
| }; | |
| spatialjoin-src = pkgs.fetchFromGitHub { | |
| owner = "ad-freiburg"; | |
| repo = "spatialjoin"; | |
| rev = "7f5c9007090cd1b902ad1873beb064820caebf39"; | |
| hash = "sha256-s7CdOqykBPmnaH3VYxNc+JxwIr4bI5wGffVVTOfJY2Q="; | |
| }; | |
| ctre-src = pkgs.fetchFromGitHub { | |
| owner = "hanickadot"; | |
| repo = "compile-time-regular-expressions"; | |
| rev = "e34c26ba149b9fd9c34aa0f678e39739641a0d1e"; | |
| hash = "sha256-/44oZi6j8+a1D6ZGZpoy82GHjPtqzOvuS7d3SPbH7fs="; | |
| }; | |
| abseil-src = pkgs.fetchFromGitHub { | |
| owner = "abseil"; | |
| repo = "abseil-cpp"; | |
| rev = "93ac3a4f9ee7792af399cebd873ee99ce15aed08"; | |
| hash = "sha256-a18+Yj9fvDigza4b2g38L96hge5feMwU6fgPmL/KVQU="; | |
| }; | |
| s2-src = pkgs.fetchFromGitHub { | |
| owner = "google"; | |
| repo = "s2geometry"; | |
| rev = "5b5eccd54a08ae03b4467e79ffbb076d0b5f221e"; | |
| hash = "sha256-VjgGcGgQlKmjUq+JU0JpyhOZ9pqwPcBUFEPGV9XoHc0="; | |
| }; | |
| fsst-src = pkgs.fetchFromGitHub { | |
| owner = "cwida"; | |
| repo = "fsst"; | |
| rev = "b228af6356196095eaf9f8f5654b0635f969661e"; | |
| hash = "sha256-DxxRL+FQFA+x0RudIXtLhewseU50aScHKSCDX7DE9bY="; | |
| }; | |
| re2-src = pkgs.fetchFromGitHub { | |
| owner = "google"; | |
| repo = "re2"; | |
| rev = "bc0faab533e2b27b85b8ad312abf061e33ed6b5d"; | |
| hash = "sha256-cKXe8r5MUag/z+seem4Zg/gmqIQjaCY7DBxiKlrnXPs="; | |
| }; | |
| in { | |
| packages.default = pkgs.stdenv.mkDerivation { | |
| pname = "qlever"; | |
| version = "0.1.0"; | |
| src = ./.; | |
| nativeBuildInputs = with pkgs; [ | |
| cmake | |
| ninja | |
| pkg-config | |
| git | |
| ]; | |
| buildInputs = with pkgs; [ | |
| boost | |
| icu | |
| jemalloc | |
| zstd | |
| openssl | |
| curl | |
| ]; | |
| cmakeFlags = [ | |
| "-DCMAKE_BUILD_TYPE=Release" | |
| "-GNinja" | |
| # Point FetchContent to pre-downloaded sources to avoid network access | |
| # Note: hyphens in FetchContent_Declare names become underscores in variable names | |
| "-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${googletest-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_NLOHMANN_JSON=${nlohmann-json-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_ANTLR=${antlr-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_RANGE_V3=${range-v3-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_SPATIALJOIN=${spatialjoin-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_CTRE=${ctre-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_ABSEIL=${abseil-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_S2=${s2-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_FSST=${fsst-src}" | |
| "-DFETCHCONTENT_SOURCE_DIR_RE2=${re2-src}" | |
| ]; | |
| meta = with pkgs.lib; { | |
| description = "A SPARQL engine that can efficiently index and query very large knowledge graphs"; | |
| homepage = "https://github.com/ad-freiburg/qlever"; | |
| license = licenses.asl20; | |
| platforms = platforms.unix; | |
| }; | |
| }; | |
| devShells.default = pkgs.mkShell { | |
| buildInputs = with pkgs; [ | |
| claude-code | |
| cmake | |
| ninja | |
| pkg-config | |
| boost | |
| icu | |
| jemalloc | |
| zstd | |
| openssl | |
| curl | |
| # Development tools | |
| gdb | |
| clang-tools | |
| ]; | |
| shellHook = '' | |
| echo "QLever development environment" | |
| echo "Build with: cmake -B build -G Ninja && ninja -C build" | |
| ''; | |
| }; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment