refactor: modify derivation build process
This commit is contained in:
parent
7562a7a497
commit
aadfd1f899
2 changed files with 14 additions and 14 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue