# package.nix - spine_search CGI derivation (build logic) # # Standalone, callPackage-style derivation for the spine_search CGI # binary. Used by shell.nix to put a freshly-built spine_search into # the dev shell. May also be consumed via: # nix-build ./package.nix # pkgs.callPackage ./package.nix {} # # Compiler defaults to ldc/ldmd2 (matching the flake's default # package `spine-search-nixpkgs-ldc`). Override to build with dmd: # pkgs.callPackage ./package.nix { # compilerPkg = pkgs.dmd; # compilerBin = "dmd"; # buildType = "dmd"; # } # # Note: spine_search is a CGI binary and is installed to # $out/cgi-bin/spine_search (not $out/bin/), since it is intended to # be served by a web server, not invoked directly from PATH. { lib, stdenv, dub, ldc, gnumake, sqlite, compilerPkg ? ldc, compilerBin ? "ldmd2", buildType ? "ldmd2", }: stdenv.mkDerivation { pname = "spine_search"; version = "0.18.0"; src = lib.cleanSource ./.; buildInputs = [ sqlite ]; nativeBuildInputs = [ dub compilerPkg gnumake ]; preBuild = '' export HOME=$(pwd) ''; buildPhase = '' runHook preBuild buildCMD="dub run --cache=local \ --compiler=$(type -P ${compilerBin}) \ --build=${buildType} \ --combined --skip-registry=all" echo $buildCMD $buildCMD runHook postBuild ''; checkPhase = '' runHook preCheck dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/cgi-bin install -m755 -D ./cgi-bin/spine_search $out/cgi-bin/spine_search runHook postInstall ''; postInstall = '' echo `ls -la $out/cgi-bin/spine_search` ''; meta = { description = "CGI search interface for spine document collections"; homepage = "https://sisudoc.org"; license = lib.licenses.agpl3Plus; platforms = lib.platforms.linux; mainProgram = "spine_search"; }; }