2024-02-28 16:15:21 +00:00
|
|
|
{ lib, python3 }:
|
2020-03-27 23:10:29 +00:00
|
|
|
|
|
|
|
let
|
2023-10-25 09:23:27 +00:00
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
|
|
|
nixops = self.callPackage ./unwrapped.nix { };
|
|
|
|
} // (plugins self);
|
|
|
|
};
|
|
|
|
|
|
|
|
plugins = ps: with ps; rec {
|
|
|
|
nixops-aws = callPackage ./plugins/nixops-aws.nix { };
|
|
|
|
nixops-digitalocean = callPackage ./plugins/nixops-digitalocean.nix { };
|
|
|
|
nixops-encrypted-links = callPackage ./plugins/nixops-encrypted-links.nix { };
|
|
|
|
nixops-gce = callPackage ./plugins/nixops-gce.nix { };
|
|
|
|
nixops-hercules-ci = callPackage ./plugins/nixops-hercules-ci.nix { };
|
|
|
|
nixops-hetzner = callPackage ./plugins/nixops-hetzner.nix { };
|
|
|
|
nixops-hetznercloud = callPackage ./plugins/nixops-hetznercloud.nix { };
|
|
|
|
nixops-libvirtd = callPackage ./plugins/nixops-libvirtd.nix { };
|
|
|
|
nixops-vbox = callPackage ./plugins/nixops-vbox.nix { };
|
|
|
|
nixos-modules-contrib = callPackage ./plugins/nixos-modules-contrib.nix { };
|
|
|
|
|
|
|
|
# aliases for backwards compatibility
|
|
|
|
nixops-gcp = nixops-gce;
|
|
|
|
nixops-virtd = nixops-libvirtd;
|
|
|
|
nixopsvbox = nixops-vbox;
|
|
|
|
};
|
|
|
|
|
2024-02-28 15:29:27 +00:00
|
|
|
withPlugins = withPlugins' { availablePlugins = plugins python.pkgs; };
|
|
|
|
|
2023-10-25 09:23:27 +00:00
|
|
|
# selector is a function mapping pythonPackages to a list of plugins
|
|
|
|
# e.g. nixops_unstable.withPlugins (ps: with ps; [ nixops-aws ])
|
2024-02-28 16:23:21 +00:00
|
|
|
withPlugins' = { availablePlugins }: selector:
|
|
|
|
let
|
|
|
|
selectedPlugins = selector availablePlugins;
|
|
|
|
r = python.pkgs.toPythonApplication (python.pkgs.nixops.overridePythonAttrs (old: {
|
|
|
|
propagatedBuildInputs = old.propagatedBuildInputs ++ selectedPlugins;
|
2023-10-25 09:23:27 +00:00
|
|
|
|
2024-02-28 16:23:21 +00:00
|
|
|
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
|
|
|
# when used in nix-shell.
|
|
|
|
postFixup = ''
|
|
|
|
rm $out/nix-support/propagated-build-inputs
|
|
|
|
'';
|
2023-10-25 09:23:27 +00:00
|
|
|
|
2024-02-28 16:23:21 +00:00
|
|
|
passthru = old.passthru // {
|
|
|
|
inherit availablePlugins selectedPlugins;
|
|
|
|
inherit 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 == [ ]) {
|
|
|
|
withAPlugin =
|
|
|
|
lib.recurseIntoAttrs
|
|
|
|
(withPlugins (ps: with ps; [ nixops-encrypted-links ])).tests;
|
|
|
|
};
|
2024-02-28 15:22:34 +00:00
|
|
|
};
|
2024-02-28 16:23:21 +00:00
|
|
|
}));
|
|
|
|
in
|
|
|
|
r;
|
2024-02-28 14:49:46 +00:00
|
|
|
|
2024-02-28 16:23:21 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
nixops_unstable_minimal = withPlugins (ps: [ ]);
|
2024-02-28 14:49:46 +00:00
|
|
|
|
|
|
|
# Not recommended; too fragile.
|
|
|
|
nixops_unstable_full = withPlugins (ps: [
|
|
|
|
ps.nixops-aws
|
|
|
|
ps.nixops-digitalocean
|
|
|
|
ps.nixops-encrypted-links
|
|
|
|
ps.nixops-gce
|
|
|
|
ps.nixops-hercules-ci
|
|
|
|
ps.nixops-hetzner
|
|
|
|
ps.nixops-hetznercloud
|
|
|
|
ps.nixops-libvirtd
|
|
|
|
ps.nixops-vbox
|
|
|
|
]);
|
|
|
|
}
|