mirror of
https://codeberg.org/leana8959/.files.git
synced 2026-02-01 14:39:39 +00:00
npins: restore asFlake patch
This commit is contained in:
parent
627888c13f
commit
d2617493e8
1 changed files with 39 additions and 26 deletions
|
|
@ -112,7 +112,18 @@ let
|
||||||
else
|
else
|
||||||
builtins.throw "Unknown source type ${spec.type}";
|
builtins.throw "Unknown source type ${spec.type}";
|
||||||
in
|
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 =
|
mkGitSource =
|
||||||
{
|
{
|
||||||
|
|
@ -221,29 +232,31 @@ let
|
||||||
imageDigest = image_digest;
|
imageDigest = image_digest;
|
||||||
finalImageTag = image_tag;
|
finalImageTag = image_tag;
|
||||||
};
|
};
|
||||||
in
|
|
||||||
mkFunctor (
|
sources = mkFunctor (
|
||||||
{
|
{
|
||||||
input ? ./sources.json,
|
input ? ./sources.json,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
data =
|
data =
|
||||||
if builtins.isPath input then
|
if builtins.isPath input then
|
||||||
# while `readFile` will throw an error anyways if the path doesn't exist,
|
# while `readFile` will throw an error anyways if the path doesn't exist,
|
||||||
# we still need to check beforehand because *our* error can be caught but not the one from the builtin
|
# we still need to check beforehand because *our* error can be caught but not the one from the builtin
|
||||||
# *piegames sighs*
|
# *piegames sighs*
|
||||||
if builtins.pathExists input then
|
if builtins.pathExists input then
|
||||||
builtins.fromJSON (builtins.readFile input)
|
builtins.fromJSON (builtins.readFile input)
|
||||||
|
else
|
||||||
|
throw "Input path ${toString input} does not exist"
|
||||||
|
else if builtins.isAttrs input then
|
||||||
|
input
|
||||||
else
|
else
|
||||||
throw "Input path ${toString input} does not exist"
|
throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset";
|
||||||
else if builtins.isAttrs input then
|
version = data.version;
|
||||||
input
|
in
|
||||||
else
|
if version == 7 then
|
||||||
throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset";
|
builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins
|
||||||
version = data.version;
|
else
|
||||||
in
|
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
||||||
if version == 7 then
|
);
|
||||||
builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins
|
in
|
||||||
else
|
sources
|
||||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue