Expose NUR packages

This commit is contained in:
Andrew Kvalheim 2024-04-29 20:44:31 -07:00
parent 6b6fcc8b48
commit 71bbd56146
2 changed files with 22 additions and 2 deletions

19
nur.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs }:
rec {
apex = pkgs.callPackage ./packages/apex.nix { };
buildJosmPlugin = pkgs.callPackage ./packages/buildJosmPlugin.nix { };
cavif = pkgs.callPackage ./packages/cavif.nix { };
ch57x-keyboard-tool = pkgs.callPackage ./packages/ch57x-keyboard-tool.nix { };
decompiler-mc = pkgs.callPackage ./packages/decompiler-mc.nix { };
dmarc-report-converter = pkgs.callPackage ./packages/dmarc-report-converter.nix { };
fastnbt-tools = pkgs.callPackage ./packages/fastnbt-tools.nix { };
git-diff-image = pkgs.callPackage ./packages/git-diff-image.nix { };
gpx-reduce = pkgs.callPackage ./packages/gpx-reduce.nix { };
josm-imagery-used = pkgs.callPackage ./packages/josm-imagery-used.nix { inherit buildJosmPlugin; };
minemap = pkgs.callPackage ./packages/minemap.nix { };
mmdbinspect = pkgs.callPackage ./packages/mmdbinspect.nix { };
nbt-explorer = pkgs.callPackage ./packages/nbt-explorer.nix { };
pngquant-interactive = pkgs.callPackage ./packages/pngquant-interactive.nix { };
tile-stitch = pkgs.callPackage ./packages/tile-stitch.nix { };
}

View file

@ -8,7 +8,7 @@ let
# Utilities
composeOverrides = f1: f2: a0: let o1 = f1 a0; o2 = f2 (a0 // o1); in o1 // o2;
isEmpty = attrs: length (attrNames attrs) == 0;
isLocal = r: isPath r;
isLocal = r: isPath r || r._name or null == "NUR packages";
isStable = r: isAttrs r && ! r ? "_name";
mkRepo = name: path: (import path { inherit (stable) config; overlays = [ ]; }) // { _name = name; };
repoName = r: if isPath r then toString r else r._name or "stable";
@ -19,6 +19,7 @@ let
else throw "version operator not implemented: ${toJSON operator}";
# Repositories
nur = (import ../nur.nix { pkgs = stable; }) // { _name = "NUR packages"; };
pin = rev: mkRepo "pin ${rev}" (fetchGit { name = "nixpkgs-pin-${toString rev}"; url = "https://github.com/NixOS/nixpkgs.git"; inherit rev; });
pr = id: mkRepo "PR #${toString id}" (fetchGit { name = "nixpkgs-pr-${toString id}"; url = "https://github.com/NixOS/nixpkgs.git"; ref = "refs/pull/${toString id}/head"; });
unstable =
@ -69,7 +70,7 @@ let
&& (version == null || versionMeetsSpec (getAttrFromPath path r).version version)
&& (condition == null || condition (getAttrFromPath path r));
extra = if search == null then [ ] else imap1 (i: s: { _extra = i; _name = "search"; } // s) (toList search);
repos = [ stable unstable ] ++ extra;
repos = [ stable unstable ] ++ extra ++ [ nur ];
repo = findFirst suffices file repos;
package =
if isPath repo then