From 3ddbee8cbc9033887a62e1397a72185988355d61 Mon Sep 17 00:00:00 2001 From: 514fpv Date: Sat, 27 Jul 2024 18:18:35 +0800 Subject: [PATCH] spec(hakugyokurou): initial configuration --- global/auth/pub/hakugyokurou.pub | 1 + spec/hakugyokurou/default.nix | 65 ++++++++++++++++++++++ spec/hakugyokurou/jovian.nix | 93 ++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 global/auth/pub/hakugyokurou.pub create mode 100644 spec/hakugyokurou/default.nix create mode 100644 spec/hakugyokurou/jovian.nix diff --git a/global/auth/pub/hakugyokurou.pub b/global/auth/pub/hakugyokurou.pub new file mode 100644 index 00000000..4fa391d2 --- /dev/null +++ b/global/auth/pub/hakugyokurou.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHKCA0/6dsdVyLEgzWt8+u5lWVc0o6A3MY4M2Hf2BT8h koishi@hakugyokurou diff --git a/spec/hakugyokurou/default.nix b/spec/hakugyokurou/default.nix new file mode 100644 index 00000000..8d49af87 --- /dev/null +++ b/spec/hakugyokurou/default.nix @@ -0,0 +1,65 @@ +{ pkgs, lib, config, ... }: { + global = { + id = "09a2900f15b74f36b023a9ebcd539f6a"; + fs.esp.uuid = "AE73-B83E"; + fs.type = "xfs"; + fs.store = "e4c673cb-03c5-44ac-b2f1-1085a7f7a553"; + fs.cryptsetup.enable = true; + fs.cryptsetup.uuids.persist = "122001b1-7a43-4bab-ae7c-ba8eeb1cc864"; + boot.lanzaboote = true; + gpu.enable = true; + gpu.type = "amdgpu"; + }; + + home = { + jetbrains.enable = true; + vscode.enable = true; + minecraft.enable = true; + minecraft.user = "app"; + }; + + users.homeModules = [ { + wayland.windowManager.sway.config = { + input = { + "9610:30:HID_258a:001e_Mouse".natural_scroll = "disabled"; + "1539:61441:NVTK0603:00_0603:F001_UNKNOWN".map_to_output = "eDP-1"; + "1539:61441:NVTK0603:00_0603:F001".map_to_output = "eDP-1"; + }; + output = { + eDP-1.scale = "2"; + eDP-1.transform = "270"; + }; + }; + } ]; + + powerManagement.enable = true; + powerManagement.cpuFreqGovernor = "performance"; + boot.kernelParams = [ + "video=eDP-1:panel_orientation=left_side_up" + ]; + + jovian.steamos.useSteamOSConfig = lib.mkDefault false; + services.greetd.settings.default_session.command = let + cfg = config.programs.regreet; + in lib.mkOverride 999 "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${pkgs.writeShellScript "cageResolution" '' + ${lib.getExe pkgs.wlr-randr} --output eDP-1 --scale 2 --transform 90 + ${lib.getExe cfg.package} + ''}"; + environment.systemPackages = with pkgs; [ + (writeShellScriptBin "sway-logout" '' + ${systemd}/bin/systemctl --user unset-environment WAYLAND_DISPLAY SWAYSOCK + ${sway}/bin/swaymsg exit + '') + ]; + + hardware.enableRedistributableFirmware = true; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + hardware.cpu.intel.updateMicrocode = true; + + imports = [ + ./jovian.nix + ]; +} diff --git a/spec/hakugyokurou/jovian.nix b/spec/hakugyokurou/jovian.nix new file mode 100644 index 00000000..a50e3a40 --- /dev/null +++ b/spec/hakugyokurou/jovian.nix @@ -0,0 +1,93 @@ +{ pkgs, lib, config, jovian, ... }: with lib; { + specialisation.steamos.configuration = { + jovian = { + hardware.has.amd.gpu = true; + steamos.useSteamOSConfig = true; + steamos.enableDefaultCmdlineConfig = false; + + steam = { + enable = true; + autoStart = true; + desktopSession = "plasma"; + user = "app"; + }; + }; + + users.home.persistApp.directories = [ + ".steam" ".local/share/Steam" + ".config/gamescope" ".config/hhd" + ".kodi" + ]; + + users.users.app.extraGroups = [ "networkmanager" "gamemode" ]; + programs.gamemode.enable = true; + programs.regreet.enable = false; + home.plasma.enable = true; + home.plasma.extraConfig = { + configFile = { + kwinrc.Xwayland.Scale = 1.75; + kscreenlockerrc.Daemon.Autolock = false; + }; + }; + + home-manager.users.app = { + home.packages = with pkgs; [ + (pkgs.kodi-wayland.passthru.withPackages (kodiPkgs: with kodiPkgs; [ + joystick # keymap steam-controller + #controller-topology-project + libretro libretro-2048 + libretro-fuse libretro-genplus libretro-mgba + libretro-nestopia libretro-snes9x + jellycon + ])) + ]; + + home.pointerCursor = { + package = pkgs.steamdeck-hw-theme; + name = "steam"; + }; + }; + + services.handheld-daemon = { + enable = true; + user = "app"; + }; + + jovian.decky-loader = { + # ~/.steam/steam/.cef-enable-remote-debugging + enable = true; + user = "app"; + extraPackages = with pkgs; [ + curl unzip util-linux gnugrep procps pciutils kmod ryzenadj + ]; + extraPythonPackages = pythonPackages: with pythonPackages; [ + hid pyyaml + ]; + stateDir = "/nix/persist/decky"; + }; + + boot.kernelParams = [ + "iomem=relaxed" + "amd_pstate=passive" + ]; + boot.plymouth.themePackages = [ pkgs.steamdeck-hw-theme ]; + boot.plymouth.theme = "steamos"; + + services.udev.extraRules = '' + SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --max-performance" + ''; + + nixpkgs.overlays = [ (final: prev: { + gamescope = prev.gamescope.overrideAttrs (finalAttrs: previousAttrs: { + postInstall = previousAttrs.postInstall + "\n" + '' + wrapProgram "$out/bin/gamescope" \ + --append-flags "--force-orientation left" + ''; + }); + }) ]; + }; + + imports = [ + jovian.nixosModules.jovian + ]; +}