From aadfd1f899ca032700660fdfd06515b28d5f4ef1 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 9 Oct 2025 22:00:27 -0400 Subject: [PATCH] refactor: modify derivation build process --- assignment1/default.nix | 12 ++++++------ assignment2/default.nix | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/assignment1/default.nix b/assignment1/default.nix index 293fb6b..54b1f8b 100644 --- a/assignment1/default.nix +++ b/assignment1/default.nix @@ -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"; } diff --git a/assignment2/default.nix b/assignment2/default.nix index 7f9f5b6..d63155d 100644 --- a/assignment2/default.nix +++ b/assignment2/default.nix @@ -1,26 +1,26 @@ let - basic-c = subdir: name: { stdenv }: + basicC = subdir: name: { stdenv }: stdenv.mkDerivation { inherit name; src = ./.; buildPhase = '' runHook preBuild - gcc ${subdir}/${name}.c -o ${name} + gcc ${subdir}/${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 { - a2-p1-producer = basic-c "part1" "producer"; - a2-p1-consumer = basic-c "part1" "consumer"; + a2-p1-producer = basicC "part1" "producer"; + a2-p1-consumer = basicC "part1" "consumer"; - a2-p2-bidirectional = basic-c "part2" "bidirectional"; + a2-p2-bidirectional = basicC "part2" "bidirectional"; - a2-p3-producer = basic-c "part3" "producer"; - a2-p3-consumer = basic-c "part3" "consumer"; + a2-p3-producer = basicC "part3" "producer"; + a2-p3-consumer = basicC "part3" "consumer"; }