about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/references-by-popularity/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/references-by-popularity/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/references-by-popularity/default.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/references-by-popularity/default.nix b/nixpkgs/pkgs/build-support/references-by-popularity/default.nix
new file mode 100644
index 000000000000..2171c622f000
--- /dev/null
+++ b/nixpkgs/pkgs/build-support/references-by-popularity/default.nix
@@ -0,0 +1,13 @@
+{ runCommand, python3, coreutils }:
+# Write the references of `path' to a file, in order of how "popular" each
+# reference is. Nix 2 only.
+path: runCommand "closure-paths"
+{
+  exportReferencesGraph.graph = path;
+  __structuredAttrs = true;
+  preferLocalBuild = true;
+  nativeBuildInputs = [ coreutils python3 ];
+}
+''
+  python3 ${./closure-graph.py} "$NIX_ATTRS_JSON_FILE" graph > ''${outputs[out]}
+''