diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-11 01:04:08 +0000 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-04-11 01:18:49 +0000 |
| commit | 0abf018794e7d32e5b9f670b9458033aa38c04e1 (patch) | |
| tree | 323268c1c195a7a24032a31b1934bff1a335f2f4 /package.nix | |
| parent | flake.nix dmd build fix overlay: revert to GCC14 (diff) | |
nix keeping: nix-shell, nix-build derivation.nix
Diffstat (limited to 'package.nix')
| -rw-r--r-- | package.nix | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..6e6b769 --- /dev/null +++ b/package.nix @@ -0,0 +1,68 @@ +# package.nix - spine derivation (build logic) +# +# Standalone, callPackage-style derivation for the spine binary. Used by +# shell.nix to put a freshly-built spine on PATH inside 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-nixpkgs-ldc`). Override to build with dmd: +# pkgs.callPackage ./package.nix { +# compilerPkg = pkgs.dmd; +# compilerBin = "dmd"; +# buildType = "dmd"; +# } +{ + lib, + stdenv, + dub, + ldc, + gnumake, + sqlite, + compilerPkg ? ldc, + compilerBin ? "ldmd2", + buildType ? "ldmd2", + rev ? "unknown", +}: +stdenv.mkDerivation { + pname = "spine"; + version = "0.18.0"; + src = lib.cleanSource ./.; + buildInputs = [ sqlite ]; + nativeBuildInputs = [ dub compilerPkg gnumake ]; + preBuild = '' + export HOME=$TMPDIR + ''; + 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/bin + install -m755 ./bin/spine $out/bin/spine + runHook postInstall + ''; + postInstall = '' + echo `ls -la $out/bin/spine` + echo "❯❯ spine-v0.18.0 (rev: ${rev})" + $out/bin/spine -v + ''; + meta = { + description = "A sisu like parser & document generator"; + longDescription = "a sisu like parser & document generator"; + homepage = "https://sisudoc.org"; + license = lib.licenses.agpl3Plus; + platforms = lib.platforms.linux; + mainProgram = "spine"; + }; +} |
