{ description = "ssp-reader: a reader for the .ssp document abstraction, in D"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { self, nixpkgs }: let system = "x86_64-linux"; # adjust for aarch64-linux / darwin pkgs = import nixpkgs { inherit system; }; name = "ssp-reader"; /* The reader has no dependencies beyond phobos, so there is nothing to vendor and nothing to fetch: --skip-registry=all keeps dub from reaching for a registry it does not need, which is also what lets this build in a sandbox without network. */ mkReader = { compiler, compilerBin }: pkgs.stdenv.mkDerivation { pname = name; version = "2.1.0"; src = self; nativeBuildInputs = [ pkgs.dub compiler ]; buildPhase = '' runHook preBuild export HOME=$TMPDIR dub build \ --cache=local \ --compiler=$(type -P ${compilerBin}) \ --build=release \ --skip-registry=all runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/bin install -m755 bin/${name} $out/bin/${name} runHook postInstall ''; meta = { description = "reads a .ssp document abstraction and says what is in it"; mainProgram = name; }; }; in { packages.${system} = { default = self.packages.${system}.ssp-reader-ldc; ssp-reader-ldc = mkReader { compiler = pkgs.ldc; compilerBin = "ldmd2"; }; /* dmd is given gcc14: GCC 15 introduced nullptr in its headers and dmd's ImportC parser does not yet handle it. The same override sisudoc-spine carries, for the same reason. */ ssp-reader-dmd = mkReader { compiler = pkgs.dmd.override { stdenv = pkgs.gcc14Stdenv; }; compilerBin = "dmd"; }; }; devShells.${system}.default = pkgs.mkShell { packages = [ pkgs.ldc pkgs.dub pkgs.dtools ]; }; }; }