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

23 lines
651 B
Nix
Raw Normal View History

2023-10-03 14:05:44 +00:00
{ 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
'';
})