From c11b7205bda51a6de8866917013fc94a11794d9c Mon Sep 17 00:00:00 2001 From: lsoriano-mcm Date: Thu, 7 Aug 2025 14:43:11 -0500 Subject: [PATCH] reorganized boot --- flake.nix | 10 +- hosts/hakase/configuration.nix | 241 ++++++++++------------- hosts/macos/darwin.nix | 1 - hosts/steamos/configuration.nix | 169 ---------------- hosts/steamos/hardware-configuration.nix | 47 ----- modules/default/boot.nix | 56 ++++++ modules/default/darwin.nix | 1 + modules/default/desktop.nix | 5 +- 8 files changed, 163 insertions(+), 367 deletions(-) delete mode 100644 hosts/steamos/configuration.nix delete mode 100644 hosts/steamos/hardware-configuration.nix create mode 100644 modules/default/boot.nix diff --git a/flake.nix b/flake.nix index 757ac91..6ec20b0 100644 --- a/flake.nix +++ b/flake.nix @@ -34,11 +34,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - matugen = { - url = "github:/InioX/Matugen"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - quickshell = { url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; inputs.nixpkgs.follows = "nixpkgs"; @@ -56,6 +51,7 @@ flake-utils, home-manager, darwin, + chaotic, ... } @ inputs: let config = import ./config.nix; @@ -82,6 +78,8 @@ system = "x86_64-linux"; specialArgs = mkArgs "x86_64-linux"; modules = [ + chaotic.nixosModules.default + home-manager.nixosModules.home-manager ./hosts/hakase/configuration.nix ]; }; @@ -95,6 +93,7 @@ extraSpecialArgs = mkArgs "x86_64-linux"; }; modules = [ + home-manager.nixosModules.home-manager ./home/hakase.nix ]; }; @@ -105,6 +104,7 @@ system = "aarch64-darwin"; specialArgs = mkArgs "aarch64-darwin"; modules = [ + home-manager.darwinModules.home-manager ./hosts/macos/darwin.nix ]; }; diff --git a/hosts/hakase/configuration.nix b/hosts/hakase/configuration.nix index 5a23f99..c7ab3d4 100644 --- a/hosts/hakase/configuration.nix +++ b/hosts/hakase/configuration.nix @@ -7,20 +7,31 @@ ... }: { imports = [ - inputs.home-manager.nixosModules.home-manager - inputs.chaotic.nixosModules.default ./hardware-configuration.nix ../../modules/default/desktop.nix - ../../modules/default/dev.nix ../../modules/default/remote.nix + ../../modules/default/boot.nix + ../../modules/default/dev.nix ]; + system.stateVersion = "25.05"; + + i18n.defaultLocale = "en_US.UTF-8"; + time.timeZone = "${myConfig.nixos.Timezone}"; + environment.systemPackages = with pkgs; [ pavucontrol wl-clipboard wget ]; + console = { + earlySetup = false; + font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; + packages = with pkgs; [terminus_font]; + useXkbConfig = true; + }; + users = { defaultUserShell = pkgs.${myConfig.general.Terminal.shell}; users = { @@ -33,6 +44,7 @@ }; }; }; + home-manager = { backupFileExtension = "backup"; useGlobalPkgs = true; @@ -43,93 +55,6 @@ nixpkgs.config.allowUnfree = myConfig.general.allowUnfree; - hardware.logitech.wireless.enable = true; - hardware.bluetooth.enable = true; - hardware.xone.enable = true; - hardware.bluetooth.powerOnBoot = true; - hardware.bluetooth.settings = { - General = { - AutoEnable = true; - Experimental = true; - MultiProfile = "multiple"; - FastConnectable = true; - }; - }; - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - time.timeZone = "${myConfig.nixos.Timezone}"; - - boot.loader = { - systemd-boot = lib.mkIf (myConfig.nixos.Boot.mode == "systemd") { - enable = true; - }; - grub = lib.mkIf (myConfig.nixos.Boot.mode == "grub") { - efiSupport = true; - enable = true; - device = "nodev"; - useOSProber = true; - }; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot"; - }; - }; - - programs.ssh.extraConfig = myConfig.optionals.Ssh.extraConfig; - - programs.bash = { - interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] - then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; - }; - - programs = { - zsh.enable = true; - fish.enable = true; - }; - - services = { - displayManager.sessionPackages = [inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland]; - getty.autologinUser = lib.mkOverride 10 "${myConfig.essentials.Username}"; - greetd = { - enable = true; - settings.default_session = { - user = lib.mkOverride 10 "${myConfig.essentials.Username}"; - command = lib.mkOverride 10 "Hyprland"; - }; - }; - flatpak.enable = true; - seatd.enable = true; - upower.enable = true; - scx.enable = true; # by default uses scx_rustland scheduler - libinput.enable = true; - blueman.enable = true; - printing.enable = true; - openssh.enable = true; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - - # lowLatency = { - # enable = true; - # quantum = 64; - # rate = 48000; - # }; - }; - }; - # make pipewire realtime-capable - security.rtkit.enable = true; - nix = { distributedBuilds = true; settings = { @@ -139,68 +64,100 @@ }; }; - console = { - earlySetup = false; - font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; - packages = with pkgs; [terminus_font]; - useXkbConfig = true; + hardware = { + logitech.wireless.enable = true; + + bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + AutoEnable = true; + Experimental = true; + MultiProfile = "multiple"; + FastConnectable = true; + }; + }; + }; + + graphics = { + enable = true; + enable32Bit = true; + }; + + xone.enable = true; }; networking = { - # wakeOnLan.enable = true; - # networkd.enable = true; networkmanager.enable = true; firewall = { enable = true; allowedTCPPorts = [22 80]; allowedUDPPorts = [53]; }; - proxy.default = null; - proxy.noProxy = null; - }; - systemd.network.enable = true; - - boot.loader.timeout = 0; - boot.loader.limine.maxGenerations = 5; - hardware.amdgpu.initrd.enable = true; - boot.kernelParams = [ - "quiet" - "splash" - "boot.shell_on_fail" - "udev.log_priority=3" - "rd.systemd.show_status=auto" - "kvm.enable_virt_at_load=0" # for virtualbox - # "amd_pstate=active" - ]; - boot.kernelPackages = pkgs.linuxPackages_cachyos; - # boot.kernel.sysctl = { - # "kernel.split_lock_mitigate" = 0; - # "kernel.nmi_watchdog" = 0; - # "kernel.sched_bore" = "1"; - # }; - # - boot.initrd = { - systemd.enable = true; - kernelModules = []; - verbose = false; + proxy = { + default = null; + noProxy = null; + }; }; - boot.plymouth.enable = true; - boot.plymouth.theme = "seal"; - boot.plymouth.themePackages = with pkgs; [ - # By default we would install all themes - (adi1090x-plymouth-themes.override { - selected_themes = ["seal"]; - }) - ]; - boot.consoleLogLevel = 0; - systemd.extraConfig = "DefaultTimeoutStopSec=5s"; - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; + systemd = { + network.enable = true; + extraConfig = "DefaultTimeoutStopSec=5s"; + }; - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - system.stateVersion = "25.05"; + security.rtkit.enable = true; + + programs = { + bash.interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]; then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + zsh.enable = true; + fish.enable = true; + ssh.extraConfig = myConfig.optionals.Ssh.extraConfig; + }; + + services = { + displayManager.sessionPackages = [ + inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland + ]; + + getty.autologinUser = lib.mkOverride 10 "${myConfig.essentials.Username}"; + + greetd = { + enable = true; + settings.default_session = { + user = lib.mkOverride 10 "${myConfig.essentials.Username}"; + command = lib.mkOverride 10 "Hyprland"; + }; + }; + + flatpak.enable = true; + seatd.enable = true; + upower.enable = true; + scx.enable = true; + libinput.enable = true; + blueman.enable = true; + printing.enable = true; + openssh.enable = true; + + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + + # Uncomment for low-latency audio + # lowLatency = { + # enable = true; + # quantum = 64; + # rate = 48000; + # }; + }; + }; } diff --git a/hosts/macos/darwin.nix b/hosts/macos/darwin.nix index 5b066a1..2792f70 100644 --- a/hosts/macos/darwin.nix +++ b/hosts/macos/darwin.nix @@ -8,7 +8,6 @@ }: { imports = [ ../../modules/default/darwin.nix - inputs.home-manager.darwinModules.home-manager ]; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget diff --git a/hosts/steamos/configuration.nix b/hosts/steamos/configuration.nix deleted file mode 100644 index 9e36236..0000000 --- a/hosts/steamos/configuration.nix +++ /dev/null @@ -1,169 +0,0 @@ -{ - config, - pkgs, - lib, - myConfig, - inputs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - inputs.chaotic.nixosModules.default - ./hardware-configuration.nix - ]; - - nix.settings.experimental-features = ["nix-command" "flakes"]; - nixpkgs.config.allowUnfree = true; - - #################### - # Boot & Kernel # - #################### - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.timeout = 0; - boot.loader.limine.maxGenerations = 5; - hardware.amdgpu.initrd.enable = true; - - boot.kernelParams = ["quiet"]; - boot.kernelPackages = pkgs.linuxPackages_cachyos; - boot.kernel.sysctl = { - "kernel.split_lock_mitigate" = 0; - "kernel.nmi_watchdog" = 0; - "kernel.sched_bore" = "1"; - }; - - boot.initrd = { - systemd.enable = true; - kernelModules = []; - verbose = false; - }; - boot.plymouth.enable = true; - boot.consoleLogLevel = 0; - systemd.extraConfig = "DefaultTimeoutStopSec=5s"; - - ################ - # FileSystems # - ################ - # fileSystems."/" = { - # options = ["compress=zstd"]; - # }; - - ############ - # Network # - ############ - networking = { - networkmanager.enable = true; - firewall.enable = false; - hostName = "nixos"; - }; - - ################# - # Bluetooth # - ################# - hardware.bluetooth.enable = true; - hardware.bluetooth.settings = { - General = { - MultiProfile = "multiple"; - FastConnectable = true; - }; - }; - - ################# - # Sound & RTKit # - ################# - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - ######################## - # Graphical & Greetd # - ######################## - - services.xserver.enable = false; - services.getty.autologinUser = "steamos"; - services.greetd = { - enable = true; - settings.default_session = { - user = "${myConfig.essentials.Username}"; - command = "steam-gamescope > /dev/null 2>&1"; - }; - }; - - ######################## - # Programs & Gaming # - ######################## - services.automatic-timezoned.enable = true; - services.flatpak.enable = true; - xdg.portal.enable = true; - xdg.portal.config.common.default = "*"; - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; - - # programs.steam.gamescopeSession.args = ["-w 1920" "-h 1080" "-r 120" "--xwayland-count 2" "-e" "--hdr-enabled" "--mangoapp"]; - - programs = { - appimage = { - enable = true; - binfmt = true; - }; - fish = {enable = true;}; - mosh = {enable = true;}; - tmux = {enable = true;}; - gamescope.capSysNice = true; - steam = { - enable = true; - gamescopeSession.enable = true; - extraCompatPackages = with pkgs; [proton-ge-bin]; - extraPackages = with pkgs; [ - mangohud - gamescope-wsi - ]; - }; - }; - - environment.sessionVariables = { - PROTON_USE_NTSYNC = "1"; - ENABLE_HDR_WSI = "1"; - DXVK_HDR = "1"; - PROTON_ENABLE_AMD_AGS = "1"; - PROTON_ENABLE_NVAPI = "1"; - ENABLE_GAMESCOPE_WSI = "1"; - STEAM_MULTIPLE_XWAYLANDS = "1"; - }; - - ################### - # Virtualization # - ################### - virtualisation.docker.enable = true; - virtualisation.docker.enableOnBoot = false; - virtualisation.libvirtd.enable = true; - - ############### - # Users # - ############### - users.users.${myConfig.essentials.Username} = { - isNormalUser = true; - description = "SteamOS user"; - extraGroups = ["networkmanager" "wheel" "docker" "video" "seat" "audio" "libvirtd"]; - # password = "steamos"; - }; - - ################# - # Security # - ################# - security.sudo.wheelNeedsPassword = false; - security.polkit.enable = true; - services.seatd.enable = true; - services.openssh.enable = true; - - ###################### - ###################### - - ######################## - # System State Version # - ######################## - system.stateVersion = "25.05"; -} diff --git a/hosts/steamos/hardware-configuration.nix b/hosts/steamos/hardware-configuration.nix deleted file mode 100644 index 0884052..0000000 --- a/hosts/steamos/hardware-configuration.nix +++ /dev/null @@ -1,47 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/532ac73e-1370-4e4d-9d5a-15033de0b96d"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/1368-D3F3"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; - - fileSystems."/home" = - { device = "/dev/disk/by-uuid/780aa81f-c4d6-478b-9c51-2d60362fdb07"; - fsType = "ext4"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/b02ef55c-4caf-4a24-a6a2-fb8001eafe22"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp11s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp10s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/modules/default/boot.nix b/modules/default/boot.nix new file mode 100644 index 0000000..6005d72 --- /dev/null +++ b/modules/default/boot.nix @@ -0,0 +1,56 @@ +{ + myConfig, + lib, + pkgs, + ... +}: { + boot = { + loader = { + timeout = 0; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + systemd-boot = lib.mkIf (myConfig.nixos.Boot.mode == "systemd") { + enable = true; + }; + grub = lib.mkIf (myConfig.nixos.Boot.mode == "grub") { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + limine.maxGenerations = 5; + }; + + plymouth = { + enable = true; + theme = "seal"; + themePackages = with pkgs; [ + (adi1090x-plymouth-themes.override { + selected_themes = ["seal"]; + }) + ]; + }; + + kernelPackages = pkgs.linuxPackages_cachyos; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + "kvm.enable_virt_at_load=0" + ]; + + initrd = { + systemd.enable = true; + kernelModules = []; + verbose = false; + }; + + consoleLogLevel = 0; + + hardware.amdgpu.initrd.enable = true; + }; +} diff --git a/modules/default/darwin.nix b/modules/default/darwin.nix index c576eb0..72c045f 100644 --- a/modules/default/darwin.nix +++ b/modules/default/darwin.nix @@ -1,5 +1,6 @@ { imports = [ ../../packages/python/default.nix + ../../packages/virtualbox/default.nix ]; } diff --git a/modules/default/desktop.nix b/modules/default/desktop.nix index 614101f..74c7bf0 100644 --- a/modules/default/desktop.nix +++ b/modules/default/desktop.nix @@ -6,10 +6,9 @@ imports = [ ../../packages/hyprland/default.nix - ../../packages/matugen/default.nix - ../../packages/quickshell/default.nix ../../packages/udev/default.nix - ../../packages/virtualbox/default.nix + + ../../packages/quickshell/default.nix ] ++ [ ../../packages/steam/default.nix