mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
npins: enhance import-from-flake capabilities
We still chose this implementation because `getFlake' is "broken". c.f. https://github.com/andir/npins/issues/159#issuecomment-3201185411 Also this avoids the double fetch problem. c.f. https://github.com/andir/npins/issues/159#issuecomment-3148532945
This commit is contained in:
parent
e3c26ec831
commit
52e027ddd2
2 changed files with 34 additions and 4 deletions
|
|
@ -64,7 +64,17 @@ let
|
|||
then mkTarballSource spec
|
||||
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 = {
|
||||
repository,
|
||||
|
|
@ -146,7 +156,10 @@ let
|
|||
url = locked_url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
sources =
|
||||
if version == 5
|
||||
then builtins.mapAttrs mkSource data.pins
|
||||
else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`";
|
||||
in
|
||||
if version == 5
|
||||
then builtins.mapAttrs mkSource data.pins
|
||||
else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
||||
sources
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue