-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modules/nixpkgs: add
overlays
option
Based on the `nixpkgs.overlays` option available in NixOS, allows users to further customize the `pkgs` instance used when evaluating nixvim. The standard module tests are now provided a few extra module args to enable a test where we instantiate a custom nixpkgs instance.
- Loading branch information
1 parent
b9d17d5
commit c4ad4d0
Showing
3 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
# TODO: expect not setting `nixpkgs.pkgs` to throw | ||
|
||
overlays = | ||
{ pkgs, ... }: | ||
{ | ||
test.runNvim = false; | ||
|
||
nixpkgs.overlays = [ | ||
(final: prev: { | ||
foobar = "foobar"; | ||
}) | ||
]; | ||
|
||
assertions = [ | ||
{ | ||
assertion = pkgs.foobar or null == "foobar"; | ||
message = '' | ||
Expected `pkgs.foobar` to be "foobar" | ||
''; | ||
} | ||
]; | ||
}; | ||
|
||
# Test that overlays from both `nixpkgs.pkgs` _and_ `nixpkgs.overlays` are applied | ||
stacked_overlays = | ||
{ | ||
inputs, | ||
system, | ||
pkgs, | ||
... | ||
}: | ||
{ | ||
test.runNvim = false; | ||
|
||
nixpkgs.pkgs = import inputs.nixpkgs { | ||
inherit system; | ||
overlays = [ | ||
(final: prev: { | ||
foobar = "foobar"; | ||
conflict = "a"; | ||
}) | ||
]; | ||
}; | ||
|
||
nixpkgs.overlays = [ | ||
(final: prev: { | ||
hello = "world"; | ||
conflict = "b"; | ||
}) | ||
]; | ||
|
||
assertions = [ | ||
{ | ||
assertion = pkgs.foobar or null == "foobar"; | ||
message = '' | ||
Expected `pkgs.foobar` to be "foobar" | ||
''; | ||
} | ||
{ | ||
assertion = pkgs.hello or null == "world"; | ||
message = '' | ||
Expected `pkgs.hello` to be "world" | ||
''; | ||
} | ||
{ | ||
assertion = pkgs.conflict or null == "b"; | ||
message = '' | ||
Expected `pkgs.conflict` to be "b" | ||
''; | ||
} | ||
]; | ||
}; | ||
} |