-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
toplevel@{ config, lib, flake-parts-lib, getSystem, ... }: | ||
let | ||
inherit (flake-parts-lib) | ||
mkPerSystemOption; | ||
inherit (lib) | ||
mkOption | ||
types; | ||
in | ||
{ | ||
options = { | ||
perSystem = mkPerSystemOption ({ config, extendModules, pkgs, ... }: { | ||
_file = ./easyOverlay.nix; | ||
options = { | ||
extendModules = mkOption { | ||
type = types.raw; | ||
default = extendModules; | ||
internal = true; | ||
}; | ||
overlayAttrs = mkOption { | ||
type = types.lazyAttrsOf types.raw; | ||
default = { }; | ||
description = '' | ||
Attributes to add to `overlays.default`. | ||
The `overlays.default` overlay will re-evaluate `perSystem` with | ||
the "prev" (or "super") overlay argument value as the `pkgs` module | ||
argument. The `easyOverlay` module also adds the `final` module | ||
argument, for the result of applying the overlay. | ||
When not in an overlay, `final` defaults to `pkgs` plus the generated | ||
overlay. This requires Nixpkgs to be re-evaluated, which is more | ||
expensive than setting `pkgs` to a Nixpkgs that already includes | ||
the necessary overlays that are required for the flake itself. | ||
See [Overlays](../overlays.html). | ||
''; | ||
}; | ||
}; | ||
config = { | ||
_module.args.final = lib.mkDefault (pkgs.extend (toplevel.config.flake.overlays.default)); | ||
}; | ||
}); | ||
}; | ||
config = { | ||
flake.overlays.default = final: prev: | ||
let | ||
system = prev.stdenv.hostPlatform.system; | ||
perSys = (getSystem system).extendModules { | ||
modules = [ | ||
{ | ||
_file = "flake-parts#flakeModules.easyOverlay/overlay-overrides"; | ||
_module.args.pkgs = lib.mkForce prev; | ||
_module.args.final = lib.mkForce final; | ||
} | ||
]; | ||
}; | ||
in | ||
perSys.config.overlayAttrs; | ||
}; | ||
} |
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 |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
''; | ||
}; | ||
}; | ||
flakeModules = { | ||
easyOverlay = ./extras/easyOverlay.nix; | ||
}; | ||
}; | ||
|
||
} |