2024-02-27 10:41:27 -06:00
|
|
|
|
final: prev: let
|
2024-03-21 15:48:48 -05:00
|
|
|
|
inherit (final) hasSuffix mkEnableOption mkIf mkOption types;
|
2024-02-27 10:41:27 -06:00
|
|
|
|
runes = import ../modules/runes;
|
2024-03-19 08:54:11 -05:00
|
|
|
|
in rec {
|
2024-03-19 07:24:30 -05:00
|
|
|
|
enabled = {enable = true;};
|
|
|
|
|
disabled = {enable = false;};
|
2024-03-19 08:56:51 -05:00
|
|
|
|
|
2024-03-19 08:54:11 -05:00
|
|
|
|
# ["a" "b"] -> {a.enable = true; b.enable = true;}
|
2024-03-19 08:56:51 -05:00
|
|
|
|
enableAttrs = attrs:
|
|
|
|
|
builtins.listToAttrs (map (attr: {
|
|
|
|
|
name = attr;
|
|
|
|
|
value = enabled;
|
|
|
|
|
})
|
|
|
|
|
attrs);
|
2024-03-19 08:54:11 -05:00
|
|
|
|
# ["a" "b"] -> {a.enable = false; b.enable = false;}
|
2024-03-19 08:56:51 -05:00
|
|
|
|
disableAttrs = attrs:
|
|
|
|
|
builtins.listToAttrs (map (attr: {
|
|
|
|
|
name = attr;
|
|
|
|
|
value = disabled;
|
|
|
|
|
})
|
|
|
|
|
attrs);
|
2024-03-19 08:54:11 -05:00
|
|
|
|
|
2024-03-01 00:26:52 -06:00
|
|
|
|
isNixFile = path: hasSuffix ".nix" path;
|
2024-02-27 10:41:27 -06:00
|
|
|
|
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
|
|
|
|
|
mkRune = {
|
|
|
|
|
rune,
|
|
|
|
|
number ? "6",
|
|
|
|
|
runeKind ? "braille",
|
|
|
|
|
}:
|
|
|
|
|
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n[0m";
|
2024-03-21 10:53:27 -05:00
|
|
|
|
|
|
|
|
|
mkOizysModule = config: attr: content: {
|
|
|
|
|
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";
|
|
|
|
|
config = mkIf config.oizys.${attr}.enable content;
|
|
|
|
|
};
|
2024-03-21 15:48:48 -05:00
|
|
|
|
mkDefaultOizysModule = config: attr: content: {
|
|
|
|
|
options.oizys.${attr}.enable = mkOption {
|
|
|
|
|
default = true;
|
|
|
|
|
description = "enable ${attr} support";
|
|
|
|
|
type = types.bool;
|
|
|
|
|
};
|
|
|
|
|
config = mkIf config.oizys.${attr}.enable content;
|
|
|
|
|
};
|
2024-02-27 10:41:27 -06:00
|
|
|
|
}
|