properly handle rune module

This commit is contained in:
Daylin Morgan 2024-05-06 15:49:11 -05:00
parent 86bc2bf44f
commit b32f7e3989
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -7,6 +7,7 @@
let let
inherit (lib) inherit (lib)
types types
mkMerge
mkOption mkOption
mkIf mkIf
mkEnableOption mkEnableOption
@ -18,11 +19,11 @@ let
}; };
mkRune = mkRune =
{ {
rune, name,
number ? "6", number ? "6",
runeKind ? "braille", kind ? "braille",
}: }:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n"; "[1;3${number}m\n" + runes.${name}.${kind} + "\n";
cfg = config.oizys.rune; cfg = config.oizys.rune;
in in
{ {
@ -50,19 +51,21 @@ in
}; };
}; };
config = config = mkMerge [
mkIf cfg.enable { (mkIf cfg.enable {
environment.etc.issue = { environment.etc.issue = {
source = pkgs.writeText "issue" (mkRune { source = pkgs.writeText "issue" (mkRune {
rune = cfg.name; name = cfg.name;
runeKind = cfg.kind; kind = cfg.kind;
}); });
}; };
} })
// mkIf cfg.motd.enable { (mkIf cfg.motd.enable {
users.motd = mkRune { users.motd = mkRune {
number = "2"; # todo: autogenerate based on hostname? number = "2"; # todo: autogenerate based on hostname?
rune = cfg.name; name = cfg.name;
}; };
};
})
];
} }