From 4af469403b53152f1937ee726f7541e0dc46bf6e Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Thu, 3 Aug 2023 10:38:54 +0200 Subject: [PATCH] Consolidate configuration for mimir --- machines/mimir/configuration.nix | 78 ++++++++++++++++++++--- machines/mimir/hardware-configuration.nix | 71 --------------------- 2 files changed, 69 insertions(+), 80 deletions(-) delete mode 100644 machines/mimir/hardware-configuration.nix diff --git a/machines/mimir/configuration.nix b/machines/mimir/configuration.nix index f17aaa0..8d80b8f 100644 --- a/machines/mimir/configuration.nix +++ b/machines/mimir/configuration.nix @@ -3,7 +3,7 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { nixos-hardware, nomachine, microvm, ... }: -{ pkgs, ... }: +{ pkgs, config, ... }: { imports = [ @@ -15,8 +15,6 @@ microvm.nixosModules.host - ./hardware-configuration.nix - ../../users/erwin ../../users/root ]; @@ -64,9 +62,58 @@ systemd.enable = true; }; + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-label/home"; + fsType = "ext4"; + }; + + fileSystems."/yocto" = { + device = "/dev/disk/by-label/yocto"; + fsType = "ext4"; + }; + + swapDevices = + [{ device = "/dev/disk/by-label/swap"; }]; + + + hardware = { + enableAllFirmware = true; + nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + forceFullCompositionPipeline = true; + }; + + opengl = { + driSupport32Bit = true; + extraPackages = with pkgs; [ + vaapiVdpau + ]; + }; + }; + + # Use the systemd-boot EFI boot loader. boot = { - kernelPackages = pkgs.linuxPackages_6_3; + kernelPackages = pkgs.linuxPackages_6_4; + initrd = { + availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + kernelModules = [ "dm-snapshot" ]; + }; + kernelModules = [ "kvm-amd" "apple-mfi-fastcharge" "zenpower" ]; + # boot.kernelParams = [ "amd_pstate.shared_mem=1" ]; + extraModulePackages = [ ] ++ + (with config.boot.kernelPackages; [ rtl88x2bu zenpower cpupower ]); loader = { systemd-boot = { enable = true; @@ -199,11 +246,24 @@ services.tailscale.enable = true; - services.xserver.libinput = { - enable = true; - mouse = { - accelSpeed = "1.0"; - naturalScrolling = true; + + services.xserver = { + videoDrivers = [ "nvidia" ]; + + screenSection = '' + Option "metamodes" "DP-0: nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On, AllowGSYNCCompatible=On}, DP-4: nvidia-auto-select +3840+0 {ForceFullCompositionPipeline=On, AllowGSYNCCompatible=On}" + Option "TripleBuffer" "On" + ''; + + libinput = { + enable = true; + mouse = { + naturalScrolling = true; + accelSpeed = "1.0"; + }; + touchpad = { + naturalScrolling = true; + }; }; }; diff --git a/machines/mimir/hardware-configuration.nix b/machines/mimir/hardware-configuration.nix deleted file mode 100644 index 549fac5..0000000 --- a/machines/mimir/hardware-configuration.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ config, pkgs, ... }: { - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-amd" "apple-mfi-fastcharge" "zenpower" ]; - # boot.kernelParams = [ "amd_pstate.shared_mem=1" ]; - boot.extraModulePackages = [ ] ++ - (with config.boot.kernelPackages; [ rtl88x2bu zenpower cpupower ]); - - fileSystems."/" = { - device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-label/home"; - fsType = "ext4"; - }; - - fileSystems."/yocto" = { - device = "/dev/disk/by-label/yocto"; - fsType = "ext4"; - }; - - swapDevices = - [{ device = "/dev/disk/by-label/swap"; }]; - - powerManagement.cpuFreqGovernor = "ondemand"; - - hardware = { - # Renamed to fonts.optimizeForVeryHighDPI - # video.hidpi.enable = true; - enableAllFirmware = true; - nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - forceFullCompositionPipeline = true; - }; - - opengl = { - driSupport32Bit = true; - extraPackages = with pkgs; [ - vaapiVdpau - ]; - }; - }; - - services.xserver = { - videoDrivers = [ "nvidia" ]; - - screenSection = '' - Option "metamodes" "DP-0: nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On, AllowGSYNCCompatible=On}, DP-4: nvidia-auto-select +3840+0 {ForceFullCompositionPipeline=On, AllowGSYNCCompatible=On}" - Option "TripleBuffer" "On" - ''; - - libinput = { - enable = true; - mouse = { - naturalScrolling = true; - accelSpeed = "1.0"; - }; - touchpad = { - naturalScrolling = true; - }; - }; - }; -}