refactor: configure more core system options via liminalOS module
Some checks are pending
Check flake / check (push) Waiting to run

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

View file

@ -14,6 +14,8 @@
./hardware-configuration.nix
];
networking.hostName = "demeter"; # Define your hostname.
liminalOS = {
flakeLocation = "/home/youwen/.config/liminalOS";
config.allowUnfree = true;
@ -42,8 +44,13 @@
programs.flatpak.enable = true;
};
time.timeZone = "America/Los_Angeles";
hardware.cpu.intel.updateMicrocode = true;
# Bootloader.
boot.loader = {
boot = {
loader = {
efi.canTouchEfiVariables = true;
timeout = 15;
# Lanzaboote currently replaces the systemd-boot module.
@ -55,74 +62,17 @@
consoleMode = "auto";
};
};
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;
};
boot.lanzaboote = {
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
boot.initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device =
kernelPackages = pkgs.linuxPackages_zen;
initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device =
"/dev/disk/by-uuid/af320a0f-b388-43f5-b5a3-af2b47cfc716";
networking.hostName = "demeter"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# select kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.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";
};
systemd.services = {
NetworkManager-wait-online.enable = false;
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = false;
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
@ -132,24 +82,6 @@
];
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
# services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.youwen = {
isNormalUser = true;
@ -164,32 +96,6 @@
];
};
services.udev.extraRules = ''
KERNEL=="cpu_dma_latency", GROUP="realtime"
'';
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
git
curl
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.dconf.enable = true;
programs.hyprland.enable = true;
hardware.cpu.intel.updateMicrocode = true;
programs.zsh.enable = false;
programs.fish.enable = true;
users.users.youwen.shell = pkgs.fish;

View file

@ -46,10 +46,41 @@ 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 = [
environment.systemPackages =
with pkgs;
[
wget
git
curl
]
++ [
inputs.viminal.packages.${pkgs.system}.default
];
@ -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;
};
};
}