Include runtime files in output

This commit is contained in:
Bryan Richter 2025-01-31 11:39:10 +02:00
parent 20951c584a
commit 7a26c17e32
No known key found for this signature in database
GPG Key ID: B202264020068BFB
2 changed files with 21 additions and 1 deletions

View File

@ -8,7 +8,21 @@
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
defaultPackage = pkgs.callPackage ./package.nix {};
packages.default = pkgs.callPackage ./package.nix {};
checks = {
# I used to put these into $out/lib, but justStaticExecutables
# removes that directory. Now I feel like I'm just getting lucky. So
# let's double check the files are there.
file-check = pkgs.runCommand "check-runtime-files" {} ''
if [ -e ${self.packages.${system}.default}/run/config/settings.yml ]; then
touch $out
else
2>&1 echo "Runtime files are missing"
exit 1
fi
'';
};
}
);
}

View File

@ -9,6 +9,12 @@ let
preConfigure = ''
${pkgs.hpack}/bin/hpack .
'';
# During build, static files are generated into the source tree's
# static/ dir. Plus, config/ is needed at runtime.
postInstall = ''
mkdir -p $out/run
cp -a {static,config} $out/run
'';
src = pkgs.lib.cleanSource old.src;
});