From 89f2094cf4a77f654b4d6c8a6ba29505c22bb61e Mon Sep 17 00:00:00 2001 From: Drew Haven Date: Sat, 1 Feb 2025 11:29:17 -0800 Subject: [PATCH] Modularizes the config for flakes. --- configuration.nix | 4 +- flake.nix | 1 + hardware-configuration.nix | 75 ++++++++++++++++++++++++++++++++++++++ home-manager/drew.nix | 8 ++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix index f2457bc..55727c3 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ config, pkgs, inputs, ... }: { # Bootloader. @@ -51,6 +51,8 @@ programs.hyprland = { enable = true; withUWSM = true; + package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; }; # Configure keymap in X11 diff --git a/flake.nix b/flake.nix index 4533e2f..c31725d 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ system = "x86_64-linux"; modules = [ ./configuration.nix + ./hardware-configuration.nix inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..d77f6e0 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,75 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/343c0ac5-3973-49b3-964a-6ad90c36b89c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/5F99-043D"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/28f4fb41-9414-4504-a767-c2e8bf5eb2c8"; + fsType = "ext4"; + }; + + 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.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Graphics settings + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.beta; + + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + + # Fine-grained power management for PRIME. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + # Requires offload to be enabled. + # powerManagement.finegrained = false; + + # Use the open-source driver? + open = false; + + # Enable the nvidia-settings menu? + nvidiaSettings = true; + }; +} diff --git a/home-manager/drew.nix b/home-manager/drew.nix index f7c504e..7c6faa8 100644 --- a/home-manager/drew.nix +++ b/home-manager/drew.nix @@ -116,6 +116,14 @@ }; }; + wayland.windowManager.hyprland = { + enable = true; + plugins = with inputs.hyprland-plugins.packages.${pkgs.system}; [ + hy3 + split-monitor-workspace + ]; + }; + qt = { enable = true; platformTheme.name = "adwaita";