npins: restore asFlake patch

This commit is contained in:
Primrose 2026-01-15 21:30:49 +01:00
parent 627888c13f
commit d2617493e8
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -112,7 +112,18 @@ let
else
builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = mayOverride name path; };
spec
// rec {
outPath = mayOverride name path;
# Waiting for discussion upstream
# https://github.com/andir/npins/issues/159
asFlake =
if sources ? flake-compat then
(import sources.flake-compat { src = outPath; }).outputs
else
throw ".asFlake needs flake-compat as a source";
};
mkGitSource =
{
@ -221,8 +232,8 @@ let
imageDigest = image_digest;
finalImageTag = image_tag;
};
in
mkFunctor (
sources = mkFunctor (
{
input ? ./sources.json,
}:
@ -246,4 +257,6 @@ mkFunctor (
builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
)
);
in
sources