mirror of
https://github.com/NotAShelf/nyxexprs.git
synced 2026-06-13 00:09:09 +00:00
pins: upgrade to v8
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I424803b1c97c4fbd4db6b2372b79581c6a6a6964
This commit is contained in:
parent
5771475970
commit
567c248c4c
2 changed files with 30 additions and 18 deletions
|
|
@ -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`"
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@
|
|||
"nixpkgs": {
|
||||
"type": "Channel",
|
||||
"name": "nixpkgs-unstable",
|
||||
"artifact": "nixexprs.tar.xz",
|
||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1006943.e9a7635a5759/nixexprs.tar.xz",
|
||||
"hash": "sha256-j1JL8PtaAVdH84cV+Scicmrck1tX0CM60F31md5C/MM="
|
||||
},
|
||||
|
|
@ -159,5 +160,5 @@
|
|||
"hash": "sha256-Amaz+83mSPue+pjZq/pJiCxu5QczYvmJk6f96eraaK8="
|
||||
}
|
||||
},
|
||||
"version": 7
|
||||
"version": 8
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue