CS3502/project1/default.nix
2025-10-09 22:18:56 -04:00

23 lines
568 B
Nix

let
basicC = subdir: name: { stdenv }:
stdenv.mkDerivation {
inherit name;
src = ./.;
buildPhase = ''
runHook preBuild
gcc ${subdir}/${name}.c -o ${name}.bin
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install ${name}.bin $out/bin/${name}
runHook postInstall
'';
};
in {
p1-phase1 = basicC "phase1" "phase1";
p1-phase2 = basicC "phase2" "phase2";
p1-phase3 = basicC "phase3" "phase3";
p1-phase4 = basicC "phase4" "phase4";
}