summary refs log tree commit diff
path: root/pkgs/build-support/closure-info.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/closure-info.nix')
-rw-r--r--pkgs/build-support/closure-info.nix55
1 files changed, 15 insertions, 40 deletions
diff --git a/pkgs/build-support/closure-info.nix b/pkgs/build-support/closure-info.nix
index 4d178ac96c5d..54b1fe59b66d 100644
--- a/pkgs/build-support/closure-info.nix
+++ b/pkgs/build-support/closure-info.nix
@@ -8,51 +8,26 @@
 
 { rootPaths }:
 
-#if builtins.langVersion >= 5 then
-# FIXME: it doesn't work on Hydra, failing to find mkdir;
-#   perhaps .attrs.sh clobbers PATH with new nix?
-if false then
+assert builtins.langVersion >= 5;
 
-  # Nix >= 1.12: Include NAR hash / size info.
+stdenv.mkDerivation {
+  name = "closure-info";
 
-  stdenv.mkDerivation {
-    name = "closure-info";
+  __structuredAttrs = true;
 
-    __structuredAttrs = true;
+  exportReferencesGraph.closure = rootPaths;
 
-    exportReferencesGraph.closure = rootPaths;
+  PATH = "${coreutils}/bin:${jq}/bin";
 
-    PATH = "${coreutils}/bin:${jq}/bin";
+  builder = builtins.toFile "builder"
+    ''
+      if [ -e .attrs.sh ]; then . .attrs.sh; fi
 
-    builder = builtins.toFile "builder"
-      ''
-        if [ -e .attrs.sh ]; then . .attrs.sh; fi
+      out=''${outputs[out]}
 
-        out=''${outputs[out]}
+      mkdir $out
 
-        mkdir $out
-
-        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
-      '';
-  }
-
-else
-
-  # Nix < 1.12
-
-  stdenv.mkDerivation {
-    name = "closure-info";
-
-    exportReferencesGraph =
-      map (x: [("closure-" + baseNameOf x) x]) rootPaths;
-
-    buildInputs = [ perl ];
-
-    buildCommand =
-      ''
-        mkdir $out
-        printRegistration=1 perl ${pathsFromGraph} closure-* > $out/registration
-        perl ${pathsFromGraph} closure-* > $out/store-paths
-      '';
-  }
+      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
+    '';
+}