refactor: configure more core system options via liminalOS module

This commit is contained in:
Youwen Wu 2024-12-24 18:47:17 -08:00
parent 104a61a055
commit 1aa376e94f
Signed by: youwen
GPG key ID: 865658ED1FE61EC3
5 changed files with 144 additions and 123 deletions

View file

@ -46,12 +46,43 @@ in
'';
};
suppressWarnings = lib.mkEnableOption "suppress warnings";
networking = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''Whether to set up and enable networking daemons.'';
};
backend = lib.mkOption {
type = lib.types.enum [
"wpa_supplicant"
"iwd"
];
default = "wpa_supplicant";
description = ''
Which backend to use for networking. Default is wpa_supplicant with NetworkManager as a frontend. With iwd, iwctl is the frontend.
'';
};
};
bluetooth.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable bluetooth and blueman.
'';
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
inputs.viminal.packages.${pkgs.system}.default
];
environment.systemPackages =
with pkgs;
[
wget
git
curl
]
++ [
inputs.viminal.packages.${pkgs.system}.default
];
environment.variables = {
EDITOR = "nvim";
@ -124,6 +155,33 @@ in
hardware.enableRedistributableFirmware = true;
networking.networkmanager.enable = lib.mkIf (
cfg.networking.enable && cfg.networking.backend == "wpa_supplicant"
) true;
systemd.services.NetworkManager-wait-online.enable = lib.mkIf (
cfg.networking.enable && cfg.networking.backend == "wpa_supplicant"
) false;
networking.wireless.iwd = lib.mkIf (cfg.networking.enable && cfg.networking.backend == "iwd") {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.dconf.enable = true;
hardware.bluetooth = lib.mkIf cfg.bluetooth.enable {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = lib.mkIf cfg.bluetooth.enable true;
warnings =
if !cfg.suppressWarnings && cfg.useNh && config.liminalOS.flakeLocation == "" then
[

View file

@ -26,5 +26,12 @@ in
};
programs.hyprland.enable = cfg.hyprland.enable;
services.xserver.enable = false;
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
};
}

View file

@ -45,6 +45,11 @@ in
Absolute filepath location of the NixOS system configuration flake.
'';
};
useEnUsLocale = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to use the en_US locale automatically";
};
};
config = {
@ -80,5 +85,22 @@ in
]
)
);
# Select internationalisation properties.
i18n = lib.mkIf cfg.useEnUsLocale {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
};
}

View file

@ -11,6 +11,13 @@ in
{
options.liminalOS.theming = {
enable = lib.mkEnableOption "theming";
plymouth.enable = lib.mkOption {
type = lib.types.bool;
default = cfg.enable;
description = ''
Whether to enable plymouth and sane defaults.
'';
};
};
imports = [
@ -51,5 +58,26 @@ in
size = 26;
};
};
boot = {
plymouth = {
enable = true;
font = "${config.stylix.fonts.monospace.package}/share/fonts/truetype/NerdFonts/CaskaydiaCove/CaskaydiaCoveNerdFontMono-Regular.ttf";
};
# Enable "Silent Boot"
consoleLogLevel = 3;
initrd.verbose = false;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
initrd.systemd.enable = true;
};
};
}