refactor: modify derivation build process

This commit is contained in:
Kiana Sheibani 2025-10-09 22:00:27 -04:00
parent 7562a7a497
commit aadfd1f899
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 14 additions and 14 deletions

View file

@ -1,22 +1,22 @@
let
basic-c = name: { stdenv }:
basicC = name: { stdenv }:
stdenv.mkDerivation {
inherit name;
src = ./.;
buildPhase = ''
runHook preBuild
gcc part2/${name}.c -o ${name}
gcc part2/${name}.c -o ${name}.bin
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install ${name} $out/bin/
install ${name}.bin $out/bin/${name}
runHook postInstall
'';
};
in {
a1-hello = basic-c "hello";
a1-employee = basic-c "employee";
a1-logwriter = basic-c "logwriter";
a1-hello = basicC "hello";
a1-employee = basicC "employee";
a1-logwriter = basicC "logwriter";
}