feat(nix): add runExecline.local
Similar to runCommandLocal, this turns off substitutions and prefers building locally. Change-Id: I823b34c7fc54990b54a82324172c299aeffdbf41 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2309 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: lukegb <lukegb@tvl.fyi>
This commit is contained in:
parent
361aa2aac2
commit
2f063bc5b0
2 changed files with 17 additions and 17 deletions
|
@ -6,8 +6,18 @@ let
|
||||||
inherit pkgs lib;
|
inherit pkgs lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
runExeclineLocal = name: args: execline:
|
||||||
|
runExecline name
|
||||||
|
(args // {
|
||||||
|
derivationArgs = args.derivationArgs or {} // {
|
||||||
|
preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
execline;
|
||||||
|
|
||||||
tests = import ./tests.nix {
|
tests = import ./tests.nix {
|
||||||
inherit runExecline;
|
inherit runExecline runExeclineLocal;
|
||||||
inherit (depot.nix) getBins writeScript;
|
inherit (depot.nix) getBins writeScript;
|
||||||
inherit (pkgs) stdenv coreutils;
|
inherit (pkgs) stdenv coreutils;
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
@ -15,5 +25,6 @@ let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
__functor = _: runExecline;
|
__functor = _: runExecline;
|
||||||
|
local = runExeclineLocal;
|
||||||
inherit tests;
|
inherit tests;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, pkgs, runExecline, getBins, writeScript
|
{ stdenv, pkgs, runExecline, runExeclineLocal, getBins, writeScript
|
||||||
# https://www.mail-archive.com/skaware@list.skarnet.org/msg01256.html
|
# https://www.mail-archive.com/skaware@list.skarnet.org/msg01256.html
|
||||||
, coreutils }:
|
, coreutils }:
|
||||||
|
|
||||||
|
@ -44,23 +44,15 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# basic test that touches out
|
# basic test that touches out
|
||||||
basic = runExecline "run-execline-test-basic" {
|
basic = runExeclineLocal "run-execline-test-basic" {
|
||||||
derivationArgs = {
|
|
||||||
preferLocalBuild = true;
|
|
||||||
allowSubstitutes = false;
|
|
||||||
};
|
|
||||||
} [
|
} [
|
||||||
"importas" "-ui" "out" "out"
|
"importas" "-ui" "out" "out"
|
||||||
"${bins.s6-touch}" "$out"
|
"${bins.s6-touch}" "$out"
|
||||||
];
|
];
|
||||||
|
|
||||||
# whether the stdin argument works as intended
|
# whether the stdin argument works as intended
|
||||||
stdin = fileHasLine "foo" (runExecline "run-execline-test-stdin" {
|
stdin = fileHasLine "foo" (runExeclineLocal "run-execline-test-stdin" {
|
||||||
stdin = "foo\nbar\nfoo";
|
stdin = "foo\nbar\nfoo";
|
||||||
derivationArgs = {
|
|
||||||
preferLocalBuild = true;
|
|
||||||
allowSubstitutes = false;
|
|
||||||
};
|
|
||||||
} [
|
} [
|
||||||
"importas" "-ui" "out" "out"
|
"importas" "-ui" "out" "out"
|
||||||
# this pipes stdout of s6-cat to $out
|
# this pipes stdout of s6-cat to $out
|
||||||
|
@ -68,15 +60,12 @@ let
|
||||||
"redirfd" "-w" "1" "$out" bins.s6-cat
|
"redirfd" "-w" "1" "$out" bins.s6-cat
|
||||||
]);
|
]);
|
||||||
|
|
||||||
wrapWithVar = runExecline "run-execline-test-wrap-with-var" {
|
|
||||||
|
wrapWithVar = runExeclineLocal "run-execline-test-wrap-with-var" {
|
||||||
builderWrapper = writeScript "var-wrapper" ''
|
builderWrapper = writeScript "var-wrapper" ''
|
||||||
#!${bins.execlineb} -S0
|
#!${bins.execlineb} -S0
|
||||||
export myvar myvalue $@
|
export myvar myvalue $@
|
||||||
'';
|
'';
|
||||||
derivationArgs = {
|
|
||||||
preferLocalBuild = true;
|
|
||||||
allowSubstitutes = false;
|
|
||||||
};
|
|
||||||
} [
|
} [
|
||||||
"importas" "-ui" "v" "myvar"
|
"importas" "-ui" "v" "myvar"
|
||||||
"if" [ bins.s6-test "myvalue" "=" "$v" ]
|
"if" [ bins.s6-test "myvalue" "=" "$v" ]
|
||||||
|
|
Loading…
Reference in a new issue