tests: fix getOutput
on stubs
Setting `outputSpecified` prevents `getOutput` from descending into outputs, which don't have an overridden `outPath`. Additionally, use `__spliced` to permit derivations to use the dummy as an input.
This commit is contained in:
parent
bffc49ffb2
commit
221056c59f
|
@ -8,6 +8,7 @@ with lib;
|
||||||
|
|
||||||
test.stubs.autojump = {
|
test.stubs.autojump = {
|
||||||
buildScript = "mkdir -p $out/bin; touch $out/bin/autojump";
|
buildScript = "mkdir -p $out/bin; touch $out/bin/autojump";
|
||||||
|
outPath = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=PATH=/nix/store/00000000000000000000000000000000-openssh/bin:/nix/store/00000000000000000000000000000000-git/bin
|
Environment=PATH=@openssh@/bin:/nix/store/00000000000000000000000000000000-git/bin
|
||||||
Environment=GIT_SYNC_DIRECTORY=/a/path
|
Environment=GIT_SYNC_DIRECTORY=/a/path
|
||||||
Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync
|
Environment=GIT_SYNC_COMMAND=@git-sync@/bin/git-sync
|
||||||
Environment=GIT_SYNC_REPOSITORY=git+ssh://user@example.com:/~user/path/to/repo.git
|
Environment=GIT_SYNC_REPOSITORY=git+ssh://user@example.com:/~user/path/to/repo.git
|
||||||
|
|
|
@ -41,8 +41,18 @@ let
|
||||||
dummyPackage
|
dummyPackage
|
||||||
else
|
else
|
||||||
pkgs.runCommandLocal name { pname = name; } buildScript;
|
pkgs.runCommandLocal name { pname = name; } buildScript;
|
||||||
in pkg // optionalAttrs (outPath != null) { inherit outPath; }
|
in pkg // optionalAttrs (outPath != null) {
|
||||||
// optionalAttrs (version != null) { inherit version; };
|
inherit outPath;
|
||||||
|
|
||||||
|
# Prevent getOutput from descending into outputs
|
||||||
|
outputSpecified = true;
|
||||||
|
|
||||||
|
# Allow the original package to be used in derivation inputs
|
||||||
|
__spliced = {
|
||||||
|
buildHost = pkg;
|
||||||
|
hostTarget = pkg;
|
||||||
|
};
|
||||||
|
} // optionalAttrs (version != null) { inherit version; };
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.test.stubs = mkOption {
|
options.test.stubs = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue