From 4b51c5360ff0ac76d6ea4ce269726249d36b2ce8 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 9 Aug 2023 15:47:07 +0200 Subject: [PATCH] nixops_unstable: Fix tests attribute The .overrideAttrs part is ok now, but a "passthru' workaround is necessary now. See https://github.com/NixOS/nixpkgs/pull/247520 --- nixos/tests/nixops/default.nix | 9 +++++---- .../networking/cluster/nixops/default.nix | 15 +++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nixos/tests/nixops/default.nix b/nixos/tests/nixops/default.nix index bd00e6143639c..b8f747b2a19f1 100644 --- a/nixos/tests/nixops/default.nix +++ b/nixos/tests/nixops/default.nix @@ -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, ... }: { @@ -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 diff --git a/pkgs/applications/networking/cluster/nixops/default.nix b/pkgs/applications/networking/cluster/nixops/default.nix index 012625a2b051d..de79e9759bc06 100644 --- a/pkgs/applications/networking/cluster/nixops/default.nix +++ b/pkgs/applications/networking/cluster/nixops/default.nix @@ -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 @@ -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