templates/c/basic/nixpkgs/package.nix
2026-01-19 14:14:24 -05:00

23 lines
377 B
Nix

{
stdenv
}:
let
source = "src/hello.c";
exec = "hello";
in stdenv.mkDerivation {
pname = "hello";
version = "0.1";
src = ./.;
buildPhase = ''
runHook preBuild
gcc ${source} -o ${exec}.bin
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install ${exec}.bin $out/bin/${exec}
runHook postInstall
'';
}