diff --git a/hosts/orion/default.nix b/hosts/orion/default.nix index bbd1156..5d5aa12 100644 --- a/hosts/orion/default.nix +++ b/hosts/orion/default.nix @@ -9,6 +9,7 @@ # ./disko.nix ./hardware-configuration.nix # ./impermanence.nix + ./ga403 # Profiles ../../modules # Users @@ -21,12 +22,15 @@ # Custom modules unfree.enable = true; + nvidia.enable = true; desktop.enable = true; - desktop.hostMonitorSettings = " + desktop.hostSettings = " monitor = desc:Samsung Display Corp. ATNA40CU05-0, 2880x1800@120, auto, 1.5 + + exec-once = asus-ctl slash -d; asusctl -c 80 "; - # gaming.enable = true; + gaming.enable = true; # gsr.defaultAudioDevice = "alsa_output.usb-Schiit_Audio_Schiit_Modi_-00.analog-stereo.monitor"; # alsa_output.usb-Generic_USB_Audio-00.analog-stereo.monitor # low-latency.enable = false; # vhs-decode.enable = true; diff --git a/hosts/orion/ga403/common/cpu/amd/default.nix b/hosts/orion/ga403/common/cpu/amd/default.nix new file mode 100644 index 0000000..d8c48a2 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/amd/default.nix @@ -0,0 +1,6 @@ +{ config, lib, ... }: + +{ + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/orion/ga403/common/cpu/amd/pstate.nix b/hosts/orion/ga403/common/cpu/amd/pstate.nix new file mode 100644 index 0000000..6a84027 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/amd/pstate.nix @@ -0,0 +1,32 @@ +{ lib, config, ... }: +let + kver = config.boot.kernelPackages.kernel.version; +in +{ + # Enables the amd cpu scaling https://www.kernel.org/doc/html/latest/admin-guide/pm/amd-pstate.html + # On recent AMD CPUs this can be more energy efficient. + + imports = [ ./. ]; + boot = lib.mkMerge [ + (lib.mkIf + ( + (lib.versionAtLeast kver "5.17") + && (lib.versionOlder kver "6.1") + ) + { + kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; + kernelModules = [ "amd-pstate" ]; + }) + (lib.mkIf + ( + (lib.versionAtLeast kver "6.1") + && (lib.versionOlder kver "6.3") + ) + { + kernelParams = [ "amd_pstate=passive" ]; + }) + (lib.mkIf (lib.versionAtLeast kver "6.3") { + kernelParams = [ "amd_pstate=active" ]; + }) + ]; +} diff --git a/hosts/orion/ga403/common/cpu/amd/raphael/igpu.nix b/hosts/orion/ga403/common/cpu/amd/raphael/igpu.nix new file mode 100644 index 0000000..71b1152 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/amd/raphael/igpu.nix @@ -0,0 +1,26 @@ +{ + lib, + pkgs, + config, + ... +}: + +{ + # Sets the kernel version to the latest kernel to make the usage of the iGPU possible if your kernel version is too old + # Disables scatter/gather which was introduced with kernel version 6.2 + # It produces completely white or flashing screens when enabled while using the iGPU of Ryzen 7000-series CPUs (Raphael) + # This issue is not seen in kernel 6.6 or newer versions + + imports = [ ../. ]; + + boot = lib.mkMerge [ + (lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") { + kernelPackages = pkgs.linuxPackages_latest; + }) + + (lib.mkIf ( + (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.2") + && (lib.versionOlder config.boot.kernelPackages.kernel.version "6.6") + ) { kernelParams = [ "amdgpu.sg_display=0" ]; }) + ]; +} diff --git a/hosts/orion/ga403/common/cpu/amd/zenpower.nix b/hosts/orion/ga403/common/cpu/amd/zenpower.nix new file mode 100644 index 0000000..c633766 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/amd/zenpower.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: +{ + # Enables the zenpower sensor in lieu of the k10temp sensor on Zen CPUs https://git.exozy.me/a/zenpower3 + # On Zen CPUs zenpower produces much more data entries + + imports = [ ./. ]; + boot.blacklistedKernelModules = [ "k10temp" ]; + boot.extraModulePackages = [ config.boot.kernelPackages.zenpower ]; + boot.kernelModules = [ "zenpower" ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/alder-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/alder-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/alder-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/alder-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/alder-lake/default.nix new file mode 100644 index 0000000..a5f7b34 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/alder-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/alder-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/bay-trail/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/bay-trail/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/bay-trail/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/bay-trail/default.nix b/hosts/orion/ga403/common/cpu/intel/bay-trail/default.nix new file mode 100644 index 0000000..0841855 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/bay-trail/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/bay-trail + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/braswell/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/braswell/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/braswell/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/braswell/default.nix b/hosts/orion/ga403/common/cpu/intel/braswell/default.nix new file mode 100644 index 0000000..567f579 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/braswell/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/braswell + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/broadwell/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/broadwell/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/broadwell/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/broadwell/default.nix b/hosts/orion/ga403/common/cpu/intel/broadwell/default.nix new file mode 100644 index 0000000..415cc6f --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/broadwell/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/broadwell + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/coffee-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/coffee-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/coffee-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/coffee-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/coffee-lake/default.nix new file mode 100644 index 0000000..0d02b9c --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/coffee-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/coffee-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/comet-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/comet-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/comet-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/comet-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/comet-lake/default.nix new file mode 100644 index 0000000..3c688f5 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/comet-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/comet-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/cpu-only.nix new file mode 100644 index 0000000..e42e90b --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/cpu-only.nix @@ -0,0 +1,4 @@ +{ config, lib, ... }: +{ + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/orion/ga403/common/cpu/intel/default.nix b/hosts/orion/ga403/common/cpu/intel/default.nix new file mode 100644 index 0000000..fe9f96b --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../gpu/intel + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/elkhart-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/elkhart-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/elkhart-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/elkhart-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/elkhart-lake/default.nix new file mode 100644 index 0000000..e4a42af --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/elkhart-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/elkhart-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/haswell/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/haswell/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/haswell/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/haswell/default.nix b/hosts/orion/ga403/common/cpu/intel/haswell/default.nix new file mode 100644 index 0000000..c8b3b8e --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/haswell/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/haswell + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/jasper-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/jasper-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/jasper-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/jasper-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/jasper-lake/default.nix new file mode 100644 index 0000000..27e93a4 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/jasper-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/jasper-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/kaby-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/kaby-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/kaby-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/kaby-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/kaby-lake/default.nix new file mode 100644 index 0000000..f6cc8cc --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/kaby-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/kaby-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/lunar-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/lunar-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/lunar-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/lunar-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/lunar-lake/default.nix new file mode 100644 index 0000000..0f92ca5 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/lunar-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/lunar-lake + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/sandy-bridge/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/sandy-bridge/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/sandy-bridge/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/sandy-bridge/default.nix b/hosts/orion/ga403/common/cpu/intel/sandy-bridge/default.nix new file mode 100644 index 0000000..9aeff58 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/sandy-bridge/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/sandy-bridge + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/tiger-lake/cpu-only.nix b/hosts/orion/ga403/common/cpu/intel/tiger-lake/cpu-only.nix new file mode 100644 index 0000000..8289261 --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/tiger-lake/cpu-only.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ../cpu-only.nix + ]; +} diff --git a/hosts/orion/ga403/common/cpu/intel/tiger-lake/default.nix b/hosts/orion/ga403/common/cpu/intel/tiger-lake/default.nix new file mode 100644 index 0000000..10ad86e --- /dev/null +++ b/hosts/orion/ga403/common/cpu/intel/tiger-lake/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./cpu-only.nix + ../../../gpu/intel/tiger-lake + ]; +} diff --git a/hosts/orion/ga403/common/gpu/24.05-compat.nix b/hosts/orion/ga403/common/gpu/24.05-compat.nix new file mode 100644 index 0000000..1750888 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/24.05-compat.nix @@ -0,0 +1,15 @@ +{ + lib, + ... +}: +{ + # Backward-compat for 24.05, can be removed after we drop 24.05 support + imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [ + (lib.mkAliasOptionModule [ "hardware" "graphics" "enable" ] [ "hardware" "opengl" "enable" ]) + (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages" ] [ "hardware" "opengl" "extraPackages" ]) + (lib.mkAliasOptionModule [ "hardware" "graphics" "extraPackages32" ] [ "hardware" "opengl" "extraPackages32" ]) + (lib.mkAliasOptionModule [ "hardware" "graphics" "enable32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]) + (lib.mkAliasOptionModule [ "hardware" "graphics" "package" ] [ "hardware" "opengl" "package" ]) + (lib.mkAliasOptionModule [ "hardware" "graphics" "package32" ] [ "hardware" "opengl" "package32" ]) + ]; +} diff --git a/hosts/orion/ga403/common/gpu/amd/default.nix b/hosts/orion/ga403/common/gpu/amd/default.nix new file mode 100644 index 0000000..5373004 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/amd/default.nix @@ -0,0 +1,15 @@ +{ lib, ... }: + +{ + imports = [ ../24.05-compat.nix ]; + config = { + services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ]; + + hardware.graphics = { + enable = lib.mkDefault true; + enable32Bit = lib.mkDefault true; + }; + + hardware.amdgpu.initrd.enable = lib.mkDefault true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/amd/sea-islands/default.nix b/hosts/orion/ga403/common/gpu/amd/sea-islands/default.nix new file mode 100644 index 0000000..697e825 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/amd/sea-islands/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ ../. ]; + # Explicitly set amdgpu support in place of radeon + boot.kernelParams = [ "radeon.cik_support=0" "amdgpu.cik_support=1" ]; +} diff --git a/hosts/orion/ga403/common/gpu/amd/southern-islands/default.nix b/hosts/orion/ga403/common/gpu/amd/southern-islands/default.nix new file mode 100644 index 0000000..4939117 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/amd/southern-islands/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ ../. ]; + # Explicitly set amdgpu support in place of radeon + boot.kernelParams = [ "radeon.si_support=0" "amdgpu.si_support=1" ]; +} diff --git a/hosts/orion/ga403/common/gpu/intel/alder-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/alder-lake/default.nix new file mode 100644 index 0000000..eb5abe9 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/alder-lake/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ ../. ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/bay-trail/default.nix b/hosts/orion/ga403/common/gpu/intel/bay-trail/default.nix new file mode 100644 index 0000000..0b19cb7 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/bay-trail/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, ... }: + +{ + imports = [ ../. ]; + + hardware.intelgpu = { + vaapiDriver = "intel-vaapi-driver"; + enableHybridCodec = true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/braswell/default.nix b/hosts/orion/ga403/common/gpu/intel/braswell/default.nix new file mode 100644 index 0000000..0b19cb7 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/braswell/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, ... }: + +{ + imports = [ ../. ]; + + hardware.intelgpu = { + vaapiDriver = "intel-vaapi-driver"; + enableHybridCodec = true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/broadwell/default.nix b/hosts/orion/ga403/common/gpu/intel/broadwell/default.nix new file mode 100644 index 0000000..0b19cb7 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/broadwell/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, ... }: + +{ + imports = [ ../. ]; + + hardware.intelgpu = { + vaapiDriver = "intel-vaapi-driver"; + enableHybridCodec = true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/coffee-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/coffee-lake/default.nix new file mode 100644 index 0000000..55e71d2 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/coffee-lake/default.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + imports = [ ../. ]; + + boot.kernelParams = [ + "i915.enable_guc=2" + ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/comet-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/comet-lake/default.nix new file mode 100644 index 0000000..43ed1c4 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/comet-lake/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ "i915.enable_guc=2" ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/default.nix b/hosts/orion/ga403/common/gpu/intel/default.nix new file mode 100644 index 0000000..28c6e93 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/default.nix @@ -0,0 +1,86 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + imports = [ ../24.05-compat.nix ]; + + options.hardware.intelgpu = { + driver = lib.mkOption { + description = "Intel GPU driver to use"; + type = lib.types.enum [ + "i915" + "xe" + ]; + default = "i915"; + }; + + loadInInitrd = + lib.mkEnableOption "Load the Intel GPU kernel module at stage 1 boot. (Added to `boot.initrd.kernelModules`)" + // { + default = true; + }; + + vaapiDriver = lib.mkOption { + description = "Intel VAAPI driver to use (use null to use both)"; + type = lib.types.nullOr ( + lib.types.enum [ + "intel-vaapi-driver" + "intel-media-driver" + ] + ); + default = null; # Use both drivers when we don't know which one to use + }; + + enableHybridCodec = lib.mkEnableOption "hybrid codec support for Intel GPUs"; + }; + + config = + let + cfg = config.hardware.intelgpu; + + useIntelVaapiDriver = cfg.vaapiDriver == "intel-vaapi-driver" || cfg.vaapiDriver == null; + intel-vaapi-driver = (pkgs.intel-vaapi-driver or pkgs.vaapiIntel).override { + enableHybridCodec = cfg.enableHybridCodec; + }; + intel-vaapi-driver-32 = (pkgs.driversi686Linux.intel-vaapi-driver or pkgs.driversi686Linux.vaapiIntel).override { + enableHybridCodec = cfg.enableHybridCodec; + }; + + useIntelOcl = useIntelVaapiDriver && (config.hardware.enableAllFirmware or config.nixpkgs.config.allowUnfree or false); + intel-ocl = pkgs.intel-ocl; + + useIntelMediaDriver = cfg.vaapiDriver == "intel-media-driver" || cfg.vaapiDriver == null; + intel-media-driver = pkgs.intel-media-driver; + intel-media-driver-32 = pkgs.driversi686Linux.intel-media-driver; + intel-compute-runtime = pkgs.intel-compute-runtime; + vpl-gpu-rt = pkgs.vpl-gpu-rt or pkgs.onevpl-intel-gpu; + in + { + boot.initrd.kernelModules = lib.optionals cfg.loadInInitrd [ cfg.driver ]; + + hardware.graphics.extraPackages = + lib.optionals useIntelVaapiDriver [ intel-vaapi-driver ] + ++ lib.optionals useIntelOcl [ intel-ocl ] + ++ lib.optionals useIntelMediaDriver [ + intel-media-driver + intel-compute-runtime + vpl-gpu-rt + ]; + + hardware.graphics.extraPackages32 = + lib.optionals useIntelVaapiDriver [ intel-vaapi-driver-32 ] + ++ lib.optionals useIntelMediaDriver [ intel-media-driver-32 ]; + + assertions = [ + { + assertion = ( + cfg.driver != "xe" || lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.8" + ); + message = "Intel Xe GPU driver is not supported on kernels earlier than 6.8. Update or use the i915 driver."; + } + ]; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/disable.nix b/hosts/orion/ga403/common/gpu/intel/disable.nix new file mode 100644 index 0000000..46b6b01 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/disable.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + boot.blacklistedKernelModules = lib.mkDefault [ "i915" ]; + # KMS will load the module, regardless of blacklisting + boot.kernelParams = lib.mkDefault [ "i915.modeset=0" ]; +} diff --git a/hosts/orion/ga403/common/gpu/intel/elkhart-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/elkhart-lake/default.nix new file mode 100644 index 0000000..43ed1c4 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/elkhart-lake/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ "i915.enable_guc=2" ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/haswell/default.nix b/hosts/orion/ga403/common/gpu/intel/haswell/default.nix new file mode 100644 index 0000000..0b19cb7 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/haswell/default.nix @@ -0,0 +1,10 @@ +{ lib, pkgs, ... }: + +{ + imports = [ ../. ]; + + hardware.intelgpu = { + vaapiDriver = "intel-vaapi-driver"; + enableHybridCodec = true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/jasper-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/jasper-lake/default.nix new file mode 100644 index 0000000..43ed1c4 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/jasper-lake/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ "i915.enable_guc=2" ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/kaby-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/kaby-lake/default.nix new file mode 100644 index 0000000..a838669 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/kaby-lake/default.nix @@ -0,0 +1,11 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ + "i915.enable_guc=2" + "i915.enable_fbc=1" + "i915.enable_psr=2" + ]; + + hardware.intelgpu.vaapiDriver = "intel-media-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/lunar-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/lunar-lake/default.nix new file mode 100644 index 0000000..b232719 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/lunar-lake/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: +{ + imports = [ ../. ]; + hardware.intelgpu = { + driver = lib.mkIf (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.8") "xe"; + vaapiDriver = "intel-media-driver"; + }; +} diff --git a/hosts/orion/ga403/common/gpu/intel/sandy-bridge/default.nix b/hosts/orion/ga403/common/gpu/intel/sandy-bridge/default.nix new file mode 100644 index 0000000..51a6ba3 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/sandy-bridge/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ ../. ]; + + # Enables RC6, RC6p and RC6pp. + # Last two are only available on Sandy Bridge CPUs (circa 2011). + boot.kernelParams = [ "i915.enable_rc6=7" ]; + + hardware.intelgpu.vaapiDriver = "intel-vaapi-driver"; +} diff --git a/hosts/orion/ga403/common/gpu/intel/tiger-lake/default.nix b/hosts/orion/ga403/common/gpu/intel/tiger-lake/default.nix new file mode 100644 index 0000000..535dc49 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/intel/tiger-lake/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: +{ + imports = [ ../. ]; + config = { + boot.kernelParams = lib.mkIf (config.hardware.intelgpu.driver == "i915") [ "i915.enable_guc=3" ]; + hardware.intelgpu.vaapiDriver = "intel-media-driver"; + }; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/ada-lovelace/default.nix b/hosts/orion/ga403/common/gpu/nvidia/ada-lovelace/default.nix new file mode 100644 index 0000000..461ae91 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/ada-lovelace/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nvidiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the open source drivers if the package supports it + hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware); +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/ampere/default.nix b/hosts/orion/ga403/common/gpu/nvidia/ampere/default.nix new file mode 100644 index 0000000..461ae91 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/ampere/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nvidiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the open source drivers if the package supports it + hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware); +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/default.nix b/hosts/orion/ga403/common/gpu/nvidia/default.nix new file mode 100644 index 0000000..df28c06 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: + +{ + imports = [ ../24.05-compat.nix ]; + services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; + # TODO: this will be a default after https://github.com/NixOS/nixpkgs/pull/326369 + hardware.nvidia.modesetting.enable = lib.mkDefault true; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/disable.nix b/hosts/orion/ga403/common/gpu/nvidia/disable.nix new file mode 100644 index 0000000..6ea07ad --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/disable.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + # This runs only intel/amdgpu igpus and nvidia dgpus do not drain power. + + ##### disable nvidia, very nice battery life. + boot.extraModprobeConfig = '' + blacklist nouveau + options nouveau modeset=0 + ''; + + services.udev.extraRules = '' + # Remove NVIDIA USB xHCI Host Controller devices, if present + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" + + # Remove NVIDIA USB Type-C UCSI devices, if present + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1" + + # Remove NVIDIA Audio devices, if present + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1" + + # Remove NVIDIA VGA/3D controller devices + ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" + ''; + boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ]; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/kepler/default.nix b/hosts/orion/ga403/common/gpu/nvidia/kepler/default.nix new file mode 100644 index 0000000..f8d89a1 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/kepler/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: +{ + imports = [ ../. ]; + + # The open source driver does not support Kepler GPUs. + hardware.nvidia.open = false; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/maxwell/default.nix b/hosts/orion/ga403/common/gpu/nvidia/maxwell/default.nix new file mode 100644 index 0000000..8956509 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/maxwell/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: +{ + imports = [ ../. ]; + + # The open source driver does not support Maxwell GPUs. + hardware.nvidia.open = false; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/pascal/default.nix b/hosts/orion/ga403/common/gpu/nvidia/pascal/default.nix new file mode 100644 index 0000000..ad3555d --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/pascal/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: +{ + imports = [ ../. ]; + + # The open source driver does not support Pascal GPUs. + hardware.nvidia.open = false; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/prime-sync.nix b/hosts/orion/ga403/common/gpu/nvidia/prime-sync.nix new file mode 100644 index 0000000..897d716 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/prime-sync.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: + +{ + imports = [ ./. ]; + + hardware.nvidia.prime = { + # For people who want to use sync instead of offload. Especially for AMD CPU users + sync.enable = lib.mkOverride 990 true; + }; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/prime.nix b/hosts/orion/ga403/common/gpu/nvidia/prime.nix new file mode 100644 index 0000000..e54f942 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/prime.nix @@ -0,0 +1,13 @@ +{ lib, config, ... }: + +{ + imports = [ ./. ]; + + hardware.nvidia.prime = { + offload = { + enable = lib.mkOverride 990 true; + enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command. + }; + # Hardware should specify the bus ID for intel/nvidia devices + }; +} diff --git a/hosts/orion/ga403/common/gpu/nvidia/turing/default.nix b/hosts/orion/ga403/common/gpu/nvidia/turing/default.nix new file mode 100644 index 0000000..461ae91 --- /dev/null +++ b/hosts/orion/ga403/common/gpu/nvidia/turing/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nvidiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the open source drivers if the package supports it + hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware); +} diff --git a/hosts/orion/ga403/common/hidpi.nix b/hosts/orion/ga403/common/hidpi.nix new file mode 100644 index 0000000..ecf70a4 --- /dev/null +++ b/hosts/orion/ga403/common/hidpi.nix @@ -0,0 +1,18 @@ +{ + lib, + pkgs, + config, + ... +}: +let + # Starting with kernel 6.8, the console font is set in the kernel automatically to a 16x32 font: + # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dfd19a5004eff03755967086aa04254c3d91b8ec + oldKernel = lib.versionOlder config.boot.kernelPackages.kernel.version "6.8"; +in +{ + # Just set the console font, don't mess with the font settings + console.font = lib.mkIf oldKernel ( + lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz" + ); + console.earlySetup = lib.mkIf oldKernel (lib.mkDefault true); +} diff --git a/hosts/orion/ga403/common/pc/default.nix b/hosts/orion/ga403/common/pc/default.nix new file mode 100644 index 0000000..e56304b --- /dev/null +++ b/hosts/orion/ga403/common/pc/default.nix @@ -0,0 +1,7 @@ +{ config, lib, ... }: + +{ + boot.blacklistedKernelModules = lib.optionals (!config.hardware.enableRedistributableFirmware) [ + "ath3k" + ]; +} diff --git a/hosts/orion/ga403/common/pc/hdd/default.nix b/hosts/orion/ga403/common/pc/hdd/default.nix new file mode 100644 index 0000000..dbf7e66 --- /dev/null +++ b/hosts/orion/ga403/common/pc/hdd/default.nix @@ -0,0 +1,9 @@ +{ + warnings = [ + '' + DEPRECATED: The module has been deprecated. + + This module has no effect and will be removed in a future release. + '' + ]; +} diff --git a/hosts/orion/ga403/common/pc/laptop/default.nix b/hosts/orion/ga403/common/pc/laptop/default.nix new file mode 100644 index 0000000..9121b5f --- /dev/null +++ b/hosts/orion/ga403/common/pc/laptop/default.nix @@ -0,0 +1,11 @@ +{ config, lib, ... }: + +{ + imports = [ ../. ]; + + # Gnome 40 introduced a new way of managing power, without tlp. + # However, these 2 services clash when enabled simultaneously. + # https://github.com/NixOS/nixos-hardware/issues/260 + services.tlp.enable = lib.mkDefault ((lib.versionOlder (lib.versions.majorMinor lib.version) "21.05") + || !config.services.power-profiles-daemon.enable); +} diff --git a/hosts/orion/ga403/common/pc/laptop/hdd/default.nix b/hosts/orion/ga403/common/pc/laptop/hdd/default.nix new file mode 100644 index 0000000..78f918d --- /dev/null +++ b/hosts/orion/ga403/common/pc/laptop/hdd/default.nix @@ -0,0 +1,6 @@ +{ lib, ... }: + +{ + # Hard disk protection if the laptop falls: + services.hdapsd.enable = lib.mkDefault true; +} diff --git a/hosts/orion/ga403/common/pc/laptop/ssd b/hosts/orion/ga403/common/pc/laptop/ssd new file mode 120000 index 0000000..e313834 --- /dev/null +++ b/hosts/orion/ga403/common/pc/laptop/ssd @@ -0,0 +1 @@ +../ssd \ No newline at end of file diff --git a/hosts/orion/ga403/common/pc/ssd/default.nix b/hosts/orion/ga403/common/pc/ssd/default.nix new file mode 100644 index 0000000..c29d03b --- /dev/null +++ b/hosts/orion/ga403/common/pc/ssd/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + services.fstrim.enable = lib.mkDefault true; +} diff --git a/hosts/orion/ga403/default.nix b/hosts/orion/ga403/default.nix new file mode 100644 index 0000000..f061383 --- /dev/null +++ b/hosts/orion/ga403/default.nix @@ -0,0 +1,93 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) + mkDefault + mkForce + ; +in +{ + + imports = [ + ./common/cpu/amd + ./common/cpu/amd/pstate.nix + ./common/gpu/amd + ./common/pc/laptop + ./common/pc/ssd + ./common/gpu/nvidia/prime.nix + ./common/gpu/nvidia/ada-lovelace + ]; + + config = { + # # Configure basic system settings: + boot = { + # Note: it seems being on the latest kernel is important for CPPC to work, which is required for the amd_pstate + # https://bugzilla.kernel.org/show_bug.cgi?id=218686 + kernelPackages = pkgs.linuxPackages_xanmod; + kernelModules = [ "kvm-amd" ]; + kernelParams = [ + "mem_sleep_default=deep" + "pcie_aspm.policy=powersupersave" + ]; + }; + + services = { + asusd = { + enable = mkDefault true; + enableUserService = mkDefault true; + }; + + supergfxd.enable = mkDefault true; + }; + + # # Enable the Nvidia card, as well as Prime and Offload: NVIDIA GeForce RTX 4060 Mobile + boot.blacklistedKernelModules = [ "nouveau" ]; + + services.xserver.videoDrivers = mkForce [ + "amdgpu" + "nvidia" + ]; + + hardware = { + amdgpu.initrd.enable = mkDefault true; + + nvidia = { + modesetting.enable = true; + nvidiaSettings = mkDefault true; + + prime = { + offload = { + enable = mkDefault true; + enableOffloadCmd = mkDefault true; + }; + amdgpuBusId = "PCI:65:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + + powerManagement = { + enable = lib.mkForce true; + finegrained = lib.mkForce true; + }; + }; + }; + # Meditek doesn't seem to be quite sensitive enough on the default roaming settings: + # https://wiki.archlinux.org/title/Wpa_supplicant#Roaming + # https://wiki.archlinux.org/title/Iwd#iwd_keeps_roaming + # + # But NixOS doesn't have the tweaks for IWD, yet. + # networking.wireless.iwd.settings = + # lib.mkIf (config.networking.wireless.iwd.enable && config.networking.wireless.scanOnLowSignal) + # { + # General = { + # RoamThreshold = -75; + # RoamThreshold5G = -80; + # RoamRetryInterval = 20; + # }; + # }; + }; +} diff --git a/modules/apps/atuin/default.nix b/modules/apps/atuin/default.nix new file mode 100644 index 0000000..b19e90e --- /dev/null +++ b/modules/apps/atuin/default.nix @@ -0,0 +1,41 @@ +{ + lib, + config, + username, + ... +}: +let + cfg = config.atuin; +in +{ + options = { + atuin = { + enable = lib.mkEnableOption "Enable atuin in NixOS & home-manager"; + }; + }; + config = lib.mkIf cfg.enable { + home-manager.users.${username} = { + programs.atuin = { + enable = true; + settings = { + history_filter = [ + "^btop$" + "^bash$" + "^cd$" + "^clear$" + "^exit$" + "^fastfetch$" + "^kmon$" + "^l$" + "^ll$" + "^pwd$" + "^up$" + "^nor$" + "^ngc$" + "^rbn$" + ]; + }; + }; + }; + }; +} diff --git a/modules/apps/default.nix b/modules/apps/default.nix index 001e866..597e13f 100644 --- a/modules/apps/default.nix +++ b/modules/apps/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./atuin ./coolercontrol ./direnv ./gamemode @@ -7,10 +8,13 @@ ./git ./hyprland ./lact + ./lsd ./mangohud + ./nh ./obs ./steam ./sunshine ./vscode + ./zsh ]; } diff --git a/modules/apps/hyprland/default.nix b/modules/apps/hyprland/default.nix index 151def6..b1ecbc5 100644 --- a/modules/apps/hyprland/default.nix +++ b/modules/apps/hyprland/default.nix @@ -53,8 +53,8 @@ with lib; exec-once = lxqt-policykit-agent exec-once = [workspace special silent] foot exec-once = sleep 1.5 && swww img /home/${username}/Pictures/Wallpapers/pink-desert.jpeg - ${builtins.toString config.desktop.hostMonitorSettings} monitor = Unknown-1, disable + ${builtins.toString config.desktop.hostSettings} exec-once = ${terminal} general { gaps_in = 6 @@ -202,8 +202,8 @@ with lib; bindm = ${modifier},mouse:273,resizewindow bind = ALT,Tab,cyclenext bind = ALT,Tab,bringactivetotop - bind = ,XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ - bind = ,XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + bind = ,XF86AudioRaiseVolume,exec,wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 && wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + bind = ,XF86AudioLowerVolume,exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 && wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- binde = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bind = ,XF86AudioPlay, exec, playerctl play-pause bind = ,XF86AudioPause, exec, playerctl play-pause diff --git a/modules/apps/lsd/default.nix b/modules/apps/lsd/default.nix new file mode 100644 index 0000000..6f6721b --- /dev/null +++ b/modules/apps/lsd/default.nix @@ -0,0 +1,39 @@ +{ + lib, + config, + username, + ... +}: +let + cfg = config.lsd; +in +{ + options = { + lsd = { + enable = lib.mkEnableOption "Enable lsd in NixOS & home-manager"; + }; + }; + config = lib.mkIf cfg.enable { + home-manager.users.${username} = { + programs.lsd = { + enable = true; + settings = { + color = { + when = "always"; + }; + icons = { + when = "always"; + theme = "fancy"; + separator = " "; + }; + layout = "oneline"; + size = "short"; + permission = "rwx"; + hyperlink = "never"; + no-symlink = false; + symlink-arrow = "⇒"; + }; + }; + }; + }; +} diff --git a/modules/apps/nh/default.nix b/modules/apps/nh/default.nix new file mode 100644 index 0000000..e9eb797 --- /dev/null +++ b/modules/apps/nh/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + username, + ... +}: +let + cfg = config.nh; +in +{ + options = { + nh = { + enable = lib.mkEnableOption "Enable nh in NixOS & home-manager"; + }; + }; + config = lib.mkIf cfg.enable { + programs.nh = { + enable = true; + flake = "/home/ryan/.nixos-config"; + }; + home-manager.users.${username} = { }; + }; +} diff --git a/modules/apps/zsh/default.nix b/modules/apps/zsh/default.nix new file mode 100644 index 0000000..31f4f8c --- /dev/null +++ b/modules/apps/zsh/default.nix @@ -0,0 +1,75 @@ +{ + lib, + config, + username, + ... +}: +let + cfg = config.zsh; +in +{ + options = { + zsh = { + enable = lib.mkEnableOption "Enable zsh in NixOS"; + }; + }; + config = lib.mkIf cfg.enable { + programs = { + zsh.enable = true; + }; + home-manager.users.${username} = + { + inputs, + config, + pkgs, + ... + }: + { + programs.zsh = { + enable = true; + autosuggestion.enable = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + dotDir = ".config/zsh"; + history = { + path = "${config.xdg.dataHome}/zsh/zsh_history"; + size = 999999999; + extended = true; + ignoreSpace = true; + }; + /* + initExtra = '' + export GITHUB_TOKEN="$(cat ${config.sops.secrets."github_token".path})" + ''; + */ + oh-my-zsh = { + enable = true; + custom = "${config.xdg.configHome}/zsh/.zsh_custom"; + plugins = [ + "command-not-found" + "direnv" + "git" + "sudo" + ]; + }; + plugins = [ + { + name = "cd-ls"; + src = inputs.cd-ls; + file = "cd-ls.plugin.zsh"; + } + { + name = "zsh-fast-syntax-highlighting"; + src = pkgs.zsh-fast-syntax-highlighting; + file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; + } + { + name = "nix-zsh-completions"; + src = pkgs.nix-zsh-completions; + file = "share/zsh/site-functions/nix-zsh-completions.plugin.zsh"; + } + ]; + }; + }; + }; +} diff --git a/modules/components/boot/default.nix b/modules/components/boot/default.nix index e02806d..a8e86b6 100644 --- a/modules/components/boot/default.nix +++ b/modules/components/boot/default.nix @@ -21,7 +21,7 @@ "vm.swappiness" = 10; }; }; - kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_latest; kernelParams = [ "nowatchdog" "zswap.enabled=0" diff --git a/modules/components/nvidia/default.nix b/modules/components/nvidia/default.nix index af7645a..e0ba11c 100644 --- a/modules/components/nvidia/default.nix +++ b/modules/components/nvidia/default.nix @@ -23,7 +23,11 @@ in "nvidia_drm" ]; boot.blacklistedKernelModules = [ "nouveau" ]; - boot.kernelParams = [ "nvidia_drm.fbdev=1" "nvidia-drm.modeset=1" "module_blacklist=nouveau" ]; + boot.kernelParams = [ + "nvidia_drm.fbdev=1" + "nvidia-drm.modeset=1" + "module_blacklist=nouveau" + ]; environment.systemPackages = with pkgs; [ (writeShellScriptBin "nvidia-offload" '' export __NV_PRIME_RENDER_OFFLOAD=1 @@ -42,7 +46,7 @@ in open = true; nvidiaPersistenced = true; nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.latest; + package = lib.mkForce config.boot.kernelPackages.nvidiaPackages.latest; }; }; diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index 08309f0..2aac957 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -17,7 +17,7 @@ in config = lib.mkIf cfg.enable { # Custom modules # Apps - # atuin.enable = true; + atuin.enable = true; # bash.enable = true; # bat.enable = true; # boxxy.enable = true; @@ -35,10 +35,10 @@ in # jujutsu.enable = true; # keyd.enable = false; # lazygit.enable = true; - # lsd.enable = true; + lsd.enable = true; # mullvad.enable = true; # navi.enable = true; - # nh.enable = true; + nh.enable = true; # nix-ld.enable = true; # nix-index.enable = true; # nushell.enable = true; @@ -54,7 +54,7 @@ in # yt-dlp.enable = true; # zen-browser.enable = true; # zoxide.enable = true; - # zsh.enable = true; + zsh.enable = true; # System # flatpak.enable = true; diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix index 2fc52aa..30b3c0c 100644 --- a/modules/profiles/desktop.nix +++ b/modules/profiles/desktop.nix @@ -17,7 +17,7 @@ in options = { desktop = { enable = lib.mkEnableOption "Enable desktop in NixOS"; - hostMonitorSettings = lib.mkOption { + hostSettings = lib.mkOption { type = lib.types.str; default = "hostMonitorSettings"; }; @@ -116,6 +116,7 @@ in # Utilities networkmanagerapplet swaynotificationcenter + brightnessctl ]; xdg = { mimeApps = @@ -175,8 +176,8 @@ in }; # Services to start services = { - displayManager.sddm.enable = true; - displayManager.sddm.wayland.enable = true; + displayManager.sddm.enable = true; + displayManager.sddm.wayland.enable = true; xserver = { enable = false; xkb = { diff --git a/users/ryan/default.nix b/users/ryan/default.nix index 99e19d3..f9f8ad7 100644 --- a/users/ryan/default.nix +++ b/users/ryan/default.nix @@ -1,6 +1,7 @@ { lib, config, + pkgs, ... }: let @@ -16,19 +17,31 @@ in }; }; config = lib.mkIf cfg.enable { - users.users = { - ${username} = { - initialPassword = "'"; - isNormalUser = true; - extraGroups = [ - "wheel" - ]; - }; + users = { + defaultUserShell = pkgs.zsh; + users = { + ${username} = { + initialPassword = "'"; + isNormalUser = true; + extraGroups = [ + "adbusers" + "audio" + "input" + "networkmanager" + "plugdev" + "realtime" + "uinput" + "video" + "dialout" + "wheel" + ]; }; + }; + }; home-manager.users.${username} = { pkgs, ... }: { - home.stateVersion = "23.11"; + home.stateVersion = "23.11"; }; }; -} \ No newline at end of file +}