From 0e0076c14ce4ea51501c3ce4a2f0a9a782e25340 Mon Sep 17 00:00:00 2001 From: Chris Dombroski Date: Fri, 20 Sep 2024 21:49:07 -0400 Subject: [PATCH] ezConfigs for smolboi --- {systems/smolboi => configs}/home.nix | 0 flake.nix | 28 ---- .../smolboi.nix | 154 +++++++++++++----- systems/smolboi/hardware-configuration.nix | 79 --------- 4 files changed, 112 insertions(+), 149 deletions(-) rename {systems/smolboi => configs}/home.nix (100%) rename systems/smolboi/configuration.nix => nixos-configurations/smolboi.nix (58%) delete mode 100644 systems/smolboi/hardware-configuration.nix diff --git a/systems/smolboi/home.nix b/configs/home.nix similarity index 100% rename from systems/smolboi/home.nix rename to configs/home.nix diff --git a/flake.nix b/flake.nix index 2a9d649..85b61aa 100644 --- a/flake.nix +++ b/flake.nix @@ -93,34 +93,6 @@ } ); }; - nixosConfigurations = { - smolboi = inputs.nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs-unstable = inputs.nixunstable.legacyPackages.x86_64-linux; - }; - modules = [ - ./systems/smolboi/configuration.nix - inputs.stylix.nixosModules.stylix - inputs.impermanence.nixosModules.impermanence - inputs.nixos-hardware.nixosModules.common-cpu-amd - inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate - inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower - inputs.nixos-hardware.nixosModules.common-gpu-amd - inputs.nixos-hardware.nixosModules.common-pc - inputs.nixos-hardware.nixosModules.common-pc-ssd - inputs.nixos-hardware.nixosModules.gigabyte-b550 - inputs.home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = { - pkgs-unstable = inputs.nixunstable.legacyPackages.x86_64-linux; - }; - home-manager.useGlobalPkgs = true; - home-manager.users.cdombroski = import ./systems/smolboi/home.nix; - } - ]; - }; - }; }; perSystem = { pkgs, system, ... }: diff --git a/systems/smolboi/configuration.nix b/nixos-configurations/smolboi.nix similarity index 58% rename from systems/smolboi/configuration.nix rename to nixos-configurations/smolboi.nix index afb3414..c03101d 100644 --- a/systems/smolboi/configuration.nix +++ b/nixos-configurations/smolboi.nix @@ -1,18 +1,45 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + ezModules, + inputs, + modulesPath, + lib, + ... +}: +let + pkgs-unstable = import inputs.nixunstable { inherit (pkgs.stdenv) system; }; +in { imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ../../nixos-modules - ../../nixos-modules/aarch64-emu.nix - ../../nixos-modules/smartd.nix - ../../nixos-modules/plymouth.nix + inputs.stylix.nixosModules.stylix + inputs.impermanence.nixosModules.impermanence + inputs.nixos-hardware.nixosModules.common-cpu-amd + inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate + inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower + inputs.nixos-hardware.nixosModules.common-gpu-amd + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-ssd + inputs.nixos-hardware.nixosModules.gigabyte-b550 + inputs.home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = { + inherit pkgs-unstable; + }; + home-manager.useGlobalPkgs = true; + home-manager.users.cdombroski = import ../configs/home.nix; + } + ezModules.aarch64-emu + ezModules.smartd + ezModules.plymouth ]; boot = { - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; binfmt.registrations.appimage = { wrapInterpreterInShell = false; interpreter = "${pkgs.appimage-run}/bin/appimage-run"; @@ -22,22 +49,32 @@ magicOrExtension = "\\x7fELF....AI\\x02"; }; tmp.cleanOnBoot = true; + kernelModules = [ "kvm-amd" ]; + initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "usbhid" + "sd_mod" + ]; }; networking = { hostName = "smolboi"; # Define your hostname. networkmanager.enable = true; # Easiest to use and most distros use this by default. firewall.allowedTCPPorts = [ 22000 ]; + useDHCP = lib.mkDefault true; }; - nixpkgs.config = { - allowUnfree = true; - permittedInsecurePackages = [ - "electron-25.9.0" - "nix-2.16.2" - ]; - packageOverrides = pkgs: { - steam = pkgs.steam.override { extraPkgs = pkgs: with pkgs; [ winetricks ]; }; + nixpkgs = { + config = { + allowUnfree = true; + permittedInsecurePackages = [ "electron-25.9.0" ]; + packageOverrides = pkgs: { + steam = pkgs.steam.override { extraPkgs = pkgs: with pkgs; [ winetricks ]; }; + }; }; + hostPlatform = lib.mkDefault "x86_64-linux"; }; services = { @@ -168,31 +205,64 @@ }; fileSystems = { - "/persist".options = [ - "compress=lzo" - "autodefrag" - "discard=async" - "defaults" - ]; - "/nix".options = [ - "compress=lzo" - "autodefrag" - "discard=async" - "noatime" - "defaults" - ]; - "/steam-library".options = [ - "compress=lzo" - "autodefrag" - "discard=async" - "defaults" - ]; - "/home".options = [ - "compress=lzo" - "autodefrag" - "discard=async" - "defaults" - ]; + "/" = { + device = "none"; + fsType = "tmpfs"; + options = [ + "defaults" + "size=2g" + "mode=755" + ]; + }; + "/persist" = { + device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; + neededForBoot = true; + fsType = "btrfs"; + options = [ + "subvol=@nixos/root" + "compress=lzo" + "autodefrag" + "discard=async" + "defaults" + ]; + }; + "/nix" = { + device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; + fsType = "btrfs"; + options = [ + "subvol=@nixos/nix" + "compress=lzo" + "autodefrag" + "discard=async" + "noatime" + "defaults" + ]; + }; + "/steam-library" = { + device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; + fsType = "btrfs"; + options = [ + "compress=lzo" + "autodefrag" + "discard=async" + "defaults" + ]; + }; + "/home" = { + device = "/dev/disk/by-uuid/8597952f-be42-4361-9be1-2c4af6ede9b8"; + fsType = "btrfs"; + options = [ + "subvol=@home" + "compress=lzo" + "autodefrag" + "discard=async" + "defaults" + ]; + }; + "/boot" = { + device = "/dev/disk/by-uuid/1ADE-808D"; + fsType = "vfat"; + }; }; stylix = { diff --git a/systems/smolboi/hardware-configuration.nix b/systems/smolboi/hardware-configuration.nix deleted file mode 100644 index 9de210c..0000000 --- a/systems/smolboi/hardware-configuration.nix +++ /dev/null @@ -1,79 +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" - "usb_storage" - "usbhid" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "none"; - fsType = "tmpfs"; - options = [ - "defaults" - "size=2g" - "mode=755" - ]; - }; - - fileSystems."/persist" = { - device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; - neededForBoot = true; - fsType = "btrfs"; - options = [ "subvol=@nixos/root" ]; - }; - - fileSystems."/steam-library" = { - device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; - fsType = "btrfs"; - options = [ "subvol=@steam-library" ]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/1ADE-808D"; - fsType = "vfat"; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-uuid/8597952f-be42-4361-9be1-2c4af6ede9b8"; - fsType = "btrfs"; - options = [ "subvol=@home" ]; - }; - - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/d0eb1b09-7fba-49e3-b802-d6fdd9073516"; - fsType = "btrfs"; - options = [ "subvol=@nixos/nix" ]; - }; - - swapDevices = [ ]; - - # 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.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -}