-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263308 from K900/rip-poetry2nix
treewide: drop poetry2nix
- Loading branch information
Showing
60 changed files
with
614 additions
and
29,509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 53 additions & 105 deletions
158
pkgs/applications/networking/cluster/nixops/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,56 @@ | ||
{ nixosTests | ||
, pkgs | ||
, poetry2nix | ||
, lib | ||
, overrides ? (self: super: {}) | ||
}: | ||
{ python3 }: | ||
|
||
let | ||
|
||
interpreter = ( | ||
poetry2nix.mkPoetryPackages { | ||
projectDir = ./.; | ||
python = pkgs.python310; | ||
overrides = [ | ||
poetry2nix.defaultPoetryOverrides | ||
(import ./poetry-git-overlay.nix { inherit pkgs; }) | ||
( | ||
self: super: { | ||
|
||
nixops = super.nixops.overridePythonAttrs ( | ||
old: { | ||
version = "${old.version}-pre-${lib.substring 0 7 super.nixops.src.rev or "dirty"}"; | ||
|
||
postPatch = '' | ||
substituteInPlace nixops/args.py --subst-var version | ||
''; | ||
|
||
meta = old.meta // { | ||
homepage = "https://github.com/NixOS/nixops"; | ||
description = "NixOS cloud provisioning and deployment tool"; | ||
maintainers = with lib.maintainers; [ adisbladis aminechikhaoui roberth ]; | ||
platforms = lib.platforms.unix; | ||
license = lib.licenses.lgpl3; | ||
mainProgram = "nixops"; | ||
}; | ||
|
||
} | ||
); | ||
} | ||
) | ||
|
||
# User provided overrides | ||
overrides | ||
|
||
# Make nixops pluginable | ||
(self: super: let | ||
# Create a fake sphinx directory that doesn't pull the entire setup hook and incorrect python machinery | ||
sphinx = pkgs.runCommand "sphinx" {} '' | ||
mkdir -p $out/bin | ||
for f in ${pkgs.python3.pkgs.sphinx}/bin/*; do | ||
ln -s $f $out/bin/$(basename $f) | ||
done | ||
''; | ||
|
||
in { | ||
nixops = super.__toPluginAble { | ||
drv = super.nixops; | ||
finalDrv = self.nixops; | ||
|
||
nativeBuildInputs = [ sphinx ]; | ||
|
||
postInstall = '' | ||
doc_cache=$(mktemp -d) | ||
sphinx-build -b man -d $doc_cache doc/ $out/share/man/man1 | ||
html=$(mktemp -d) | ||
sphinx-build -b html -d $doc_cache doc/ $out/share/nixops/doc | ||
''; | ||
|
||
}; | ||
}) | ||
|
||
(self: super: { | ||
cryptography = super.cryptography.overridePythonAttrs (old: { | ||
meta = old.meta // { | ||
knownVulnerabilities = old.meta.knownVulnerabilities or [ ] | ||
++ lib.optionals (lib.versionOlder old.version "41.0.0") [ | ||
"CVE-2023-2650" | ||
"CVE-2023-2975" | ||
"CVE-2023-3446" | ||
"CVE-2023-3817" | ||
"CVE-2023-38325" | ||
]; | ||
}; | ||
}); | ||
}) | ||
|
||
]; | ||
} | ||
).python; | ||
|
||
pkg = (interpreter.pkgs.nixops.withPlugins(ps: [ | ||
ps.nixops-aws | ||
ps.nixops-digitalocean | ||
ps.nixops-encrypted-links | ||
ps.nixops-gcp | ||
ps.nixops-hercules-ci | ||
ps.nixops-hetzner | ||
ps.nixopsvbox | ||
ps.nixops-virtd | ||
ps.nixops-hetznercloud | ||
])).overrideAttrs (finalAttrs: prevAttrs: { | ||
passthru = prevAttrs.passthru or {} // { | ||
tests = prevAttrs.passthru.tests or {} // | ||
nixosTests.nixops.unstable.passthru.override { nixopsPkg = pkg; }; | ||
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; | ||
}; | ||
|
||
# selector is a function mapping pythonPackages to a list of plugins | ||
# e.g. nixops_unstable.withPlugins (ps: with ps; [ nixops-aws ]) | ||
withPlugins = selector: let | ||
selected = selector (plugins python.pkgs); | ||
in python.pkgs.toPythonApplication (python.pkgs.nixops.overridePythonAttrs (old: { | ||
propagatedBuildInputs = old.propagatedBuildInputs ++ selected; | ||
|
||
# Propagating dependencies leaks them through $PYTHONPATH which causes issues | ||
# when used in nix-shell. | ||
postFixup = '' | ||
rm $out/nix-support/propagated-build-inputs | ||
''; | ||
|
||
passthru = old.passthru // { | ||
plugins = plugins python.pkgs; | ||
inherit withPlugins python; | ||
}; | ||
}); | ||
in pkg | ||
})); | ||
in 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 | ||
]) |
56 changes: 56 additions & 0 deletions
56
pkgs/applications/networking/cluster/nixops/plugins/nixops-aws.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ lib | ||
, buildPythonPackage | ||
, fetchFromGitHub | ||
, unstableGitUpdater | ||
, poetry-core | ||
, boto | ||
, boto3 | ||
, nixops | ||
, nixos-modules-contrib | ||
, typing-extensions | ||
}: | ||
|
||
buildPythonPackage { | ||
pname = "nixops-aws"; | ||
version = "unstable-2023-08-09"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "NixOS"; | ||
repo = "nixops-aws"; | ||
rev = "8802d1cda9004ec1362815292c2a8ab95e6d64e8"; | ||
hash = "sha256-i0KjFrwpDHRch9jorccdVwnjAQiORClDUqm2R2xvwuU="; | ||
}; | ||
|
||
postPatch = '' | ||
substituteInPlace pyproject.toml \ | ||
--replace poetry.masonry.api poetry.core.masonry.api \ | ||
--replace "poetry>=" "poetry-core>=" | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
poetry-core | ||
]; | ||
|
||
buildInputs = [ | ||
nixops | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
boto | ||
boto3 | ||
nixos-modules-contrib | ||
typing-extensions | ||
]; | ||
|
||
pythonImportsCheck = [ "nixops_aws" ]; | ||
|
||
passthru.updateScript = unstableGitUpdater {}; | ||
|
||
meta = with lib; { | ||
description = "AWS plugin for NixOps"; | ||
homepage = "https://github.com/NixOS/nixops-aws"; | ||
license = licenses.lgpl3Only; | ||
maintainers = nixops.meta.maintainers; | ||
}; | ||
} |
50 changes: 50 additions & 0 deletions
50
pkgs/applications/networking/cluster/nixops/plugins/nixops-digitalocean.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ lib | ||
, buildPythonPackage | ||
, fetchFromGitHub | ||
, unstableGitUpdater | ||
, poetry-core | ||
, nixops | ||
, digital-ocean | ||
}: | ||
|
||
buildPythonPackage { | ||
pname = "nixops-digitalocean"; | ||
version = "unstable-2022-08-14"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "nix-community"; | ||
repo = "nixops-digitalocean"; | ||
rev = "e977b7f11e264a6a2bff2dcbc7b94c6a97b92fff"; | ||
hash = "sha256-aJtShvdqjAiCK5oZL0GR5cleDb4s1pJkO6UPKGd4Dgg="; | ||
}; | ||
|
||
postPatch = '' | ||
substituteInPlace pyproject.toml \ | ||
--replace poetry.masonry.api poetry.core.masonry.api \ | ||
--replace "poetry>=" "poetry-core>=" | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
poetry-core | ||
]; | ||
|
||
buildInputs = [ | ||
nixops | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
digital-ocean | ||
]; | ||
|
||
pythonImportsCheck = [ "nixops_digitalocean" ]; | ||
|
||
passthru.updateScript = unstableGitUpdater {}; | ||
|
||
meta = with lib; { | ||
description = "NixOps Digitalocean plugin"; | ||
homepage = "https://github.com/nix-community/nixops-digitalocean"; | ||
license = licenses.lgpl3Only; | ||
maintainers = with maintainers; [ kiwi ]; | ||
}; | ||
} |
45 changes: 45 additions & 0 deletions
45
pkgs/applications/networking/cluster/nixops/plugins/nixops-encrypted-links.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ lib | ||
, buildPythonPackage | ||
, fetchFromGitHub | ||
, unstableGitUpdater | ||
, poetry-core | ||
, nixops | ||
}: | ||
|
||
buildPythonPackage { | ||
pname = "nixops-encrypted-links"; | ||
version = "unstable-2021-02-16"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "nix-community"; | ||
repo = "nixops-encrypted-links"; | ||
rev = "e2f196fce15fcfb00d18c055e1ac53aec33b8fb1"; | ||
hash = "sha256-1TTbARyCfrLxF6SVNkmIKNNcLS9FVW22d9w0VRrH1os="; | ||
}; | ||
|
||
postPatch = '' | ||
substituteInPlace pyproject.toml \ | ||
--replace poetry.masonry.api poetry.core.masonry.api \ | ||
--replace "poetry>=" "poetry-core>=" | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
poetry-core | ||
]; | ||
|
||
buildInputs = [ | ||
nixops | ||
]; | ||
|
||
pythonImportsCheck = [ "nixops_encrypted_links" ]; | ||
|
||
passthru.updateScript = unstableGitUpdater {}; | ||
|
||
meta = with lib; { | ||
description = "EncryptedLinksTo from Nixops 1 module port"; | ||
homepage = "https://github.com/nix-community/nixops-encrypted-links"; | ||
license = licenses.mit; | ||
maintainers = with maintainers; [ adisbladis ]; | ||
}; | ||
} |
54 changes: 54 additions & 0 deletions
54
pkgs/applications/networking/cluster/nixops/plugins/nixops-gce.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ lib | ||
, buildPythonPackage | ||
, fetchFromGitHub | ||
, unstableGitUpdater | ||
, poetry-core | ||
, cryptography | ||
, libcloud | ||
, nixops | ||
, nixos-modules-contrib | ||
}: | ||
|
||
buildPythonPackage { | ||
pname = "nixops-gce"; | ||
version = "unstable-2023-05-26"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "nix-community"; | ||
repo = "nixops-gce"; | ||
rev = "d13cb794aef763338f544010ceb1816fe31d7f42"; | ||
hash = "sha256-UkYf6CoUrr8yuQoe/ik6vu+UCi3ByJd0BdkS9SLEp0Q="; | ||
}; | ||
|
||
postPatch = '' | ||
substituteInPlace pyproject.toml \ | ||
--replace poetry.masonry.api poetry.core.masonry.api \ | ||
--replace "poetry>=" "poetry-core>=" | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
poetry-core | ||
]; | ||
|
||
buildInputs = [ | ||
nixops | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
cryptography | ||
libcloud | ||
nixos-modules-contrib | ||
]; | ||
|
||
pythonImportsCheck = [ "nixops_gcp" ]; | ||
|
||
passthru.updateScript = unstableGitUpdater {}; | ||
|
||
meta = with lib; { | ||
description = "NixOps Google Cloud Backend"; | ||
homepage = "https://github.com/nix-community/nixops-gce"; | ||
license = licenses.mit; | ||
maintainers = nixops.meta.maintainers; | ||
}; | ||
} |
Oops, something went wrong.