about summary refs log tree commit diff
path: root/pkgs/top-level/release-outpaths.nix
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-11-21 22:55:15 -0800
committerAdam Joseph <adam@westernsemico.com>2023-12-15 04:21:32 -0800
commit5c9ec8597b9d2dc586c64b1897d1440d6284c968 (patch)
treeb8fa51761fe969681fa4add52b49a9345ebb5d0a /pkgs/top-level/release-outpaths.nix
parent02a2822def0f4779f026d93080e0b7852c47fb22 (diff)
pkgs/top-level/release-outpaths.nix: vendor from ofborg
This commit vendors `outpaths.nix` from ofborg commit

  74f38efa7ef6f0e8e71ec3bfc675ae4fb57d7491
Diffstat (limited to 'pkgs/top-level/release-outpaths.nix')
-rw-r--r--pkgs/top-level/release-outpaths.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/top-level/release-outpaths.nix b/pkgs/top-level/release-outpaths.nix
new file mode 100644
index 0000000000000..ff0fbdb80ea3c
--- /dev/null
+++ b/pkgs/top-level/release-outpaths.nix
@@ -0,0 +1,72 @@
+#!/usr/bin/env nix-shell
+# When using as a callable script, passing `--argstr path some/path` overrides $PWD.
+#!nix-shell -p nix -i "nix-env -qaP --no-name --out-path --arg checkMeta true --argstr path $PWD -f"
+
+# Vendored from:
+#   https://raw.githubusercontent.com/NixOS/ofborg/74f38efa7ef6f0e8e71ec3bfc675ae4fb57d7491/ofborg/src/outpaths.nix
+{ checkMeta
+, path ? ./.
+}:
+let
+  lib = import (path + "/lib");
+  hydraJobs = import (path + "/pkgs/top-level/release.nix")
+    # Compromise: accuracy vs. resources needed for evaluation.
+    {
+      supportedSystems = [
+        "aarch64-linux"
+        "aarch64-darwin"
+        #"i686-linux"  # !!!
+        "x86_64-linux"
+        "x86_64-darwin"
+      ];
+
+      nixpkgsArgs = {
+        config = {
+          allowAliases = false;
+          allowBroken = true;
+          allowUnfree = true;
+          allowInsecurePredicate = x: true;
+          checkMeta = checkMeta;
+
+          handleEvalIssue = reason: errormsg:
+            let
+              fatalErrors = [
+                "unknown-meta"
+                "broken-outputs"
+              ];
+            in
+            if builtins.elem reason fatalErrors
+            then abort errormsg
+            else true;
+
+          inHydra = true;
+        };
+      };
+    };
+  recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
+
+  # hydraJobs leaves recurseForDerivations as empty attrmaps;
+  # that would break nix-env and we also need to recurse everywhere.
+  tweak = lib.mapAttrs
+    (name: val:
+      if name == "recurseForDerivations" then true
+      else if lib.isAttrs val && val.type or null != "derivation"
+      then recurseIntoAttrs (tweak val)
+      else val
+    );
+
+  # Some of these contain explicit references to platform(s) we want to avoid;
+  # some even (transitively) depend on ~/.nixpkgs/config.nix (!)
+  blacklist = [
+    "tarball"
+    "metrics"
+    "manual"
+    "darwin-tested"
+    "unstable"
+    "stdenvBootstrapTools"
+    "moduleSystem"
+    "lib-tests" # these just confuse the output
+  ];
+
+in
+tweak (builtins.removeAttrs hydraJobs blacklist)