2020-08-16 17:38:12 +00:00
|
|
|
{ busybox }:
|
|
|
|
|
|
|
|
with import ./config.nix;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
mkDerivation = args:
|
|
|
|
derivation ({
|
|
|
|
inherit system;
|
|
|
|
builder = busybox;
|
|
|
|
args = ["sh" "-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2022-02-20 14:56:22 +00:00
|
|
|
} // removeAttrs args ["builder" "meta" "passthru"])
|
|
|
|
// { meta = args.meta or {}; passthru = args.passthru or {}; };
|
2020-08-16 17:38:12 +00:00
|
|
|
|
|
|
|
input1 = mkDerivation {
|
|
|
|
shell = busybox;
|
|
|
|
name = "build-remote-input-1";
|
2022-03-04 15:58:27 +00:00
|
|
|
buildCommand = "echo hi-input1; echo FOO > $out";
|
2020-08-16 17:38:12 +00:00
|
|
|
requiredSystemFeatures = ["foo"];
|
2021-02-26 16:29:19 +00:00
|
|
|
outputHash = "sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc=";
|
2020-08-16 17:38:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
input2 = mkDerivation {
|
|
|
|
shell = busybox;
|
|
|
|
name = "build-remote-input-2";
|
2022-02-20 14:56:22 +00:00
|
|
|
buildCommand = "echo hi; echo BAR > $out";
|
2020-08-16 17:38:12 +00:00
|
|
|
requiredSystemFeatures = ["bar"];
|
2021-02-26 16:29:19 +00:00
|
|
|
outputHash = "sha256-XArauVH91AVwP9hBBQNlkX9ccuPpSYx9o0zeIHb6e+Q=";
|
2021-01-26 09:28:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
input3 = mkDerivation {
|
|
|
|
shell = busybox;
|
|
|
|
name = "build-remote-input-3";
|
|
|
|
buildCommand = ''
|
2022-03-04 15:58:27 +00:00
|
|
|
echo hi-input3
|
2021-01-26 09:28:00 +00:00
|
|
|
read x < ${input2}
|
|
|
|
echo $x BAZ > $out
|
|
|
|
'';
|
|
|
|
requiredSystemFeatures = ["baz"];
|
2021-02-26 16:29:19 +00:00
|
|
|
outputHash = "sha256-daKAcPp/+BYMQsVi/YYMlCKoNAxCNDsaivwSHgQqD2s=";
|
2020-08-16 17:38:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
mkDerivation {
|
|
|
|
shell = busybox;
|
|
|
|
name = "build-remote";
|
2022-02-20 14:56:22 +00:00
|
|
|
passthru = { inherit input1 input2 input3; };
|
2020-08-16 17:38:12 +00:00
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
read x < ${input1}
|
2021-01-26 09:28:00 +00:00
|
|
|
read y < ${input3}
|
2020-08-16 17:38:12 +00:00
|
|
|
echo "$x $y" > $out
|
|
|
|
'';
|
2021-02-26 16:29:19 +00:00
|
|
|
outputHash = "sha256-5SxbkUw6xe2l9TE1uwCvTtTDysD1vhRor38OtDF0LqQ=";
|
2020-08-16 17:38:12 +00:00
|
|
|
}
|