about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2024-02-28 22:53:49 +0100
committerRobert Hensing <robert@roberthensing.nl>2024-03-06 22:47:24 +0100
commit576be941f8cceed14a6a937a61e42814a553312d (patch)
tree210f741c44703500f4a0611f8678124db7a2e4ac
parentf5f2ef33fad2f550a833d754edc96686be66adf8 (diff)
nixops_unstable_*: Remove ad-hoc selectedPlugins overriding state
-rw-r--r--pkgs/applications/networking/cluster/nixops/default.nix17
1 files changed, 11 insertions, 6 deletions
diff --git a/pkgs/applications/networking/cluster/nixops/default.nix b/pkgs/applications/networking/cluster/nixops/default.nix
index f8373efdfecf6..8bcd0f9db630d 100644
--- a/pkgs/applications/networking/cluster/nixops/default.nix
+++ b/pkgs/applications/networking/cluster/nixops/default.nix
@@ -37,13 +37,19 @@ let
 
     availablePlugins = this.plugins this.python.pkgs;
 
+    selectedPlugins = [];
+
     # selector is a function mapping pythonPackages to a list of plugins
     # e.g. nixops_unstable.withPlugins (ps: with ps; [ nixops-aws ])
     withPlugins = selector:
-      let
+      this.extend (this: _old: {
         selectedPlugins = selector this.availablePlugins;
+      });
+
+    rawPackage =
+      let
         r = this.python.pkgs.toPythonApplication (this.python.pkgs.nixops.overridePythonAttrs (old: {
-          propagatedBuildInputs = old.propagatedBuildInputs ++ selectedPlugins;
+          propagatedBuildInputs = old.propagatedBuildInputs ++ this.selectedPlugins;
 
           # Propagating dependencies leaks them through $PYTHONPATH which causes issues
           # when used in nix-shell.
@@ -52,15 +58,14 @@ let
           '';
 
           passthru = old.passthru // {
-            inherit selectedPlugins;
-            inherit (this) availablePlugins withPlugins python;
+            inherit (this) selectedPlugins availablePlugins withPlugins python;
             tests = old.passthru.tests // {
               nixos = old.passthru.tests.nixos.passthru.override {
                 nixopsPkg = r;
               };
             }
               # Make sure we also test with a configuration that's been extended with a plugin.
-              // lib.optionalAttrs (selectedPlugins == [ ]) {
+              // lib.optionalAttrs (this.selectedPlugins == [ ]) {
               withAPlugin =
                 lib.recurseIntoAttrs
                   (this.withPlugins (ps: with ps; [ nixops-encrypted-links ])).tests;
@@ -70,7 +75,7 @@ let
       in
       r;
 
-    public = this.withPlugins (ps: []);
+    public = this.rawPackage;
   };
 
   minimal = encapsulate nixopsContextBase;