This commit is contained in:
+30
-19
@@ -65,7 +65,9 @@ let
|
||||
if pkgs == null then
|
||||
{
|
||||
inherit (builtins) fetchTarball fetchurl;
|
||||
# For some fucking reason, fetchGit has a different signature than the other builtin fetchers …
|
||||
# Frustratingly, due to flakes and `fetchTree`, `fetchGit`
|
||||
# has a different signature than the other builtin
|
||||
# fetchers
|
||||
fetchGit = args: (builtins.fetchGit args).outPath;
|
||||
}
|
||||
else
|
||||
@@ -95,7 +97,6 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
# Dispatch to the correct code path based on the type
|
||||
path =
|
||||
if spec.type == "Git" then
|
||||
mkGitSource fetchers spec
|
||||
@@ -105,8 +106,8 @@ let
|
||||
mkPyPiSource fetchers spec
|
||||
else if spec.type == "Channel" then
|
||||
mkChannelSource fetchers spec
|
||||
else if spec.type == "Tarball" then
|
||||
mkTarballSource fetchers spec
|
||||
else if spec.type == "Url" || spec.type == "MutableUrl" then
|
||||
mkUrlSource fetchers spec
|
||||
else if spec.type == "Container" then
|
||||
mkContainerSource pkgs spec
|
||||
else
|
||||
@@ -192,16 +193,20 @@ let
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkTarballSource =
|
||||
{ fetchTarball, ... }:
|
||||
mkUrlSource =
|
||||
{
|
||||
url,
|
||||
locked_url ? url,
|
||||
hash,
|
||||
fetchTarball,
|
||||
fetchurl,
|
||||
...
|
||||
}:
|
||||
fetchTarball {
|
||||
url = locked_url;
|
||||
{
|
||||
url,
|
||||
hash,
|
||||
unpack,
|
||||
...
|
||||
}:
|
||||
(if unpack then fetchTarball else fetchurl) {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
@@ -211,16 +216,22 @@ let
|
||||
image_name,
|
||||
image_tag,
|
||||
image_digest,
|
||||
hash,
|
||||
...
|
||||
}:
|
||||
}@args:
|
||||
if pkgs == null then
|
||||
builtins.throw "container sources require passing in a Nixpkgs value: https://github.com/andir/npins/blob/master/README.md#using-the-nixpkgs-fetchers"
|
||||
else
|
||||
pkgs.dockerTools.pullImage {
|
||||
imageName = image_name;
|
||||
imageDigest = image_digest;
|
||||
finalImageTag = image_tag;
|
||||
};
|
||||
pkgs.dockerTools.pullImage (
|
||||
{
|
||||
imageName = image_name;
|
||||
imageDigest = image_digest;
|
||||
finalImageTag = image_tag;
|
||||
hash = hash;
|
||||
}
|
||||
// (if args.arch or null != null then { arch = args.arch; } else { })
|
||||
);
|
||||
|
||||
in
|
||||
mkFunctor (
|
||||
{
|
||||
@@ -231,7 +242,7 @@ mkFunctor (
|
||||
if builtins.isPath input then
|
||||
# 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
|
||||
# *piegames sighs*
|
||||
# See: <https://git.lix.systems/lix-project/lix/issues/1098>
|
||||
if builtins.pathExists input then
|
||||
builtins.fromJSON (builtins.readFile input)
|
||||
else
|
||||
@@ -242,7 +253,7 @@ mkFunctor (
|
||||
throw "Unsupported input type ${builtins.typeOf input}, must be a path or an attrset";
|
||||
version = data.version;
|
||||
in
|
||||
if version == 7 then
|
||||
if version == 8 then
|
||||
builtins.mapAttrs (name: spec: mkFunctor (mkSource name spec)) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
||||
|
||||
+4
-3
@@ -3,8 +3,9 @@
|
||||
"nixpkgs": {
|
||||
"type": "Channel",
|
||||
"name": "nixos-unstable",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre1004030.64c08a7ca051/nixexprs.tar.xz",
|
||||
"hash": "sha256-NpH8iEQ5JHv/BtUuzTEXUMDxPLetCDzIv4OxL8H7Kps="
|
||||
"artifact": "nixexprs.tar.xz",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1014179.9ae611a455b9/nixexprs.tar.xz",
|
||||
"hash": "sha256-d34lhgOet4IqYMnCxbIvwFBMOyTV6PT4TyNEOP0/ZhU="
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"type": "Git",
|
||||
@@ -20,5 +21,5 @@
|
||||
"hash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM="
|
||||
}
|
||||
},
|
||||
"version": 7
|
||||
"version": 8
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user