Skip to content

Commit

Permalink
nixops_unstable: Fix tests attribute
Browse files Browse the repository at this point in the history
The .overrideAttrs part is ok now, but a "passthru' workaround is
necessary now. See NixOS#247520
  • Loading branch information
roberth committed Aug 9, 2023
1 parent bb02d10 commit 4b51c53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
9 changes: 5 additions & 4 deletions nixos/tests/nixops/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ let
# inherit testsForPackage;
};

testsForPackage = lib.makeOverridable (args: lib.recurseIntoAttrs {
testsForPackage = args: lib.recurseIntoAttrs {
legacyNetwork = testLegacyNetwork args;
});
passthru.override = args': testsForPackage (args // args');
};

testLegacyNetwork = { nixopsPkg }: pkgs.nixosTest ({
testLegacyNetwork = { nixopsPkg, ... }: pkgs.nixosTest ({
name = "nixops-legacy-network";
nodes = {
deployer = { config, lib, nodes, pkgs, ... }: {
Expand Down Expand Up @@ -52,7 +53,7 @@ let
chmod 0400 ~/.ssh/id_ed25519
'';
serverNetworkJSON = pkgs.writeText "server-network.json"
(builtins.toJSON nodes.server.config.system.build.networkConfig);
(builtins.toJSON nodes.server.system.build.networkConfig);
in
''
import shlex
Expand Down
15 changes: 7 additions & 8 deletions pkgs/applications/networking/cluster/nixops/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let
}
).python;

pkg = interpreter.pkgs.nixops.withPlugins(ps: [
pkg = (interpreter.pkgs.nixops.withPlugins(ps: [
ps.nixops-aws
ps.nixops-digitalocean
ps.nixops-encrypted-links
Expand All @@ -102,11 +102,10 @@ let
ps.nixopsvbox
ps.nixops-virtd
ps.nixops-hetznercloud
]) // rec {
# Workaround for https://github.com/NixOS/nixpkgs/issues/119407
# TODO after #1199407: Use .overrideAttrs(pkg: old: { passthru.tests = .....; })
tests = nixosTests.nixops.unstable.override { nixopsPkg = pkg; };
# Not strictly necessary, but probably expected somewhere; part of the workaround:
passthru.tests = tests;
};
])).overrideAttrs (finalAttrs: prevAttrs: {
passthru = prevAttrs.passthru or {} // {
tests = prevAttrs.passthru.tests or {} //
nixosTests.nixops.unstable.passthru.override { nixopsPkg = pkg; };
};
});
in pkg

0 comments on commit 4b51c53

Please sign in to comment.