Add flakeModules.easyOverlay code
This commit is contained in:
parent
8bfe94414f
commit
f6d80a68c6
3 changed files with 110 additions and 0 deletions
|
|
@ -1,5 +1,10 @@
|
|||
rec {
|
||||
f-p = builtins.getFlake (toString ../..);
|
||||
flake-parts = f-p;
|
||||
|
||||
devFlake = builtins.getFlake (toString ../.);
|
||||
nixpkgs = devFlake.inputs.nixpkgs;
|
||||
|
||||
f-p-lib = f-p.lib;
|
||||
|
||||
inherit (f-p-lib) mkFlake;
|
||||
|
|
@ -26,6 +31,35 @@ rec {
|
|||
};
|
||||
};
|
||||
|
||||
easyOverlay = mkFlake
|
||||
{ self = { }; }
|
||||
{
|
||||
imports = [ flake-parts.flakeModules.easyOverlay ];
|
||||
systems = [ "a" ];
|
||||
perSystem = { system, config, final, pkgs, ... }: {
|
||||
packages.default = config.packages.hello;
|
||||
packages.hello = pkg system "hello";
|
||||
packages.hello_new = final.hello;
|
||||
overlayAttrs = {
|
||||
hello = config.packages.hello;
|
||||
hello_old = pkgs.hello;
|
||||
hello_new = config.packages.hello_new;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgsWithoutEasyOverlay = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [ ];
|
||||
config = { };
|
||||
};
|
||||
|
||||
nixpkgsWithEasyOverlay = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [ easyOverlay.overlays.default ];
|
||||
config = { };
|
||||
};
|
||||
|
||||
runTests = ok:
|
||||
|
||||
assert empty == {
|
||||
|
|
@ -55,6 +89,19 @@ rec {
|
|||
};
|
||||
};
|
||||
|
||||
# - exported package becomes part of overlay.
|
||||
# - perSystem is invoked for the right system.
|
||||
assert nixpkgsWithEasyOverlay.hello == pkg "x86_64-linux" "hello";
|
||||
|
||||
# - Non-exported package does not become part of overlay.
|
||||
assert nixpkgsWithEasyOverlay.default or null != pkg "x86_64-linux" "hello";
|
||||
|
||||
# - hello_old comes from super
|
||||
assert nixpkgsWithEasyOverlay.hello_old == nixpkgsWithoutEasyOverlay.hello;
|
||||
|
||||
# - `hello_new` shows that the `final` wiring works
|
||||
assert nixpkgsWithEasyOverlay.hello_new == nixpkgsWithEasyOverlay.hello;
|
||||
|
||||
ok;
|
||||
|
||||
result = runTests "ok";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue