1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00
flake-parts/template/package/hello/package.nix
2023-10-03 16:05:44 +02:00

22 lines
651 B
Nix

{ stdenv, lib, runtimeShell }:
# Example package in the style that `mkDerivation`-based packages in Nixpkgs are written.
stdenv.mkDerivation (finalAttrs: {
name = "hello";
src = lib.cleanSourceWith {
src = ./.;
filter = path: type:
type == "regular" -> baseNameOf path == "hello.sh";
};
buildPhase = ''
# Note that Nixpkgs has builder functions for simple packages
# like this, but this template avoids it to make for a more
# complete example.
substitute hello.sh hello --replace '@shell@' ${runtimeShell}
cat hello
chmod a+x hello
'';
installPhase = ''
install -D hello $out/bin/hello
'';
})