Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): #1282 assure purity removing dir #1285

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Andres Cuberos <[email protected]> Andres Cuberos <[email protected]>
Brandon Lotero <[email protected]> Brandon Lotero <[email protected]>
Briam Agudelo <[email protected]> Briam Agudelo <[email protected]>
Daniel Murcia <[email protected]> Daniel F. Murcia Rivera <[email protected]>
Daniel Murcia <[email protected]> Daniel Murcia <[email protected]>
Daniel Salazar <[email protected]> Daniel Salazar <[email protected]>
Expand Down
52 changes: 51 additions & 1 deletion src/args/make-python-environment/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@
};
in
import src {pkgs = __nixpkgs__;};
getPoetryPackages = let
tomlPath = "${pythonProjectDir}/poetry.lock";
tomlData = builtins.fromTOML (builtins.readFile tomlPath);
tomlPackages = tomlData.package;
packagesNames = builtins.map (pkg: pkg.name) tomlPackages;
extraPackagesLst = builtins.concatLists (builtins.map (
pkg:
if builtins.hasAttr "extras" pkg
then
builtins.concatLists (
builtins.attrValues pkg.extras
)
else []
)
tomlPackages);
extraPackagesNames =
builtins.map (
extra:
builtins.toString (builtins.head (builtins.split " " (__nixpkgs__.lib.toLower extra)))
)
extraPackagesLst;
in
packagesNames ++ extraPackagesNames;

is39 = pythonVersion == "3.9";
is310 = pythonVersion == "3.10";
Expand All @@ -32,8 +55,35 @@
}
.${pythonVersion};

overrideWithHome = pkg: super:
super.${pkg}.overridePythonAttrs (
old: {
preUnpack =
''
export HOME=$(mktemp -d)
rm -rf /homeless-shelter
''
+ (old.preUnpack or "");
}
);
tomlOverrides = self: super:
builtins.listToAttrs (
builtins.map (
pkg: {
name = pkg;
value = overrideWithHome pkg super;
}
)
getPoetryPackages
);
combinedOverrides = self: super: let
toml = tomlOverrides self super;
orig = overrides self super;
in
toml // orig;

env = poetry2nix.mkPoetryEnv {
overrides = poetry2nix.defaultPoetryOverrides.extend overrides;
overrides = poetry2nix.defaultPoetryOverrides.extend combinedOverrides;
inherit preferWheels;
projectDir = pythonProjectDir;
inherit python;
Expand Down
Loading