treewide: use mkTarget (batch 2) (#1362)

Link: https://github.com/nix-community/stylix/pull/1362

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-05-23 10:23:39 -07:00 committed by GitHub
parent 8dd18dd395
commit 7ffb31da69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1355 additions and 1238 deletions

View file

@ -1,24 +1,31 @@
{ config, lib, ... }:
{
options.stylix.targets.kmscon.enable =
config.lib.stylix.mkEnableTarget "the kmscon virtual console" true;
{ mkTarget, ... }:
mkTarget {
name = "kmscon";
humanName = "the kmscon virtual console";
config.services.kmscon =
lib.mkIf (config.stylix.enable && config.stylix.targets.kmscon.enable)
configElements = [
(
{ fonts }:
{
fonts = [ config.stylix.fonts.monospace ];
extraConfig =
services.kmscon = {
fonts = [ fonts.monospace ];
extraConfig = "font-size=${toString fonts.sizes.terminal}";
};
}
)
(
{ colors }:
{
services.kmscon.extraConfig =
let
formatBase =
name:
let
getComponent = comp: config.lib.stylix.colors."${name}-rgb-${comp}";
getComponent = comp: colors."${name}-rgb-${comp}";
in
"${getComponent "r"},${getComponent "g"},${getComponent "b"}";
in
''
font-size=${builtins.toString config.stylix.fonts.sizes.terminal}
palette=custom
palette-black=${formatBase "base00"}
@ -41,5 +48,7 @@
palette-background=${formatBase "base00"}
palette-foreground=${formatBase "base05"}
'';
};
}
)
];
}