diff options
Diffstat (limited to 'npins')
-rw-r--r-- | npins/default.nix | 80 | ||||
-rw-r--r-- | npins/sources.json | 95 |
2 files changed, 175 insertions, 0 deletions
diff --git a/npins/default.nix b/npins/default.nix new file mode 100644 index 00000000..5e7d086e --- /dev/null +++ b/npins/default.nix @@ -0,0 +1,80 @@ +# Generated by npins. Do not modify; will be overwritten regularly +let + data = builtins.fromJSON (builtins.readFile ./sources.json); + version = data.version; + + 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}"; + in + spec // { outPath = path; }; + + 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 + if url != null then + (builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + }) + else + assert repository.type == "Git"; + let + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url; + + 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, ... }: + builtins.fetchTarball { + inherit url; + sha256 = hash; + }; +in +if version == 3 then + builtins.mapAttrs (_: mkSource) data.pins +else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json new file mode 100644 index 00000000..ad19dd7f --- /dev/null +++ b/npins/sources.json @@ -0,0 +1,95 @@ +{ + "pins": { + "agenix": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "ryantm", + "repo": "agenix" + }, + "branch": "main", + "revision": "3a56735779db467538fb2e577eda28a9daacaca6", + "url": "https://github.com/ryantm/agenix/archive/3a56735779db467538fb2e577eda28a9daacaca6.tar.gz", + "hash": "1h66zapc6im07k3kcgvhy3lhzahb70vd6m2ijhz4i0v6mn5l3fk9" + }, + "darwin": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "lnl7", + "repo": "nix-darwin" + }, + "branch": "master", + "revision": "50581970f37f06a4719001735828519925ef8310", + "url": "https://github.com/lnl7/nix-darwin/archive/50581970f37f06a4719001735828519925ef8310.tar.gz", + "hash": "1c2zihl124j7xz5fyhkjvcpabyrvs1qgix1fzr0fc002mnkcrf13" + }, + "emacs-overlay": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "emacs-overlay" + }, + "branch": "master", + "revision": "012409732a53433d75db7bb2e06dd0bdaf8ca7ea", + "url": "https://github.com/nix-community/emacs-overlay/archive/012409732a53433d75db7bb2e06dd0bdaf8ca7ea.tar.gz", + "hash": "1rsxi3xlrll0s3brwr1s1yb6zjzzkjzm704j4dzf05ss0m4pzc0d" + }, + "home-manager": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "home-manager" + }, + "branch": "master", + "revision": "7e68e55d2e16d3a1e92a679430728c35a30fd24e", + "url": "https://github.com/nix-community/home-manager/archive/7e68e55d2e16d3a1e92a679430728c35a30fd24e.tar.gz", + "hash": "1qxshjyx38i6sqg8x3a2hxxgpzajspzf95991iwgv04m33ry4k83" + }, + "nix-index-database": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "Mic92", + "repo": "nix-index-database" + }, + "branch": "main", + "revision": "afc8f5a6a2c00a89a6d6bdcaf4157797960f10f7", + "url": "https://github.com/Mic92/nix-index-database/archive/afc8f5a6a2c00a89a6d6bdcaf4157797960f10f7.tar.gz", + "hash": "0kh8nyxp44wv5i37jwylf6vvjcwnr6zfqavxajb3zglhkrdfija6" + }, + "nixos-hardware": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "NixOS", + "repo": "nixos-hardware" + }, + "branch": "master", + "revision": "231274268ff2250d4730e274b808f66ef91b6381", + "url": "https://github.com/NixOS/nixos-hardware/archive/231274268ff2250d4730e274b808f66ef91b6381.tar.gz", + "hash": "1rpxx6ymqvbdfzfi2qqyl63lgvz7jipwx48pwn0krprp0jlzzx9s" + }, + "nixpkgs": { + "type": "Channel", + "name": "nixos-unstable", + "url": "https://releases.nixos.org/nixos/unstable/nixos-24.11pre644565.b2852eb9365c/nixexprs.tar.xz", + "hash": "0jykdcs08z1cfjaqgdaqf5dadsx9sj3lr0nsfkz2ydp9rx5vhb7i" + }, + "nur": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "NUR" + }, + "branch": "master", + "revision": "a0498a771e9d6d3f66dba3bd166a9ebf3cc3cb8c", + "url": "https://github.com/nix-community/NUR/archive/a0498a771e9d6d3f66dba3bd166a9ebf3cc3cb8c.tar.gz", + "hash": "037cmcrhcrjypnrvazvg531jkp3y8wxa5hl8zy1c88vbw2q4fabx" + } + }, + "version": 3 +} \ No newline at end of file |