From 07bb34601b5764c8beeb63559426ad3f609a3ac7 Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 29 Oct 2024 22:46:21 +0100 Subject: lernaeus config --- nix/hosts/lernaeus/configuration.nix | 150 ++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) (limited to 'nix/hosts') diff --git a/nix/hosts/lernaeus/configuration.nix b/nix/hosts/lernaeus/configuration.nix index 26444e7..57cacb9 100644 --- a/nix/hosts/lernaeus/configuration.nix +++ b/nix/hosts/lernaeus/configuration.nix @@ -4,7 +4,6 @@ { config, - lib, pkgs, ... }: @@ -21,6 +20,130 @@ in ./hardware-configuration.nix ]; + ################## + # sound + + sound.enable = true; + + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; ## If compatibility with 32-bit applications is desired. + + users.extraUsers.emile.extraGroups = [ "audio" ]; + + ################## + # nvidia foo + + nixpkgs.config = { + allowBroken = true; + allowUnfree = true; + }; + + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + # Modesetting is required. + 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 = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + ################## + # xserver foo + + environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw + + services.displayManager.defaultSession = "none+i3"; + + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + }; + + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu # application launcher most people use + i3status # gives you the default i3 status bar + i3lock # default i3 screen locker + i3blocks # if you are planning on using i3blocks over i3status + ]; + }; + }; + + ######### + # sunshine foo + + services.sunshine = { + enable = true; + package = pkgs.sunshine; + autoStart = true; + + # Whether to give the Sunshine binary CAP_SYS_ADMIN, required for DRM/KMS screen capture. + capSysAdmin = true; + + # https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/advanced_usage.html#configuration + # settings + + openFirewall = true; + + # applications.env + # applications.apps + # applications + }; + + ################ + # steam foo + + programs.steam = { + enable = true; + gamescopeSession.enable = true; + }; + + programs.gamemode.enable = true; + + ################ + # bluetooth + + hardware.bluetooth.enable = true; # enables support for Bluetooth + hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot + services.blueman.enable = true; + + ################ + boot = { loader.systemd-boot.enable = true; kernelParams = [ "ip=dhcp" ]; @@ -41,6 +164,9 @@ in }; }; + boot.initrd.kernelModules = [ "nvidia" ]; + boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; + fileSystems = { "/".options = [ "compress=zstd" ]; "/home".options = [ "compress=zstd" ]; @@ -76,8 +202,22 @@ in environment.systemPackages = with pkgs; [ vim tailscale + kitty + firefox + htop + + steam + mangohud + sunshine + lutris + + protonup ]; + environment.sessionVariables = { + STEAM_EXTRA_COMPAT_TOOLS_PATH = "/home/emile/.steam/root/compatibilitytools.d"; + }; + programs.mosh.enable = true; services = { @@ -105,7 +245,15 @@ in }; settings = { auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; }; + + extraOptions = '' + extra-platforms = aarch64-linux, x86_64-linux, i686-linux + ''; }; system = { -- cgit 1.4.1