mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
easyOverlay: fix
The tests only caught this for the non-memoized system case.
This commit is contained in:
parent
9ca2803752
commit
319ee04044
2 changed files with 14 additions and 3 deletions
|
@ -35,7 +35,7 @@ rec {
|
|||
{ inputs.self = { }; }
|
||||
{
|
||||
imports = [ flake-parts.flakeModules.easyOverlay ];
|
||||
systems = [ "a" ];
|
||||
systems = [ "a" "aarch64-linux" ];
|
||||
perSystem = { system, config, final, pkgs, ... }: {
|
||||
packages.default = config.packages.hello;
|
||||
packages.hello = pkg system "hello";
|
||||
|
@ -55,11 +55,19 @@ rec {
|
|||
};
|
||||
|
||||
nixpkgsWithEasyOverlay = import nixpkgs {
|
||||
# non-memoized
|
||||
system = "x86_64-linux";
|
||||
overlays = [ easyOverlay.overlays.default ];
|
||||
config = { };
|
||||
};
|
||||
|
||||
nixpkgsWithEasyOverlayMemoized = import nixpkgs {
|
||||
# memoized
|
||||
system = "aarch64-linux";
|
||||
overlays = [ easyOverlay.overlays.default ];
|
||||
config = { };
|
||||
};
|
||||
|
||||
runTests = ok:
|
||||
|
||||
assert empty == {
|
||||
|
@ -90,9 +98,12 @@ rec {
|
|||
};
|
||||
|
||||
# - exported package becomes part of overlay.
|
||||
# - perSystem is invoked for the right system.
|
||||
# - perSystem is invoked for the right system, when system is non-memoized
|
||||
assert nixpkgsWithEasyOverlay.hello == pkg "x86_64-linux" "hello";
|
||||
|
||||
# - perSystem is invoked for the right system, when system is memoized
|
||||
assert nixpkgsWithEasyOverlayMemoized.hello == pkg "aarch64-linux" "hello";
|
||||
|
||||
# - Non-exported package does not become part of overlay.
|
||||
assert nixpkgsWithEasyOverlay.default or null != pkg "x86_64-linux" "hello";
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ in
|
|||
# performance cost has already been incurred, such as in `flakeModules.easyOverlay`,
|
||||
# where we run in the context of an overlay, and the performance cost of the
|
||||
# extra `pkgs` makes the cost of running `perSystem` probably negligible.
|
||||
_module.args.getSystemIgnoreWarning = system: config.allSystems.${system} or config.perSystem system;
|
||||
_module.args.getSystemIgnoreWarning = system: config.allSystems.${system} or (config.perSystem system);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue