npins update

This commit is contained in:
Katherina Walshe-Grey 2024-07-25 18:34:59 +01:00
parent 0fc7760b88
commit 42ce170014
2 changed files with 55 additions and 22 deletions

View file

@ -3,18 +3,33 @@ let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
mkSource =
spec:
assert spec ? type;
let
path =
if spec.type == "Git" then mkGitSource spec
else if spec.type == "GitRelease" then mkGitSource spec
else if spec.type == "PyPi" then mkPyPiSource spec
else if spec.type == "Channel" then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
if spec.type == "Git" then
mkGitSource spec
else if spec.type == "GitRelease" then
mkGitSource spec
else if spec.type == "PyPi" then
mkPyPiSource spec
else if spec.type == "Channel" then
mkChannelSource spec
else
builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = { repository, revision, url ? null, hash, ... }:
mkGitSource =
{
repository,
revision,
url ? null,
hash,
branch ? null,
...
}:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
@ -23,19 +38,37 @@ let
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else assert repository.type == "Git"; builtins.fetchGit {
url = repository.url;
rev = revision;
# hash = hash;
};
else
assert repository.type == "Git";
let
urlToName =
url: rev:
let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
mkPyPiSource = { url, hash, ... }:
short = builtins.substring 0 7 rev;
appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
in
"${if matched == null then "source" else builtins.head matched}${appendShort}";
name = urlToName repository.url revision;
in
builtins.fetchGit {
url = repository.url;
rev = revision;
inherit name;
# hash = hash;
};
mkPyPiSource =
{ url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource = { url, hash, ... }:
mkChannelSource =
{ url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;

View file

@ -22,9 +22,9 @@
"url": "https://git.qenya.tel/qenya/birdsong.git"
},
"branch": "main",
"revision": "ad6a7c93431fbb371d434f4951a034e8897c4d08",
"revision": "752faa333d5686b5457e6c956d015bd6ec4e3eca",
"url": null,
"hash": "13d7g24p3pfdrdm2rnv22vd7qhxh4nawjy3z4y3cq6g3pn2avcg7"
"hash": "1zl4zwkqapwmghbmzcpfzm4sfmmfxvp8j5bk241zmkvi8frlx1jf"
},
"home-manager": {
"type": "Git",
@ -53,8 +53,8 @@
"nixpkgs": {
"type": "Channel",
"name": "nixos-24.05",
"url": "https://releases.nixos.org/nixos/24.05/nixos-24.05.3214.575f3027caa1/nixexprs.tar.xz",
"hash": "0w5kza4qrnlhsp1ls385zmf6cbkfwcxiriz69bi29zjhn2rl9gh5"
"url": "https://releases.nixos.org/nixos/24.05/nixos-24.05.3268.d0907b75146a/nixexprs.tar.xz",
"hash": "1j40g3ms1pqldmx9pfhw4mslhxnrnklj0phwhzgk5g3m5hczb1j6"
},
"nur": {
"type": "Git",
@ -64,9 +64,9 @@
"repo": "NUR"
},
"branch": "master",
"revision": "163ce69fca09c026a5963a4a44f7cf0b83178ee3",
"url": "https://github.com/nix-community/NUR/archive/163ce69fca09c026a5963a4a44f7cf0b83178ee3.tar.gz",
"hash": "1nnis8gjilg2l0hr6vcmsxlfkb6gbip5iry3065ilj5dkxcjn0j8"
"revision": "f769fc25d19d5521a997686ffd66c08a3d23334f",
"url": "https://github.com/nix-community/NUR/archive/f769fc25d19d5521a997686ffd66c08a3d23334f.tar.gz",
"hash": "1jrllqirq1jig9v7f7r9h5jmywcia7h7qdfn58z8gq24vbp8j0h4"
}
},
"version": 3