2024-08-04 02:10:58 +02:00
|
|
|
{ lib, config, self, inputs, ... }:
|
|
|
|
|
|
|
|
{
|
2024-09-07 19:49:14 +02:00
|
|
|
imports = [
|
|
|
|
../lib
|
|
|
|
];
|
|
|
|
|
2024-08-04 02:10:58 +02:00
|
|
|
options = let
|
2024-09-07 19:49:14 +02:00
|
|
|
inherit (lib)
|
|
|
|
types
|
|
|
|
;
|
|
|
|
inherit (config.lib)
|
|
|
|
createThings
|
|
|
|
;
|
|
|
|
|
|
|
|
createOverlays = baseDir:
|
|
|
|
createThings {
|
|
|
|
inherit baseDir;
|
|
|
|
thingType = "overlay";
|
|
|
|
};
|
2024-08-04 02:10:58 +02:00
|
|
|
in {
|
2024-09-01 03:29:32 +02:00
|
|
|
auto.overlays = lib.mkOption {
|
2024-08-04 02:10:58 +02:00
|
|
|
description = ''
|
|
|
|
Automagically generate overlays from walking directories with Nix files
|
|
|
|
'';
|
|
|
|
type = types.submodule (submodule: {
|
|
|
|
options = {
|
|
|
|
enable = lib.mkEnableOption "Automatic overlays extraction";
|
|
|
|
dir = lib.mkOption {
|
|
|
|
description = ''
|
|
|
|
Base directory of the contained overlays
|
|
|
|
'';
|
|
|
|
type = types.path;
|
|
|
|
default = "${self}/overlays";
|
|
|
|
defaultText = ''''${self}/overlays'';
|
|
|
|
};
|
|
|
|
result = lib.mkOption {
|
|
|
|
description = ''
|
|
|
|
The resulting automatic overlays
|
|
|
|
'';
|
|
|
|
type = types.attrsOf types.unspecified;
|
|
|
|
readOnly = true;
|
|
|
|
internal = true;
|
|
|
|
default =
|
|
|
|
lib.optionalAttrs
|
2024-09-01 03:29:32 +02:00
|
|
|
config.auto.overlays.enable
|
|
|
|
(createOverlays config.auto.overlays.dir);
|
2024-08-04 02:10:58 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
flake = let
|
|
|
|
overlays =
|
|
|
|
lib.pipe
|
2024-09-01 03:29:32 +02:00
|
|
|
config.auto.overlays.result
|
2024-08-04 02:10:58 +02:00
|
|
|
[
|
|
|
|
(lib.mapAttrs
|
|
|
|
(name: overlay:
|
|
|
|
overlay))
|
|
|
|
];
|
|
|
|
in {
|
|
|
|
inherit overlays;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|