diff options
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/binary-cache/default.nix | 13 | ||||
-rw-r--r-- | pkgs/build-support/binary-cache/make-binary-cache.py | 2 | ||||
-rw-r--r-- | pkgs/build-support/closure-info.nix | 14 | ||||
-rw-r--r-- | pkgs/build-support/references-by-popularity/default.nix | 13 |
4 files changed, 16 insertions, 26 deletions
diff --git a/pkgs/build-support/binary-cache/default.nix b/pkgs/build-support/binary-cache/default.nix index 27f9ad9628998..8c610c512276e 100644 --- a/pkgs/build-support/binary-cache/default.nix +++ b/pkgs/build-support/binary-cache/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, buildPackages }: +{ lib, stdenv, coreutils, jq, python3, nix, xz }: # This function is for creating a flat-file binary cache, i.e. the kind created by # nix copy --to file:///some/path and usable as a substituter (with the file:// prefix). @@ -19,15 +19,10 @@ stdenv.mkDerivation { preferLocalBuild = true; - PATH = lib.makeBinPath (with buildPackages; [ coreutils jq python3 nix xz ]); + nativeBuildInputs = [ coreutils jq python3 nix xz ]; - builder = builtins.toFile "builder" '' - . .attrs.sh - - export out=''${outputs[out]} - - mkdir $out - mkdir $out/nar + buildCommand = '' + mkdir -p $out/nar python ${./make-binary-cache.py} diff --git a/pkgs/build-support/binary-cache/make-binary-cache.py b/pkgs/build-support/binary-cache/make-binary-cache.py index 16dd8a7e96bcf..589d005562b1f 100644 --- a/pkgs/build-support/binary-cache/make-binary-cache.py +++ b/pkgs/build-support/binary-cache/make-binary-cache.py @@ -3,7 +3,7 @@ import json import os import subprocess -with open(".attrs.json", "r") as f: +with open(os.environ["NIX_ATTRS_JSON_FILE"], "r") as f: closures = json.load(f)["closure"] os.chdir(os.environ["out"]) diff --git a/pkgs/build-support/closure-info.nix b/pkgs/build-support/closure-info.nix index 6b3ff6fd62b05..f6c31bd786bb7 100644 --- a/pkgs/build-support/closure-info.nix +++ b/pkgs/build-support/closure-info.nix @@ -4,7 +4,7 @@ # "nix-store --load-db" and "nix-store --register-validity # --hash-given". -{ stdenv, buildPackages }: +{ stdenv, coreutils, jq }: { rootPaths }: @@ -19,18 +19,16 @@ stdenv.mkDerivation { preferLocalBuild = true; - PATH = "${buildPackages.coreutils}/bin:${buildPackages.jq}/bin"; + nativeBuildInputs = [ coreutils jq ]; - builder = builtins.toFile "builder" + buildCommand = '' - . .attrs.sh - out=''${outputs[out]} mkdir $out - jq -r ".closure | map(.narSize) | add" < .attrs.json > $out/total-nar-size - jq -r '.closure | map([.path, .narHash, .narSize, "", (.references | length)] + .references) | add | map("\(.)\n") | add' < .attrs.json | head -n -1 > $out/registration - jq -r .closure[].path < .attrs.json > $out/store-paths + jq -r ".closure | map(.narSize) | add" < "$NIX_ATTRS_JSON_FILE" > $out/total-nar-size + jq -r '.closure | map([.path, .narHash, .narSize, "", (.references | length)] + .references) | add | map("\(.)\n") | add' < "$NIX_ATTRS_JSON_FILE" | head -n -1 > $out/registration + jq -r '.closure[].path' < "$NIX_ATTRS_JSON_FILE" > $out/store-paths ''; } diff --git a/pkgs/build-support/references-by-popularity/default.nix b/pkgs/build-support/references-by-popularity/default.nix index dfc25275f34c5..2171c622f000a 100644 --- a/pkgs/build-support/references-by-popularity/default.nix +++ b/pkgs/build-support/references-by-popularity/default.nix @@ -6,11 +6,8 @@ path: runCommand "closure-paths" exportReferencesGraph.graph = path; __structuredAttrs = true; preferLocalBuild = true; - PATH = "${coreutils}/bin:${python3}/bin"; - builder = builtins.toFile "builder" - '' - . .attrs.sh - python3 ${./closure-graph.py} .attrs.json graph > ''${outputs[out]} - ''; - } - "" + nativeBuildInputs = [ coreutils python3 ]; +} +'' + python3 ${./closure-graph.py} "$NIX_ATTRS_JSON_FILE" graph > ''${outputs[out]} +'' |