From 535b8c5230507c49881c1066406b4cf37edf810a Mon Sep 17 00:00:00 2001 From: Lauren Lagarde Date: Tue, 10 Jun 2025 21:45:44 -0500 Subject: [PATCH] Various improvements to ll-latitude-e5591 --- features/embedded.nix | 2 +- features/gpu/nvidia.nix | 6 ++++- features/tui-apps.nix | 2 +- systems/ll-latitude-e5591.nix | 47 ++++++++++++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/features/embedded.nix b/features/embedded.nix index 8633ca0..3a464b5 100644 --- a/features/embedded.nix +++ b/features/embedded.nix @@ -16,7 +16,7 @@ esptool stlink stlink-gui - (kicad-small.override { addons=[kicadAddons.kikit kicadAddons.kikit-library]; }) + (pkgs-unstable.kicad.override { addons=[pkgs-unstable.kicadAddons.kikit pkgs-unstable.kicadAddons.kikit-library]; }) kikit screen prusa-slicer diff --git a/features/gpu/nvidia.nix b/features/gpu/nvidia.nix index e0dda2d..1866605 100644 --- a/features/gpu/nvidia.nix +++ b/features/gpu/nvidia.nix @@ -2,16 +2,20 @@ { config, ... }: { # Enable OpenGL hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; # Load nvidia driver for Xorg and Wayland services.xserver.videoDrivers = ["nvidia"]; + # Fix stupid UI scaling bug + services.xserver.dpi = 96; + hardware.nvidia = { # Modesetting is required. modesetting.enable = true; # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = true; + 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). diff --git a/features/tui-apps.nix b/features/tui-apps.nix index b888404..5a9d45c 100644 --- a/features/tui-apps.nix +++ b/features/tui-apps.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ # Basic Utilities - bc pv killall unzip unrar-wrapper unar units + bc pv killall zip unzip unrar-wrapper unar units # System Monitoring / TUI QoL Tools btop iotop tmux byobu diff --git a/systems/ll-latitude-e5591.nix b/systems/ll-latitude-e5591.nix index f2c90c8..989d752 100644 --- a/systems/ll-latitude-e5591.nix +++ b/systems/ll-latitude-e5591.nix @@ -24,12 +24,14 @@ # Dotspace ../secrets/dotspace.nix + ../secrets/dotspace_shares.nix ../features/stronghold-binary-cache.nix # Additional Software ../features/embedded.nix ../features/hardware/rtl-sdr.nix ../features/hardware/printing.nix + ../tweaks/aarch64-crosscompile.nix ../features/virtualization/docker.nix ../features/virtualization/libvirt-host.nix @@ -39,12 +41,32 @@ ../features/factorio.nix ]; + specialisation = { + nvidia.configuration = { + system.nixos.tags = [ "nvidia" ]; + + imports = [ + ../features/gpu/nvidia.nix + ]; + + hardware.nvidia.prime = { + sync.enable = true; + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + }; + hardware.enableRedistributableFirmware = true; + boot.initrd.kernelModules = [ "i915" ]; # Makes external monitors boot better boot.kernelParams = [ "i915.enable_guc=2" ]; + services.autorandr.enable = true; + services.udev.packages = with pkgs; [ autorandr ]; + # TODO: Not quite enough for hibernation while zram is still enabled #swapDevices = [{ # device = "/var/lib/swapfile"; @@ -57,7 +79,30 @@ # Tinc Stuff # TODO: Less hacky - services.tinc.networks.mlaga97space = { + networking.firewall.allowedTCPPorts = [ 655 ]; + networking.firewall.allowedUDPPorts = [ 655 ]; + + networking.interfaces."tinc.dotspace".ipv4 = { + addresses = [{ + address = "10.86.84.250"; + prefixLength = 32; + }]; + routes = [{ + address = "10.86.84.0"; + prefixLength = 24; + }]; + }; + + # Start the unit for adding addresses if Tinc is started + systemd.services."tinc.dotspace".wants = [ "network-addresses-tinc.dotspace.service" ]; + + # Stop the unit for adding addresses if Tinc is stopped or restarted + systemd.services."network-addresses-tinc.dotspace".partOf = [ "tinc.dotspace.service" ]; + + # Start the unit for adding addresses after the Tinc device is added + systemd.services."network-addresses-tinc.dotspace".after = [ "sys-subsystem-net-devices-tinc.dotspace.device" ]; + + services.tinc.networks.dotspace = { name = "ll_latitude_e5591"; ed25519PrivateKeyFile = "/root/tinc/mlaga97space_ed25519_key.priv";