File tree 2 files changed +19
-5
lines changed
2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
1
{ nurpkgs ? import <nixpkgs> { } # For nixpkgs dependencies used by NUR itself
2
2
# Dependencies to call NUR repos with
3
- , pkgs ? throw "NUR call didn't receive a pkgs argument, but the evaluation requires it."
4
- } :
3
+ , pkgs ? null } :
5
4
6
5
let
7
6
inherit ( nurpkgs ) fetchgit fetchzip lib ;
44
43
} ;
45
44
46
45
createRepo = name : attr : import ./lib/evalRepo.nix {
47
- inherit name pkgs lib ;
46
+ inherit name pkgs lib attr ;
48
47
src = repoSource name attr + "/" + ( attr . file or "" ) ;
49
48
} ;
50
49
Original file line number Diff line number Diff line change 1
1
{ name
2
+ , attr
2
3
, src
3
4
, pkgs # Do not use this for anything other than passing it along as an argument to the repository
4
5
, lib
5
6
} :
6
7
let
7
8
9
+ prettyName = "[32;1m${ name } [0m" ;
10
+
8
11
# Arguments passed to each repositories default.nix
9
- passedArgs = { inherit pkgs lib ; } ;
12
+ passedArgs = {
13
+ inherit lib ;
14
+ pkgs = if pkgs != null then pkgs else throw ''
15
+ NUR import call didn't receive a pkgs argument, but the evaluation of NUR's ${ prettyName } repository requires it.
16
+
17
+ This is either because
18
+ - You're trying to use a [1mpackage[0m from that repository, but didn't pass a `pkgs` argument to the NUR import.
19
+ In that case, refer to the installation instructions at https://github.com/nix-community/nur#installation on how to properly import NUR
20
+
21
+ - You're trying to use a [1mmodule[0m/[1moverlay[0m from that repository, but it didn't properly declare their module.
22
+ In that case, inform the maintainer of the repository: ${ attr . url }
23
+ '' ;
24
+ } ;
10
25
11
26
expr = import src ;
12
27
args = builtins . functionArgs expr ;
13
28
# True if not all arguments are either passed by default (e.g. pkgs) or defaulted (e.g. foo ? 10)
14
29
usesCallPackage = ! lib . all ( arg : lib . elem arg ( lib . attrNames passedArgs ) || args . ${ arg } ) ( lib . attrNames args ) ;
15
30
16
31
in if usesCallPackage then lib . warn ''
17
- NUR repository ${ name } is using the deprecated callPackage syntax which
32
+ NUR repository ${ prettyName } is using the deprecated callPackage syntax which
18
33
might result in infinite recursion when used with NixOS modules.
19
34
'' ( pkgs . callPackages src { } )
20
35
else expr ( builtins . intersectAttrs args passedArgs )
You can’t perform that action at this time.
0 commit comments