File tree Expand file tree Collapse file tree 3 files changed +123
-1
lines changed Expand file tree Collapse file tree 3 files changed +123
-1
lines changed Original file line number Diff line number Diff line change 55
55
> Use this option with care.
56
56
'' ;
57
57
} ;
58
+
59
+ overlays = lib . mkOption {
60
+ type =
61
+ let
62
+ overlayType = lib . mkOptionType {
63
+ name = "nixpkgs-overlay" ;
64
+ description = "nixpkgs overlay" ;
65
+ check = lib . isFunction ;
66
+ merge = lib . mergeOneOption ;
67
+ } ;
68
+ in
69
+ lib . types . listOf overlayType ;
70
+ default = [ ] ;
71
+ # FIXME: use an example that is topical for vim
72
+ example = lib . literalExpression ''
73
+ [
74
+ (self: super: {
75
+ openssh = super.openssh.override {
76
+ hpnSupport = true;
77
+ kerberos = self.libkrb5;
78
+ };
79
+ })
80
+ ]
81
+ '' ;
82
+ description = ''
83
+ List of overlays to apply to Nixpkgs.
84
+ This option allows modifying the Nixpkgs package set accessed through the `pkgs` module argument.
85
+
86
+ For details, see the [Overlays chapter in the Nixpkgs manual](https://nixos.org/manual/nixpkgs/stable/#chap-overlays).
87
+
88
+ <!-- TODO: Remove -->
89
+ Overlays specified using the {option}`nixpkgs.overlays` option will be
90
+ applied after the overlays that were already included in `nixpkgs.pkgs`.
91
+
92
+ <!--
93
+ TODO:
94
+ If the {option}`nixpkgs.pkgs` option is set, overlays specified using `nixpkgs.overlays`
95
+ will be applied after the overlays that were already included in `nixpkgs.pkgs`.
96
+ -->
97
+ '' ;
98
+ } ;
58
99
} ;
59
100
60
101
config =
64
105
65
106
finalPkgs =
66
107
if opt . pkgs . isDefined then
67
- cfg . pkgs
108
+ cfg . pkgs . appendOverlays cfg . overlays
68
109
else
69
110
# TODO: Remove once pkgs can be constructed internally
70
111
throw ''
Original file line number Diff line number Diff line change 1
1
{
2
+ self , # This flake
3
+ system ,
2
4
lib ? pkgs . lib ,
3
5
helpers ,
4
6
pkgs ,
16
18
module = {
17
19
_file = file ;
18
20
imports = [ module ] ;
21
+ _module . args = {
22
+ # Give tests access to the flake
23
+ inherit self system ;
24
+ inherit ( self ) inputs ;
25
+ } ;
19
26
} ;
20
27
pkgs = pkgsUnfree ;
21
28
} ;
Original file line number Diff line number Diff line change
1
+ {
2
+ # TODO: expect not setting `nixpkgs.pkgs` to throw
3
+
4
+ overlays =
5
+ { pkgs , ... } :
6
+ {
7
+ test . runNvim = false ;
8
+
9
+ nixpkgs . overlays = [
10
+ ( final : prev : {
11
+ foobar = "foobar" ;
12
+ } )
13
+ ] ;
14
+
15
+ assertions = [
16
+ {
17
+ assertion = pkgs . foobar or null == "foobar" ;
18
+ message = ''
19
+ Expected `pkgs.foobar` to be "foobar"
20
+ '' ;
21
+ }
22
+ ] ;
23
+ } ;
24
+
25
+ # Test that overlays from both `nixpkgs.pkgs` _and_ `nixpkgs.overlays` are applied
26
+ stacked_overlays =
27
+ {
28
+ inputs ,
29
+ system ,
30
+ pkgs ,
31
+ ...
32
+ } :
33
+ {
34
+ test . runNvim = false ;
35
+
36
+ nixpkgs . pkgs = import inputs . nixpkgs {
37
+ inherit system ;
38
+ overlays = [
39
+ ( final : prev : {
40
+ foobar = "foobar" ;
41
+ conflict = "a" ;
42
+ } )
43
+ ] ;
44
+ } ;
45
+
46
+ nixpkgs . overlays = [
47
+ ( final : prev : {
48
+ hello = "world" ;
49
+ conflict = "b" ;
50
+ } )
51
+ ] ;
52
+
53
+ assertions = [
54
+ {
55
+ assertion = pkgs . foobar or null == "foobar" ;
56
+ message = ''
57
+ Expected `pkgs.foobar` to be "foobar"
58
+ '' ;
59
+ }
60
+ {
61
+ assertion = pkgs . hello or null == "world" ;
62
+ message = ''
63
+ Expected `pkgs.hello` to be "world"
64
+ '' ;
65
+ }
66
+ {
67
+ assertion = pkgs . conflict or null == "b" ;
68
+ message = ''
69
+ Expected `pkgs.conflict` to be "b"
70
+ '' ;
71
+ }
72
+ ] ;
73
+ } ;
74
+ }
You can’t perform that action at this time.
0 commit comments