6.NUR/default.nix
binarycat 1a5cae1376 made it possible to use NUR with without overrides
this means you can use it directly from a channel or via a nix repl in
a local clone.
2024-12-06 05:52:41 +00:00

46 lines
1.1 KiB
Nix

{
nurpkgs ? import <nixpkgs> { }, # For nixpkgs dependencies used by NUR itself
# Dependencies to call NUR repos with
# The override handles the case where NUR is installed via standalone channel or channel + override
pkgs ? (
import <nixpkgs> {
overrides = [
(final: prev: if prev ? nur then prev else { nur = ./. { pkgs = final; }; })
];
}
),
repoOverrides ? { },
}:
let
manifest = (builtins.fromJSON (builtins.readFile ./repos.json)).repos;
lockedRevisions = (builtins.fromJSON (builtins.readFile ./repos.json.lock)).repos;
inherit (nurpkgs) lib;
repoSource =
name: attr:
import ./lib/repoSource.nix {
inherit
name
attr
manifest
lockedRevisions
lib
;
inherit (nurpkgs) fetchgit fetchzip;
};
createRepo =
name: attr:
import ./lib/evalRepo.nix {
inherit name pkgs lib;
inherit (attr) url;
src = repoSource name attr + ("/" + (attr.file or ""));
};
in
{
repos = (lib.mapAttrs createRepo manifest) // repoOverrides;
repo-sources = lib.mapAttrs repoSource manifest;
}