Skip to content

The agent that grows with you

nix: unpack only the archive artifacts of a pm pin

ethernete34214118fd8
diff --git a/nix/checks.nix b/nix/checks.nix
index 893bb1fb3aa..d059bac11e1 100644
--- a/nix/checks.nix
+++ b/nix/checks.nix
@@ -155,6 +155,17 @@ json.dump(sorted(leaf_paths(DEFAULT_CONFIG)), sys.stdout, indent=2)
''
);
+ # pm/lock.json pins provenance sidecars (checksums.txt, .sig/.pem/.asc)
+ # next to these archives. `nix flake check` otherwise only evaluates
+ # the pm derivations, so a sidecar leaking into srcs ("do not know
+ # how to unpack") stayed green; build the two sidecar-bearing pins.
+ pm-packages-unpack = pkgs.runCommand "hermes-pm-packages-unpack" { } ''
+ test -x ${self'.packages.pm-tirith}/tirith
+ test -x ${self'.packages.pm-iron-proxy}/iron-proxy
+ mkdir -p $out
+ echo "ok" > $out/result
+ '';
+
# Verify the default package builds successfully (cross-platform).
# On Linux the runtime checks below already depend on the package,
# but this ensures darwin builders also build it during flake check.
diff --git a/nix/pm-packages.nix b/nix/pm-packages.nix
index 597c5d5706b..c217c9c2526 100644
--- a/nix/pm-packages.nix
+++ b/nix/pm-packages.nix
@@ -34,6 +34,13 @@ let
in
if found == null then null else if builtins.isList found then found else [ found ];
+ # The archive suffixes pm/store.py::extract unpacks. A pin may also list
+ # provenance sidecars (checksums.txt, .sig/.pem/.asc) that pm verifies at
+ # install time; the fixed-output hash already pins the archive here, and
+ # stdenv's unpackPhase has no unpacker for them, so they are left out.
+ isArchive = artifact:
+ lib.any (suffix: lib.hasSuffix suffix artifact.url) [ ".tar.gz" ".tgz" ".tar.xz" ".txz" ".tar.bz2" ".zip" ];
+
derive = name: pin: artifacts:
stdenv.mkDerivation {
pname = name;
@@ -42,7 +49,7 @@ let
srcs = map (artifact: fetchurl {
urls = [ artifact.url "${mirror.origin}/${mirror.prefix}${artifact.sha256}" ];
sha256 = artifact.sha256;
- }) artifacts;
+ }) (builtins.filter isArchive artifacts);
# pm's store publishes the unpacked tree; mirror that shape. Several
# archives unpack over one another into the same root, exactly as