diff --git a/hosts/demeter/configuration.nix b/hosts/demeter/configuration.nix index 59ae003..cb24d82 100755 --- a/hosts/demeter/configuration.nix +++ b/hosts/demeter/configuration.nix @@ -14,6 +14,8 @@ ./hardware-configuration.nix ]; + networking.hostName = "demeter"; # Define your hostname. + liminalOS = { flakeLocation = "/home/youwen/.config/liminalOS"; config.allowUnfree = true; @@ -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"; - }; - }; - - 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"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; + hardware.cpu.intel.updateMicrocode = true; - 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"; + # 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"; + }; + }; + 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 = { 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; diff --git a/modules/linux/core/default.nix b/modules/linux/core/default.nix index e405f94..0991dba 100644 --- a/modules/linux/core/default.nix +++ b/modules/linux/core/default.nix @@ -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 [ diff --git a/modules/linux/desktop-environment/default.nix b/modules/linux/desktop-environment/default.nix index 4ad3246..734506a 100644 --- a/modules/linux/desktop-environment/default.nix +++ b/modules/linux/desktop-environment/default.nix @@ -26,5 +26,12 @@ in }; programs.hyprland.enable = cfg.hyprland.enable; + + services.xserver.enable = false; + + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; }; } diff --git a/modules/linux/misc/default.nix b/modules/linux/misc/default.nix index c93a66c..a7c378e 100644 --- a/modules/linux/misc/default.nix +++ b/modules/linux/misc/default.nix @@ -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"; + }; + }; }; } diff --git a/modules/linux/stylix/default.nix b/modules/linux/stylix/default.nix index 3ca67bd..cc46bfb 100644 --- a/modules/linux/stylix/default.nix +++ b/modules/linux/stylix/default.nix @@ -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; + }; + }; }