From dc1786823577daa8486574eba34f14917aa7681b Mon Sep 17 00:00:00 2001 From: noe Date: Thu, 2 Jan 2025 18:32:25 -0800 Subject: [PATCH] retrobox --- flake.nix | 2 +- home-manager/features/retroarch.nix | 14 ++++++-- home-manager/noe/hosts/retrobox.nix | 15 +++++++++ nixos/features/amd.nix | 12 ++++--- nixos/hosts/retrobox/.target | 1 + nixos/hosts/retrobox/default.nix | 32 ++++++++++++++++++ .../hosts/retrobox/hardware-configuration.nix | 33 +++++++++++++++++++ nixos/hosts/unicorn/default.nix | 27 ++++++++++++++- 8 files changed, 127 insertions(+), 9 deletions(-) create mode 100644 home-manager/noe/hosts/retrobox.nix create mode 100644 nixos/hosts/retrobox/.target create mode 100644 nixos/hosts/retrobox/default.nix create mode 100644 nixos/hosts/retrobox/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index ef90d47..895318b 100644 --- a/flake.nix +++ b/flake.nix @@ -182,10 +182,10 @@ plex = mkNixos [ ./nixos/hosts/plex ]; # plex porcelain-doll-repair = mkNixos [ ./nixos/hosts/porcelain-doll-repair ]; # Iceshrimp+Withdrawl, porcelain.doll.repair ps2live = mkNixos [ ./nixos/hosts/ps2live ]; # PS2.LIVE stack + planetside stuff + retrobox = mkNixos [ ./nixos/hosts/retrobox ]; # lil rpi sapphic-engineer = mkNixos [ ./nixos/hosts/sapphic-engineer ]; # Akkoma, sapphic.engineer seedbox = mkNixos [ ./nixos/hosts/seedbox ]; # fuck static-sites = mkNixos [ ./nixos/hosts/static-sites ]; # nginx specifically for static sites - streambox = mkNixos [ ./nixos/hosts/streambox ]; # lil rpi thonkpad = mkNixos [ ./nixos/hosts/thonkpad ]; # t480 ts3 = mkNixos [ ./nixos/hosts/ts3 ]; # Teamspeak-san unicorn = mkNixos [ ./nixos/hosts/unicorn ]; # legion thingy diff --git a/home-manager/features/retroarch.nix b/home-manager/features/retroarch.nix index 106c9e2..7eb42fa 100644 --- a/home-manager/features/retroarch.nix +++ b/home-manager/features/retroarch.nix @@ -1,15 +1,23 @@ -{ pkgs, ... }: { +{ pkgs, lib, config, ... }: { + home.activation.retroarch-config-link = lib.hm.dag.entryAfter ["writeBoundary"] '' + run ln -s $VERBOSE_ARG \ + ${builtins.toPath /mnt/nas0/noe/games/retroarch} \ + $HOME/.config/retroarch + ''; + home.packages = [ (pkgs.retroarch.withCores ( cores: with cores; [ - pcsx2 ppsspp snes9x dolphin mupen64plus desmume vba-m - ] + ] ++ (if pkgs.system == "x86_64-linux" then [ + # stuff that doesn't happen on ARM + pcsx2 + ] else []) )) ]; } diff --git a/home-manager/noe/hosts/retrobox.nix b/home-manager/noe/hosts/retrobox.nix new file mode 100644 index 0000000..31200ca --- /dev/null +++ b/home-manager/noe/hosts/retrobox.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: { + imports = [ + ../common + ../common/home-user.nix + + ../../features/kitty.nix + ../../features/retroarch.nix + ]; + + home.packages = with pkgs; [ + vlc + ]; + + programs.kitty.settings.font_size = 12; +} diff --git a/nixos/features/amd.nix b/nixos/features/amd.nix index bc52f0c..4658dad 100644 --- a/nixos/features/amd.nix +++ b/nixos/features/amd.nix @@ -1,5 +1,9 @@ -{ ... }: { - boot.initrd.kernelModules = [ "amdgpu" ]; - - services.xserver.videoDrivers = [ "amdgpu" ]; +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + glxinfo + clinfo + virtualglLib + vulkan-loader + vulkan-tools + ]; } diff --git a/nixos/hosts/retrobox/.target b/nixos/hosts/retrobox/.target new file mode 100644 index 0000000..c4b6766 --- /dev/null +++ b/nixos/hosts/retrobox/.target @@ -0,0 +1 @@ +root@10.100.0.94 diff --git a/nixos/hosts/retrobox/default.nix b/nixos/hosts/retrobox/default.nix new file mode 100644 index 0000000..a402ce5 --- /dev/null +++ b/nixos/hosts/retrobox/default.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: { + imports = [ + ./hardware-configuration.nix + ../../client-lite.nix + + ../../features/dns-cache.nix + ../../features/nas0.nix + ../../features/xfce.nix + ../../features/sound + ../../features/tailscale.nix + ../../features/telemetry + ../../features/wifi.nix + ]; + + home-manager.users.noe = import ../../../home-manager/noe/hosts/retrobox.nix; + + networking.hostName = "retrobox"; + system.stateVersion = "25.05"; + + internal.nas0.useSMB = true; + + hardware.enableRedistributableFirmware = true; + + boot = { + # kernelPackages = pkgs.linuxKernel.packages.linux_rpi4; + initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ]; + loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + }; +} diff --git a/nixos/hosts/retrobox/hardware-configuration.nix b/nixos/hosts/retrobox/hardware-configuration.nix new file mode 100644 index 0000000..77cefe1 --- /dev/null +++ b/nixos/hosts/retrobox/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; + 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.end0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; +} diff --git a/nixos/hosts/unicorn/default.nix b/nixos/hosts/unicorn/default.nix index ceed817..ef9ede8 100644 --- a/nixos/hosts/unicorn/default.nix +++ b/nixos/hosts/unicorn/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: { +{ pkgs, config, inputs, ... }: { imports = [ ./hardware-configuration.nix ../../client.nix @@ -14,6 +14,13 @@ ../../features/tailscale.nix ../../features/telemetry ../../features/wifi.nix + + inputs.nixos-hardware.nixosModules.common-cpu-amd + inputs.nixos-hardware.nixosModules.common-gpu-amd + inputs.nixos-hardware.nixosModules.common-gpu-nvidia # prime + inputs.nixos-hardware.nixosModules.common-pc-laptop + inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd + inputs.nixos-hardware.nixosModules.common-hidpi ]; home-manager.users.noe = import ../../../home-manager/noe/hosts/unicorn.nix; @@ -24,4 +31,22 @@ internal.nas0.useSMB = true; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + hardware.nvidia.open = false; + hardware.nvidia.modesetting.enable = true; + hardware.nvidia.prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + amdgpuBusId = "PCI:5:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + + environment.systemPackages = with pkgs; [ + openrgb + ]; + + # √(2560² + 1600²) px / 16 in ≃ 189 dpi + services.xserver.dpi = 189; }