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 ./hardware-configuration.nix
]; ];
networking.hostName = "demeter"; # Define your hostname.
liminalOS = { liminalOS = {
flakeLocation = "/home/youwen/.config/liminalOS"; flakeLocation = "/home/youwen/.config/liminalOS";
config.allowUnfree = true; config.allowUnfree = true;
@ -42,87 +44,35 @@
programs.flatpak.enable = true; programs.flatpak.enable = true;
}; };
# Bootloader.
boot.loader = {
efi.canTouchEfiVariables = true;
timeout = 15;
# Lanzaboote currently replaces the systemd-boot module.
# This setting is usually set to true in configuration.nix
# generated at installation time. So we force it to false
# for now.
systemd-boot = {
enable = false;
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 = {
enable = true;
pkiBundle = "/etc/secureboot";
};
boot.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"; time.timeZone = "America/Los_Angeles";
# Select internationalisation properties. hardware.cpu.intel.updateMicrocode = true;
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { # Bootloader.
LC_ADDRESS = "en_US.UTF-8"; boot = {
LC_IDENTIFICATION = "en_US.UTF-8"; loader = {
LC_MEASUREMENT = "en_US.UTF-8"; efi.canTouchEfiVariables = true;
LC_MONETARY = "en_US.UTF-8"; timeout = 15;
LC_NAME = "en_US.UTF-8"; # Lanzaboote currently replaces the systemd-boot module.
LC_NUMERIC = "en_US.UTF-8"; # This setting is usually set to true in configuration.nix
LC_PAPER = "en_US.UTF-8"; # generated at installation time. So we force it to false
LC_TELEPHONE = "en_US.UTF-8"; # for now.
LC_TIME = "en_US.UTF-8"; systemd-boot = {
enable = false;
consoleMode = "auto";
};
};
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
kernelPackages = pkgs.linuxPackages_zen;
initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device =
"/dev/disk/by-uuid/af320a0f-b388-43f5-b5a3-af2b47cfc716";
}; };
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 = { programs.nix-ld = {
enable = true; enable = true;
libraries = with pkgs; [ 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. # Define a user account. Don't forget to set a password with passwd.
users.users.youwen = { users.users.youwen = {
isNormalUser = true; 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.zsh.enable = false;
programs.fish.enable = true; programs.fish.enable = true;
users.users.youwen.shell = pkgs.fish; users.users.youwen.shell = pkgs.fish;

View file

@ -46,12 +46,43 @@ in
''; '';
}; };
suppressWarnings = lib.mkEnableOption "suppress warnings"; 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 { config = lib.mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages =
inputs.viminal.packages.${pkgs.system}.default with pkgs;
]; [
wget
git
curl
]
++ [
inputs.viminal.packages.${pkgs.system}.default
];
environment.variables = { environment.variables = {
EDITOR = "nvim"; EDITOR = "nvim";
@ -124,6 +155,33 @@ in
hardware.enableRedistributableFirmware = true; 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 = warnings =
if !cfg.suppressWarnings && cfg.useNh && config.liminalOS.flakeLocation == "" then if !cfg.suppressWarnings && cfg.useNh && config.liminalOS.flakeLocation == "" then
[ [

View file

@ -26,5 +26,12 @@ in
}; };
programs.hyprland.enable = cfg.hyprland.enable; 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. 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 = { 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 = { options.liminalOS.theming = {
enable = lib.mkEnableOption "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 = [ imports = [
@ -51,5 +58,26 @@ in
size = 26; 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;
};
}; };
} }