From 7005fc441d09f63bd3cd18ea0709086dae216d0f Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 15 Oct 2023 17:27:57 -0400 Subject: [PATCH] refactor: move some of wim's configs to module folder --- common/modules/programs.nix | 3 ++ hosts/wim/cfg/extra-hardware.nix | 54 -------------------- hosts/wim/cfg/main.nix | 1 - hosts/wim/configuration.nix | 16 +++--- hosts/wim/hardware-configuration.nix | 73 +++++++++++++++++----------- 5 files changed, 54 insertions(+), 93 deletions(-) delete mode 100644 hosts/wim/cfg/extra-hardware.nix diff --git a/common/modules/programs.nix b/common/modules/programs.nix index fb3f3486..6bc11e15 100644 --- a/common/modules/programs.nix +++ b/common/modules/programs.nix @@ -1,6 +1,9 @@ { pkgs, ... }: { services = { + fwupd.enable = true; + upower.enable = true; + locate = { enable = true; package = pkgs.mlocate; diff --git a/hosts/wim/cfg/extra-hardware.nix b/hosts/wim/cfg/extra-hardware.nix deleted file mode 100644 index 1627b2c6..00000000 --- a/hosts/wim/cfg/extra-hardware.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ pkgs, ... }: - -{ - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - - # enable brightness control for swayosd - programs.light.enable = true; - - services = { - - udev.extraRules = '' - # give permanent path to keyboard XF86* binds - SUBSYSTEMS=="input", ATTRS{id/product}=="0006", ATTRS{id/vendor}=="0000", SYMLINK += "video-bus" - - # give permanent path to touchpad - SUBSYSTEMS=="input", ATTRS{id/product}=="01e0", ATTRS{id/vendor}=="27c6", ATTRS{name}=="GXTP5140:00 27C6:01E0 Touchpad", SYMLINK += "touchpad" - ''; - - fwupd.enable = true; - - # Enable CUPS to print documents. - printing = { - enable = true; - drivers = with pkgs; [ - hplip - ]; - }; - - pipewire = { - enable = true; - alsa.enable = true; - jack.enable = true; - pulse.enable = true; - }; - - upower.enable = true; - }; - - hardware = { - pulseaudio.enable = false; - sensor.iio.enable = true; - opengl.enable = true; - opengl.driSupport32Bit = true; - uinput.enable = true; - }; - - virtualisation = { - libvirtd.enable = true; - waydroid.enable = true; - }; -} diff --git a/hosts/wim/cfg/main.nix b/hosts/wim/cfg/main.nix index 023e4602..614fcf19 100644 --- a/hosts/wim/cfg/main.nix +++ b/hosts/wim/cfg/main.nix @@ -3,7 +3,6 @@ { imports = [ ./boot.nix - ./extra-hardware.nix ./security.nix ./packages.nix ]; diff --git a/hosts/wim/configuration.nix b/hosts/wim/configuration.nix index fd7603fa..e5c4cff5 100644 --- a/hosts/wim/configuration.nix +++ b/hosts/wim/configuration.nix @@ -1,13 +1,19 @@ -{ pkgs, ... }: +{ lib, ... }: { imports = [ ./hardware-configuration.nix + + ../../modules/audio.nix + ../../modules/kmscon.nix + ../../modules/printer.nix + ./cfg/main.nix ./home/main.nix ]; networking = { + useDHCP = lib.mkDefault true; hostName = "wim"; networkmanager = { enable = true; @@ -18,14 +24,6 @@ # Set your time zone. time.timeZone = "America/Montreal"; - services.kmscon = { - enable = true; - hwRender = true; - # FIXME: https://github.com/Aetf/kmscon/issues/18 // Icons not rendering properly - # FIXME: https://github.com/Aetf/kmscon/issues/56 // Mouse cursor stays - extraOptions = "--font-size 12.5 --font-dpi 170 --font-name 'JetBrainsMono Nerd Font'"; - }; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave diff --git a/hosts/wim/hardware-configuration.nix b/hosts/wim/hardware-configuration.nix index 63e6b312..38e35526 100644 --- a/hosts/wim/hardware-configuration.nix +++ b/hosts/wim/hardware-configuration.nix @@ -1,40 +1,55 @@ -# 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, modulesPath, ... }: - -{ +{ config, modulesPath, ... }: { + nixpkgs.hostPlatform = "x86_64-linux"; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/6ae4d722-dacf-485a-8d29-b276f540dc91"; - fsType = "btrfs"; + boot = { + initrd = { + availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + luks.devices."root".device = "/dev/disk/by-uuid/ab82b477-2477-453f-b95f-28e5553ad10d"; + }; + kernelModules = [ "kvm-amd" ]; }; - boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/ab82b477-2477-453f-b95f-28e5553ad10d"; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/6ae4d722-dacf-485a-8d29-b276f540dc91"; + fsType = "btrfs"; + }; - fileSystems."/boot" = { - device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; + "/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; }; - swapDevices = [ ]; - zramSwap.enable = true; + hardware = { + cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware; - # 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.enp7s0f4u2.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; + sensor.iio.enable = true; + opengl.enable = true; + opengl.driSupport32Bit = true; + uinput.enable = true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + }; + + virtualisation = { + libvirtd.enable = true; + waydroid.enable = true; + }; + + # enable brightness control for swayosd + programs.light.enable = true; + + services.udev.extraRules = '' + # give permanent path to keyboard XF86* binds + SUBSYSTEMS=="input", ATTRS{id/product}=="0006", ATTRS{id/vendor}=="0000", SYMLINK += "video-bus" + + # give permanent path to touchpad + SUBSYSTEMS=="input", ATTRS{id/product}=="01e0", ATTRS{id/vendor}=="27c6", ATTRS{name}=="GXTP5140:00 27C6:01E0 Touchpad", SYMLINK += "touchpad" + ''; }