Merge pull request 'Switch to npins' (#17) from npins into trunk

Reviewed-on: https://codeberg.org/leana8959/.files/pulls/17
This commit is contained in:
Plume 2025-06-20 11:54:23 +02:00
commit 3e916fc7fc
7 changed files with 454 additions and 457 deletions

View file

@ -44,7 +44,7 @@ in
flake.source = sources.nixpkgs; flake.source = sources.nixpkgs;
}; };
system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev; system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
} }
# #

View file

@ -64,7 +64,7 @@ in
flake.source = sources.nixpkgs; flake.source = sources.nixpkgs;
}; };
system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev; system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
} }
# #

View file

@ -2,7 +2,8 @@
let let
sources = import ../sources.nix; sources = import ../sources.nix;
inherit (sources) nil; inherit (sources) nil;
inherit (nil.repository) owner repo;
in in
final: _: { final: _: {
nil = (builtins.getFlake "github:${nil.owner}/${nil.repo}/${nil.rev}").packages.${final.system}.default; nil = (builtins.getFlake "github:${owner}/${repo}/${nil.revision}").packages.${final.system}.default;
} }

View file

@ -1,256 +0,0 @@
{
"agenix": {
"branch": "main",
"description": "age-encrypted secrets for NixOS and Home manager",
"homepage": "https://matrix.to/#/#agenix:nixos.org",
"owner": "ryantm",
"repo": "agenix",
"rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
"sha256": "006ngydiykjgqs85cl19h9klq8kaqm5zs0ng51dnwy7nzgqxzsdr",
"type": "tarball",
"url": "https://github.com/ryantm/agenix/archive/e600439ec4c273cf11e06fe4d9d906fb98fa097c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "0.15.0"
},
"disko": {
"branch": "master",
"description": "Declarative disk partitioning and formatting using nix [maintainers=Lassulus Enzime iFreilicht Mic92 phaer]",
"homepage": "",
"owner": "nix-community",
"repo": "disko",
"rev": "0141aabed359f063de7413f80d906e1d98c0c123",
"sha256": "13brimg7z7k9y36n4jc1pssqyw94nd8qvgfjv53z66lv4xkhin92",
"type": "tarball",
"url": "https://github.com/nix-community/disko/archive/0141aabed359f063de7413f80d906e1d98c0c123.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "v1.11.0"
},
"flake-compat": {
"branch": "master",
"description": null,
"homepage": null,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "v1.1.0",
"sha256": "19d2z6xsvpxm184m41qrpi1bplilwipgnzv9jy17fgw421785q1m",
"type": "tarball",
"url": "https://github.com/edolstra/flake-compat/archive/v1.1.0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
"branch": "release-25.05",
"description": "Manage a user environment using Nix [maintainer=@rycee] ",
"homepage": "https://nix-community.github.io/home-manager/",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d0bbd221482c2713cccb80220f3c9d16a6e20a33",
"sha256": "1iqfq5lz3102cp3ryqqqs2hr2bdmwn0mdajprh1ls5h5nsfkigs1",
"type": "tarball",
"url": "https://github.com/nix-community/home-manager/archive/d0bbd221482c2713cccb80220f3c9d16a6e20a33.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"infuse": {
"branch": "trunk",
"repo": "https://codeberg.org/amjoseph/infuse.nix",
"rev": "c8fb7397039215e1444c835e36a0da7dc3c743f8",
"type": "git"
},
"lix": {
"branch": "main",
"repo": "https://git.lix.systems/lix-project/lix.git",
"rev": "df214a1db80667749d15659c0aded6d45dc10fa4",
"type": "git"
},
"lix-module": {
"branch": "main",
"repo": "https://git.lix.systems/lix-project/nixos-module.git",
"rev": "cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc",
"type": "git"
},
"nil": {
"branch": "main",
"description": "NIx Language server, an incremental analysis assistant for writing in Nix.",
"homepage": "",
"owner": "oxalica",
"repo": "nil",
"rev": "870a4b1b5f12004832206703ac15aa85c42c247b",
"sha256": "1xlbzv9495g2gx6nmnw79v5g9ajwzkl1qwlpkqwqzqz4380qnnxy",
"type": "tarball",
"url": "https://github.com/oxalica/nil/archive/870a4b1b5f12004832206703ac15aa85c42c247b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nix-tree": {
"branch": "main",
"description": "Interactively browse dependency graphs of Nix derivations.",
"homepage": "",
"owner": "utdemir",
"repo": "nix-tree",
"rev": "fdcac72b7261f32e2faf9866c5d759d38a19771a",
"sha256": "00h7crplyi5njsi146227bzrnf6rmwpzmrl1l2ckii0lmvmnsfsw",
"type": "tarball",
"url": "https://github.com/utdemir/nix-tree/archive/fdcac72b7261f32e2faf9866c5d759d38a19771a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixos-hardware": {
"branch": "master",
"description": "A collection of NixOS modules covering hardware quirks.",
"homepage": "",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "ecaa2d911e77c265c2a5bac8b583c40b0f151726",
"sha256": "1xjrlq04i6an90f0s689ip3abky88mljxjik7c9s6kw9q0d3ix6f",
"type": "tarball",
"url": "https://github.com/NixOS/nixos-hardware/archive/ecaa2d911e77c265c2a5bac8b583c40b0f151726.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-25.05",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "36ab78dab7da2e4e27911007033713bab534187b",
"sha256": "072rx8y4bravd9163brjicqsb1i11f0n9v4bhikzbvc7wpb7kdds",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/36ab78dab7da2e4e27911007033713bab534187b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-unstable": {
"branch": "nixos-unstable",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14",
"sha256": "0ifzcx95bj4ab59qx01csj75xvhjlri8bqx2cmlh97gx9n27vfc1",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/f675531bc7e6657c10a18b565cfebd8aa9e24c14.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nur": {
"branch": "main",
"description": "Nix User Repository: User contributed nix packages [maintainer=@Pandapip1]",
"homepage": "https://nur.nix-community.org/",
"owner": "nix-community",
"repo": "nur",
"rev": "7900ebe42597974c57fce20b14876664ae32e7b5",
"sha256": "0yh1z2r26z5d9gq6dl62hfb918iwkrysm4i8qaqq9w7hk7pg9kwv",
"type": "tarball",
"url": "https://github.com/nix-community/nur/archive/7900ebe42597974c57fce20b14876664ae32e7b5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-emacs28": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "93c121f6888986f9148a33afd39d714f4b2ca98c",
"sha256": "198p4lv3zqw3s6j3yflgic0jxig4y0vsb1k8433jv227ks89kqdg",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/93c121f6888986f9148a33afd39d714f4b2ca98c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-florashell": {
"branch": "nixos-25.05",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7282cb574e0607e65224d33be8241eae7cfe0979",
"sha256": "0klkpy7ah033y3cwj51a0l96lwmkqqvwgfv3kid4z9x5g2rqr0l5",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/7282cb574e0607e65224d33be8241eae7cfe0979.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-fourmolu": {
"branch": "haskell-updates",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f6cf0e77542dd938f002652dd54391b973f792de",
"sha256": "1a8kcw1biyzmf5k8qjrji5fvgr8bbmi7fvf8pvfgjmf1df8rrcz1",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/f6cf0e77542dd938f002652dd54391b973f792de.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-isabelle": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "805a384895c696f802a9bf5bf4720f37385df547",
"sha256": "1q7y5ygr805l5axcjhn0rn3wj8zrwbrr0c6a8xd981zh8iccmx0p",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/805a384895c696f802a9bf5bf4720f37385df547.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-necro-man-nixpkgs": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c58ed2fc0f592ebc280bfba077ea418ce10213d1",
"sha256": "1y5is3cjwsy9n5cqs8i7qc9kf8cny9yxzirzzspkqbrm51axv53i",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/c58ed2fc0f592ebc280bfba077ea418ce10213d1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-vim-tw": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c93c1b3413bd7e235fc22b469bc0d2feec332cf5",
"sha256": "115sdkhyp0pm5rmag4gq0myg2rs20irisgnpf26zjfm92pw8isq4",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/c93c1b3413bd7e235fc22b469bc0d2feec332cf5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"pin-wireshark": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
"sha256": "0bjqgsprq9fgl5yh58dk59xmchi4dajq3sf5i447q02dbiasjsil",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/9d3ae807ebd2981d593cddd0080856873139aa40.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"url-eater": {
"branch": "mistress",
"description": "Clean unnecessary parameters from URLs copied to clipboard",
"homepage": null,
"owner": "AgathaSorceress",
"repo": "url-eater",
"rev": "96af6b75a3605043141db6bf80ad60866c10c827",
"sha256": "0lfq1hxdc7y1n00h1hl9ckxb7969nck0x654af77axvw1v3hamj0",
"type": "tarball",
"url": "https://github.com/AgathaSorceress/url-eater/archive/96af6b75a3605043141db6bf80ad60866c10c827.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"wallpapers": {
"branch": "mistress",
"repo": "https://git.confusedcompiler.org/leana8959/wallpapers.git",
"rev": "189b0f83db95462244e2dc2e12c68741c924cb46",
"type": "git"
},
"wired-notify": {
"branch": "master",
"description": "Lightweight notification daemon with highly customizable layout blocks, written in Rust.",
"homepage": "",
"owner": "Toqozz",
"repo": "wired-notify",
"rev": "75d43f54a02b15f2a15f5c1a0e1c7d15100067a6",
"sha256": "020j5807jkwzsnjjl8v8y17bbj1q1xcmiki4fnscj76ds168024j",
"type": "tarball",
"url": "https://github.com/leana8959/wired-notify/archive/2fc6624d3aeb03bbb3fb48b696ce8e5cc8e65165.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View file

@ -1,198 +1,2 @@
# This file has been generated by Niv. # Compatibility shim that redirects to npins
import ../npins
let
#
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
fetch_git = name: spec:
let
ref =
spec.ref or (
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
);
submodules = spec.submodules or false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{ }
else { };
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; allRefs = true; } // submoduleArg);
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
# Various helpers
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
import <nixpkgs> { }
else
abort
''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
let
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs
(
name: spec:
if builtins.hasAttr "outPath" spec
then
abort
"The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
)
config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

146
npins/default.nix Normal file
View file

@ -0,0 +1,146 @@
/*
This file is provided under the MIT licence:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range =
first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
concatMapStrings = f: list: concatStrings (map f list);
concatStrings = builtins.concatStringsSep "";
# If the environment variable NPINS_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
# (Taken from Niv for compatibility)
mayOverride =
name: path:
let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv envVarName;
in
if ersatz == "" then
path
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/" then
/. + ersatz
else
/. + builtins.getEnv "PWD" + "/${ersatz}"
);
mkSource =
name: 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 if spec.type == "Tarball" then
mkTarballSource spec
else
builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = mayOverride name path; };
mkGitSource =
{
repository,
revision,
url ? null,
submodules,
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 && !submodules then
builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
}
else
let
url =
if repository.type == "Git" then
repository.url
else if repository.type == "GitHub" then
"https://github.com/${repository.owner}/${repository.repo}.git"
else if repository.type == "GitLab" then
"${repository.server}/${repository.repo_path}.git"
else
throw "Unrecognized repository type ${repository.type}";
urlToName =
url: rev:
let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" 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 url revision;
in
builtins.fetchGit {
rev = revision;
inherit name;
# hash = hash;
inherit url submodules;
};
mkPyPiSource =
{ url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource =
{ url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
mkTarballSource =
{
url,
locked_url ? url,
hash,
...
}:
builtins.fetchTarball {
url = locked_url;
sha256 = hash;
};
in
if version == 5 then
builtins.mapAttrs mkSource data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

302
npins/sources.json Normal file
View file

@ -0,0 +1,302 @@
{
"pins": {
"agenix": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "ryantm",
"repo": "agenix"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "0.15.0",
"revision": "564595d0ad4be7277e07fa63b5a991b3c645655d",
"url": "https://api.github.com/repos/ryantm/agenix/tarball/0.15.0",
"hash": "01dhrghwa7zw93cybvx4gnrskqk97b004nfxgsys0736823956la",
"frozen": true
},
"disko": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "nix-community",
"repo": "disko"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v1.11.0",
"revision": "cdf8deded8813edfa6e65544f69fdd3a59fa2bb4",
"url": "https://api.github.com/repos/nix-community/disko/tarball/v1.11.0",
"hash": "13brimg7z7k9y36n4jc1pssqyw94nd8qvgfjv53z66lv4xkhin92",
"frozen": true
},
"home-manager": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "nix-community",
"repo": "home-manager"
},
"branch": "release-25.05",
"submodules": false,
"revision": "d0bbd221482c2713cccb80220f3c9d16a6e20a33",
"url": "https://github.com/nix-community/home-manager/archive/d0bbd221482c2713cccb80220f3c9d16a6e20a33.tar.gz",
"hash": "1iqfq5lz3102cp3ryqqqs2hr2bdmwn0mdajprh1ls5h5nsfkigs1"
},
"infuse": {
"type": "GitRelease",
"repository": {
"type": "Forgejo",
"server": "https://codeberg.org/",
"owner": "amjoseph",
"repo": "infuse.nix"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v2.4",
"revision": "c7da66119bb3502a59402cd2d1688a3f0a02577a",
"url": "https://codeberg.org/api/v1/repos/amjoseph/infuse.nix/archive/v2.4.tar.gz",
"hash": "1s3d1v27jxsw5050qi0bq6agpf5gpw6jmcyigzpdgwfm9d6w6wz1"
},
"lix": {
"type": "GitRelease",
"repository": {
"type": "Forgejo",
"server": "https://git.lix.systems/",
"owner": "lix-project",
"repo": "lix"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "2.93.0",
"revision": "47aad376c87e2e65967f17099277428e4b3f8e5a",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2.93.0.tar.gz",
"hash": "0g17i8yz5j0i2v29c2fddksvnc5n8fc5ml2pz0jhxaia7ghmxhc6"
},
"lix-module": {
"type": "GitRelease",
"repository": {
"type": "Forgejo",
"server": "https://git.lix.systems/",
"owner": "lix-project",
"repo": "nixos-module"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "2.93.0",
"revision": "cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/2.93.0.tar.gz",
"hash": "1pz4j93rwgf3hv3za3q16300kp9b74aglb1mbr5qpiw0g0mphm6p"
},
"nil": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "oxalica",
"repo": "nil"
},
"branch": "main",
"submodules": false,
"revision": "870a4b1b5f12004832206703ac15aa85c42c247b",
"url": "https://github.com/oxalica/nil/archive/870a4b1b5f12004832206703ac15aa85c42c247b.tar.gz",
"hash": "1xlbzv9495g2gx6nmnw79v5g9ajwzkl1qwlpkqwqzqz4380qnnxy"
},
"nix-tree": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "utdemir",
"repo": "nix-tree"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v0.6.3",
"revision": "477021a0f5b2fce11cb73dde9ecce49094f56db0",
"url": "https://api.github.com/repos/utdemir/nix-tree/tarball/v0.6.3",
"hash": "1hzss0sqxhyjp1f8v1p2sqv1636943brwl2x0vn2f851xbb6kgz7"
},
"nixos-hardware": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixos-hardware"
},
"branch": "master",
"submodules": false,
"revision": "ecaa2d911e77c265c2a5bac8b583c40b0f151726",
"url": "https://github.com/NixOS/nixos-hardware/archive/ecaa2d911e77c265c2a5bac8b583c40b0f151726.tar.gz",
"hash": "1xjrlq04i6an90f0s689ip3abky88mljxjik7c9s6kw9q0d3ix6f"
},
"nixpkgs": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "nixos-25.05",
"submodules": false,
"revision": "36ab78dab7da2e4e27911007033713bab534187b",
"url": "https://github.com/NixOS/nixpkgs/archive/36ab78dab7da2e4e27911007033713bab534187b.tar.gz",
"hash": "072rx8y4bravd9163brjicqsb1i11f0n9v4bhikzbvc7wpb7kdds"
},
"nur": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "nix-community",
"repo": "nur"
},
"branch": "main",
"submodules": false,
"revision": "7900ebe42597974c57fce20b14876664ae32e7b5",
"url": "https://github.com/nix-community/nur/archive/7900ebe42597974c57fce20b14876664ae32e7b5.tar.gz",
"hash": "0yh1z2r26z5d9gq6dl62hfb918iwkrysm4i8qaqq9w7hk7pg9kwv"
},
"pin-emacs28": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "93c121f6888986f9148a33afd39d714f4b2ca98c",
"url": "https://github.com/NixOS/nixpkgs/archive/93c121f6888986f9148a33afd39d714f4b2ca98c.tar.gz",
"hash": "198p4lv3zqw3s6j3yflgic0jxig4y0vsb1k8433jv227ks89kqdg"
},
"pin-florashell": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "7282cb574e0607e65224d33be8241eae7cfe0979",
"url": "https://github.com/NixOS/nixpkgs/archive/7282cb574e0607e65224d33be8241eae7cfe0979.tar.gz",
"hash": "0klkpy7ah033y3cwj51a0l96lwmkqqvwgfv3kid4z9x5g2rqr0l5"
},
"pin-fourmolu": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "f6cf0e77542dd938f002652dd54391b973f792de",
"url": "https://github.com/NixOS/nixpkgs/archive/f6cf0e77542dd938f002652dd54391b973f792de.tar.gz",
"hash": "1a8kcw1biyzmf5k8qjrji5fvgr8bbmi7fvf8pvfgjmf1df8rrcz1"
},
"pin-isabelle": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "805a384895c696f802a9bf5bf4720f37385df547",
"url": "https://github.com/NixOS/nixpkgs/archive/805a384895c696f802a9bf5bf4720f37385df547.tar.gz",
"hash": "1q7y5ygr805l5axcjhn0rn3wj8zrwbrr0c6a8xd981zh8iccmx0p"
},
"pin-necro-man-nixpkgs": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "c58ed2fc0f592ebc280bfba077ea418ce10213d1",
"url": "https://github.com/NixOS/nixpkgs/archive/c58ed2fc0f592ebc280bfba077ea418ce10213d1.tar.gz",
"hash": "1y5is3cjwsy9n5cqs8i7qc9kf8cny9yxzirzzspkqbrm51axv53i"
},
"pin-vim-tw": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "c93c1b3413bd7e235fc22b469bc0d2feec332cf5",
"url": "https://github.com/NixOS/nixpkgs/archive/c93c1b3413bd7e235fc22b469bc0d2feec332cf5.tar.gz",
"hash": "115sdkhyp0pm5rmag4gq0myg2rs20irisgnpf26zjfm92pw8isq4"
},
"pin-wireshark": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "master",
"submodules": false,
"revision": "9d3ae807ebd2981d593cddd0080856873139aa40",
"url": "https://github.com/NixOS/nixpkgs/archive/9d3ae807ebd2981d593cddd0080856873139aa40.tar.gz",
"hash": "0bjqgsprq9fgl5yh58dk59xmchi4dajq3sf5i447q02dbiasjsil"
},
"url-eater": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "AgathaSorceress",
"repo": "url-eater"
},
"branch": "mistress",
"submodules": false,
"revision": "96af6b75a3605043141db6bf80ad60866c10c827",
"url": "https://github.com/AgathaSorceress/url-eater/archive/96af6b75a3605043141db6bf80ad60866c10c827.tar.gz",
"hash": "0lfq1hxdc7y1n00h1hl9ckxb7969nck0x654af77axvw1v3hamj0"
},
"wallpapers": {
"type": "Git",
"repository": {
"type": "Forgejo",
"server": "https://git.confusedcompiler.org/",
"owner": "leana8959",
"repo": "wallpapers"
},
"branch": "mistress",
"submodules": false,
"revision": "189b0f83db95462244e2dc2e12c68741c924cb46",
"url": "https://git.confusedcompiler.org/leana8959/wallpapers/archive/189b0f83db95462244e2dc2e12c68741c924cb46.tar.gz",
"hash": "1fkspkw0b61q4k13zmnzi9pbw9b5yyd3v1id2ml44xbh1qa09w2m"
},
"wired-notify": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "Toqozz",
"repo": "wired-notify"
},
"branch": "master",
"submodules": false,
"revision": "75d43f54a02b15f2a15f5c1a0e1c7d15100067a6",
"url": "https://github.com/Toqozz/wired-notify/archive/75d43f54a02b15f2a15f5c1a0e1c7d15100067a6.tar.gz",
"hash": "0fv8afjl0a82sqh5kpbbw9hp3s5772ssq4s55l78pxg877q252rl"
}
},
"version": 5
}