mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-26 22:31:39 +03:00
refactor(fetchPipMetadata): split package and script
This commit is contained in:
parent
a380add69e
commit
19aeff457d
@ -103,7 +103,10 @@ in {
|
||||
config = {
|
||||
deps = {nixpkgs, ...}:
|
||||
l.mapAttrs (_: l.mkDefault) {
|
||||
fetchPipMetadata = nixpkgs.callPackage ../../../pkgs/fetchPipMetadata {};
|
||||
fetchPipMetadataScript = nixpkgs.callPackage ../../../pkgs/fetchPipMetadata {
|
||||
inherit (cfg) pypiSnapshotDate pipFlags pipVersion requirementsList requirementsFiles nativeBuildInputs;
|
||||
inherit (config.deps) writePureShellScript python nix git;
|
||||
};
|
||||
setuptools = config.deps.python.pkgs.setuptools;
|
||||
inherit (nixpkgs) git;
|
||||
inherit (writers) writePureShellScript;
|
||||
@ -111,10 +114,7 @@ in {
|
||||
|
||||
# Keep package metadata fetched by Pip in our lockfile
|
||||
lock.fields.fetchPipMetadata = {
|
||||
script = config.deps.fetchPipMetadata {
|
||||
inherit (cfg) pypiSnapshotDate pipFlags pipVersion requirementsList requirementsFiles nativeBuildInputs;
|
||||
inherit (config.deps) writePureShellScript python nix git;
|
||||
};
|
||||
script = config.deps.fetchPipMetadataScript;
|
||||
};
|
||||
|
||||
pip = {
|
||||
|
@ -18,7 +18,6 @@
|
||||
# The python version select by the user below might be too old for the
|
||||
# dependencies required by the proxy
|
||||
python3,
|
||||
}: {
|
||||
# Specify the python version for which the packages should be downloaded.
|
||||
# Pip needs to be executed from that specific python version.
|
||||
# Pip accepts '--python-version', but this works only for wheel packages.
|
||||
@ -49,11 +48,8 @@
|
||||
|
||||
path = [nix git] ++ nativeBuildInputs;
|
||||
|
||||
fetchPipMetadata = python.pkgs.buildPythonPackage {
|
||||
name = "fetch_pip_metadata";
|
||||
format = "flit";
|
||||
src = ./src;
|
||||
propagatedBuildInputs = with python.pkgs; [packaging certifi python-dateutil pip];
|
||||
package = import ./package.nix {
|
||||
inherit lib python;
|
||||
};
|
||||
|
||||
args = writeText "pip-args" (builtins.toJSON {
|
||||
@ -74,7 +70,10 @@
|
||||
pipFlags
|
||||
;
|
||||
});
|
||||
|
||||
script =
|
||||
writePureShellScript
|
||||
path
|
||||
"${package}/bin/fetch_pip_metadata ${args}";
|
||||
in
|
||||
writePureShellScript
|
||||
path
|
||||
"${fetchPipMetadata}/bin/fetch_pip_metadata ${args}"
|
||||
script
|
||||
|
15
v1/nix/pkgs/fetchPipMetadata/package.nix
Normal file
15
v1/nix/pkgs/fetchPipMetadata/package.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
lib,
|
||||
# Specify the python version for which the packages should be downloaded.
|
||||
# Pip needs to be executed from that specific python version.
|
||||
# Pip accepts '--python-version', but this works only for wheel packages.
|
||||
python,
|
||||
}: let
|
||||
package = python.pkgs.buildPythonPackage {
|
||||
name = "fetch_pip_metadata";
|
||||
format = "flit";
|
||||
src = ./src;
|
||||
propagatedBuildInputs = with python.pkgs; [packaging certifi python-dateutil pip];
|
||||
};
|
||||
in
|
||||
package
|
Loading…
Reference in New Issue
Block a user