Skip to content

Commit

Permalink
refactor: configure more core system options via liminalOS module
Browse files Browse the repository at this point in the history
  • Loading branch information
youwen5 committed Dec 25, 2024
1 parent 104a61a commit 1aa376e
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 120 deletions.
140 changes: 23 additions & 117 deletions hosts/demeter/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
./hardware-configuration.nix
];

networking.hostName = "demeter"; # Define your hostname.

liminalOS = {
flakeLocation = "/home/youwen/.config/liminalOS";
config.allowUnfree = true;
Expand Down Expand Up @@ -42,87 +44,35 @@
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";
};
};
time.timeZone = "America/Los_Angeles";

hardware.cpu.intel.updateMicrocode = true;

# Bootloader.
boot = {
plymouth = {
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";
};
};
lanzaboote = {
enable = true;
font = "${config.stylix.fonts.monospace.package}/share/fonts/truetype/NerdFonts/CaskaydiaCove/CaskaydiaCoveNerdFontMono-Regular.ttf";
pkiBundle = "/etc/secureboot";
};

# 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";

# 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";
};
kernelPackages = pkgs.linuxPackages_zen;

systemd.services = {
NetworkManager-wait-online.enable = false;
initrd.luks.devices."luks-af320a0f-b388-43f5-b5a3-af2b47cfc716".device =
"/dev/disk/by-uuid/af320a0f-b388-43f5-b5a3-af2b47cfc716";
};

# 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; [
Expand All @@ -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;
Expand All @@ -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;
Expand Down
64 changes: 61 additions & 3 deletions modules/linux/core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
[
Expand Down
7 changes: 7 additions & 0 deletions modules/linux/desktop-environment/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ in
};

programs.hyprland.enable = cfg.hyprland.enable;

services.xserver.enable = false;

services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
};
}
22 changes: 22 additions & 0 deletions modules/linux/misc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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";
};
};
};
}
28 changes: 28 additions & 0 deletions modules/linux/stylix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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;
};

};
}

0 comments on commit 1aa376e

Please sign in to comment.