From f02c9f0e1be26099bce40153c95cc093e1460311 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Fri, 3 Dec 2021 22:55:24 -0500 Subject: [PATCH] software/console: move console setup to module --- modules/modules/software/console.nix | 38 ++++++++++++++++++++++++++++ profiles/core/console.nix | 16 ------------ 2 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 modules/modules/software/console.nix delete mode 100644 profiles/core/console.nix diff --git a/modules/modules/software/console.nix b/modules/modules/software/console.nix new file mode 100644 index 0000000..cd1060b --- /dev/null +++ b/modules/modules/software/console.nix @@ -0,0 +1,38 @@ +{ config, lib, ... }: +with lib; +with lib.hlissner; +let + cfg = config.modules.software.console; + opt = options.modules.software.console; +in +{ + options.modules.software.console = with types; { + kmscon = { + enable = mkBoolOpt true; + font = { + size = mkOpt int 14; + font = mkOpt str (head config.modules.locale.fonts.defaults.monospace); + }; + extraOptions = mkOpt (separatedString " ") ""; + extraConfig = mkOpt lines ""; + }; + }; + + config = { + console = { + font = "Lat2-Terminus16"; + earlySetup = true; + }; + + services.kmscon = mkIf cfg.kmscon.enable { + enable = true; + hwRender = true; + extraConfig = '' + font-size=${cfg.kmscon.font.size} + font-name=${cfg.kmscon.font.font} + ${opt.kmscon.extraConfig} + ''; + extraOptions = mkAliasDefinitions opt.kmscon.extraOptions; + }; + }; +} diff --git a/profiles/core/console.nix b/profiles/core/console.nix deleted file mode 100644 index 5ed3969..0000000 --- a/profiles/core/console.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, ... }: { - console = { - font = "Lat2-Terminus16"; - earlySetup = true; - packages = with pkgs; [ (nerdfonts.override { fonts = [ "DejaVuSansMono" ]; }) ]; - }; - - services.kmscon = { - enable = true; - hwRender = true; - extraConfig = '' - font-size=14 - font-name=DejaVuSansMono - ''; - }; -}