diff --git a/pkgs/by-name/up/update-python-libraries/package.nix b/pkgs/by-name/up/update-python-libraries/package.nix index 46e0e3b7f772..0bf7b9b697ee 100644 --- a/pkgs/by-name/up/update-python-libraries/package.nix +++ b/pkgs/by-name/up/update-python-libraries/package.nix @@ -1,4 +1,5 @@ { + lib, python3, runCommand, git, @@ -9,8 +10,6 @@ runCommand "update-python-libraries" { buildInputs = [ - nix - nix-prefetch-git (python3.withPackages ( ps: with ps; [ packaging @@ -18,11 +17,14 @@ runCommand "update-python-libraries" toolz ] )) - git ]; } '' cp ${./update-python-libraries.py} $out patchShebangs $out - substituteInPlace $out --replace 'GIT = "git"' 'GIT = "${git}/bin/git"' + substituteInPlace $out \ + --replace-fail 'NIX = "nix"' 'NIX = "${lib.getExe nix}"' \ + --replace-fail 'NIX_PREFETCH_URL = "nix-prefetch-url"' 'NIX_PREFETCH_URL = "${lib.getExe' nix "nix-prefetch-url"}"' \ + --replace-fail 'NIX_PREFETCH_GIT = "nix-prefetch-git"' 'NIX_PREFETCH_GIT = "${lib.getExe nix-prefetch-git}"' \ + --replace-fail 'GIT = "git"' 'GIT = "${lib.getExe git}"' '' diff --git a/pkgs/by-name/up/update-python-libraries/update-python-libraries.py b/pkgs/by-name/up/update-python-libraries/update-python-libraries.py index 6ee3d05c3465..0c8f81c763f6 100755 --- a/pkgs/by-name/up/update-python-libraries/update-python-libraries.py +++ b/pkgs/by-name/up/update-python-libraries/update-python-libraries.py @@ -36,10 +36,13 @@ PRERELEASES = False BULK_UPDATE = False +NIX = "nix" +NIX_PREFETCH_URL = "nix-prefetch-url" +NIX_PREFETCH_GIT = "nix-prefetch-git" GIT = "git" NIXPKGS_ROOT = ( - subprocess.check_output(["git", "rev-parse", "--show-toplevel"]) + subprocess.check_output([GIT, "rev-parse", "--show-toplevel"]) .decode("utf-8") .strip() ) @@ -79,7 +82,7 @@ def _get_attr_value(attr_path: str) -> Optional[Any]: try: response = subprocess.check_output( [ - "nix", + NIX, "--extra-experimental-features", "nix-command", "eval", @@ -164,7 +167,7 @@ def _hash_to_sri(algorithm, value): return ( subprocess.check_output( [ - "nix", + NIX, "--extra-experimental-features", "nix-command", "hash", @@ -260,7 +263,7 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t try: homepage = subprocess.check_output( [ - "nix", + NIX, "--extra-experimental-features", "nix-command", "eval", @@ -301,7 +304,7 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t algorithm = "sha256" cmd = [ - "nix-prefetch-git", + NIX_PREFETCH_GIT, f"https://github.com/{owner}/{repo}.git", "--hash", algorithm, @@ -317,7 +320,7 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t hash = ( subprocess.check_output( [ - "nix-prefetch-url", + NIX_PREFETCH_URL, "--type", "sha256", "--unpack", @@ -336,7 +339,7 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t try: hash = ( subprocess.check_output( - ["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], + [NIX_PREFETCH_URL, "--type", "sha256", "--unpack", tag_url], stderr=subprocess.DEVNULL, ) .decode("utf-8") diff --git a/pkgs/tools/package-management/nix-prefetch-scripts/default.nix b/pkgs/tools/package-management/nix-prefetch-scripts/default.nix index 040535f63ed8..8c88fcb6bb30 100644 --- a/pkgs/tools/package-management/nix-prefetch-scripts/default.nix +++ b/pkgs/tools/package-management/nix-prefetch-scripts/default.nix @@ -49,6 +49,7 @@ let description = "Script used to obtain source hashes for fetch${tool}"; maintainers = with maintainers; [ bennofs ]; platforms = platforms.unix; + mainProgram = "nix-prefetch-${tool}"; }; }; in