From 8534c96c666043997450b443e461227ff2671342 Mon Sep 17 00:00:00 2001 From: macronova Date: Sun, 3 Mar 2024 00:11:51 -0800 Subject: [PATCH] Enable RetroArch on Steam Deck --- common/constants.nix | 39 ++++++++++++++++++++----------- common/users.nix | 10 ++++++++ flake.lock | 36 ++++++++++++++-------------- linux/blitzar/default.nix | 3 +-- linux/blitzar/gui.nix | 1 - linux/blitzar/syncthing.nix | 28 ++++++---------------- linux/comet/default.nix | 3 +-- linux/nebula/default.nix | 3 +-- linux/nebula/network.nix | 1 - linux/nebula/syncthing.nix | 28 ++++++---------------- linux/protostar/configuration.nix | 11 +++++---- linux/protostar/default.nix | 4 ++-- linux/protostar/gui.nix | 28 +++++++++++++++------- linux/protostar/locale.nix | 16 +++++++++++++ linux/protostar/network.nix | 9 +++++-- linux/protostar/syncthing.nix | 14 ++--------- linux/singularity/default.nix | 6 ++--- 17 files changed, 127 insertions(+), 113 deletions(-) create mode 100644 linux/protostar/locale.nix diff --git a/common/constants.nix b/common/constants.nix index 3feeed1..2d940a8 100644 --- a/common/constants.nix +++ b/common/constants.nix @@ -16,13 +16,6 @@ with lib; { The home directory for the default user. ''; }; - wildcard = mkOption { - type = types.str; - default = "0.0.0.0"; - description = '' - The localhost address. - ''; - }; localhost = mkOption { type = types.str; default = "127.0.0.1"; @@ -52,6 +45,13 @@ with lib; { The post master email address. ''; }; + privateKeyFiles = mkOption { + type = types.listOf types.str; + default = if config.services.openssh.enable then builtins.map (key: key.path) config.services.openssh.hostKeys else [ "/root/.ssh/${config.networking.hostName}" ]; + description = '' + The private key files for sops. + ''; + }; publicKeys = mkOption { type = types.listOf types.str; default = [ @@ -61,13 +61,6 @@ with lib; { The public keys for SSH authentication. ''; }; - privateKeyFiles = mkOption { - type = types.listOf types.str; - default = if config.services.openssh.enable then builtins.map (key: key.path) config.services.openssh.hostKeys else [ "/root/.ssh/${config.networking.hostName}" ]; - description = '' - The private key files for sops. - ''; - }; sopsFile = mkOption { type = types.path; default = ./secrets.yaml; @@ -75,6 +68,17 @@ with lib; { The secrets file for device. ''; }; + syncthingDevices = mkOption { + type = types.attrsOf (types.attrsOf types.str); + default = { + blitzar.id = "KGCBCIZ-GG6KMQ2-FLK5BWW-GLCEDML-5LCI24S-UKO5UWL-HWNCPYX-ZWWD5AQ"; + nebula.id = "NJXA5XS-2PSWECD-UHBV7JH-IR2RSWY-PRUPFTZ-AHL7IN6-RXSLZKB-2FUNRQH"; + protostar.id = "MEEIJ3F-NYIB55Y-SDCWCLX-6XOR6YU-OQO477W-JAPG6F6-LRBGBGG-FENYPQE"; + }; + description = '' + The device information for syncthing + ''; + }; userName = mkOption { type = types.str; default = "macronova"; @@ -82,5 +86,12 @@ with lib; { The username across all devices. ''; }; + wildcard = mkOption { + type = types.str; + default = "0.0.0.0"; + description = '' + The localhost address. + ''; + }; }; } diff --git a/common/users.nix b/common/users.nix index 365bb28..42330a3 100644 --- a/common/users.nix +++ b/common/users.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: let + home = config.constants.homeDir; usr = config.constants.userName; usrPwdFile = "users/${usr}/password"; in @@ -89,6 +90,15 @@ in }; }; resolved.enable = true; + syncthing = { + configDir = "${home}/.config/syncthing"; + dataDir = "${home}/.local/share/syncthing"; + openDefaultPorts = true; + overrideDevices = true; + overrideFolders = true; + settings.devices = config.constants.syncthingDevices; + user = usr; + }; }; sops.secrets.${usrPwdFile}.neededForUsers = true; diff --git a/flake.lock b/flake.lock index 83cd347..9712020 100644 --- a/flake.lock +++ b/flake.lock @@ -21,11 +21,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1709286488, - "narHash": "sha256-RDpTZ72zLu05djvXRzK76Ysqp9zSdh84ax/edEaJucs=", + "lastModified": 1709439398, + "narHash": "sha256-MW0zp3ta7SvdpjvhVCbtP20ewRwQZX2vRFn14gTc4Kg=", "owner": "nix-community", "repo": "disko", - "rev": "bde7dd352c07d43bd5b8245e6c39074a391fdd46", + "rev": "1f76b318aa11170c8ca8c225a9b4c458a5fcbb57", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "hardware": { "locked": { - "lastModified": 1709147990, - "narHash": "sha256-vpXMWoaCtMYJ7lisJedCRhQG9BSsInEyZnnG5GfY9tQ=", + "lastModified": 1709410583, + "narHash": "sha256-esOSUoQ7mblwcsSea0K17McZuwAIjoS6dq/4b83+lvw=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "33a97b5814d36ddd65ad678ad07ce43b1a67f159", + "rev": "59e37017b9ed31dee303dbbd4531c594df95cfbc", "type": "github" }, "original": { @@ -88,11 +88,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1709204054, - "narHash": "sha256-U1idK0JHs1XOfSI1APYuXi4AEADf+B+ZU4Wifc0pBHk=", + "lastModified": 1709485962, + "narHash": "sha256-rmFB4uE10+LJbcVE4ePgiuHOBlUIjQOeZt4VQVJTU8M=", "owner": "nix-community", "repo": "home-manager", - "rev": "2f3367769a93b226c467551315e9e270c3f78b15", + "rev": "d579633ff9915a8f4058d5c439281097e92380a8", "type": "github" }, "original": { @@ -253,11 +253,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1708819810, - "narHash": "sha256-1KosU+ZFXf31GPeCBNxobZWMgHsSOJcrSFA6F2jhzdE=", + "lastModified": 1709428628, + "narHash": "sha256-//ZCCnpVai/ShtO2vPjh3AWgo8riXCaret6V9s7Hew4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "89a2a12e6c8c6a56c72eb3589982c8e2f89c70ea", + "rev": "66d65cb00b82ffa04ee03347595aa20e41fe3555", "type": "github" }, "original": { @@ -364,11 +364,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1708751719, - "narHash": "sha256-0uWOKSpXJXmXswOvDM5Vk3blB74apFB6rNGWV5IjoN0=", + "lastModified": 1709356872, + "narHash": "sha256-mvxCirJbtkP0cZ6ABdwcgTk0u3bgLoIoEFIoYBvD6+4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f63ce824cd2f036216eb5f637dfef31e1a03ee89", + "rev": "458b097d81f90275b3fdf03796f0563844926708", "type": "github" }, "original": { @@ -397,11 +397,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1708987867, - "narHash": "sha256-k2lDaDWNTU5sBVHanYzjDKVDmk29RHIgdbbXu5sdzBA=", + "lastModified": 1709434911, + "narHash": "sha256-UN47hQPM9ijwoz7cYq10xl19hvlSP/232+M5vZDOMs4=", "owner": "Mic92", "repo": "sops-nix", - "rev": "a1c8de14f60924fafe13aea66b46157f0150f4cf", + "rev": "075df9d85ee70cfb53e598058045e1738f05e273", "type": "github" }, "original": { diff --git a/linux/blitzar/default.nix b/linux/blitzar/default.nix index 91a5396..d8032aa 100644 --- a/linux/blitzar/default.nix +++ b/linux/blitzar/default.nix @@ -4,7 +4,7 @@ imports = with inputs; [ disko.nixosModules.default hardware.nixosModules.asus-zephyrus-ga402 - ] ++ [ + ../../common ./audio.nix ./configuration.nix ./device.nix @@ -16,6 +16,5 @@ ./syncthing.nix ./tailscale.nix ./zfs.nix - ../../common ]; } diff --git a/linux/blitzar/gui.nix b/linux/blitzar/gui.nix index 3690777..8f056b6 100644 --- a/linux/blitzar/gui.nix +++ b/linux/blitzar/gui.nix @@ -5,7 +5,6 @@ let usr = config.constants.userName; in { let xdgCfg = config.xdg; in { gtk = { enable = true; - gtk2.configLocation = "${xdgCfg.configHome}/gtk-2.0/gtkrc"; theme = { name = "Sweet-Dark"; package = pkgs.sweet; diff --git a/linux/blitzar/syncthing.nix b/linux/blitzar/syncthing.nix index a06e639..f569dde 100644 --- a/linux/blitzar/syncthing.nix +++ b/linux/blitzar/syncthing.nix @@ -1,28 +1,14 @@ -{ config, ... }: +{ ... }: { - services.syncthing = let home = config.constants.homeDir; in { + services.syncthing = { enable = true; - configDir = "${home}/.config/syncthing"; - dataDir = "${home}/.local/share/syncthing"; - openDefaultPorts = true; - overrideDevices = true; - overrideFolders = true; - settings = let media = "nebula"; in { - devices.${media} = { - name = media; - id = "NJXA5XS-2PSWECD-UHBV7JH-IR2RSWY-PRUPFTZ-AHL7IN6-RXSLZKB-2FUNRQH"; - }; - folders.music = { - enable = true; - devices = [ media ]; - id = "Music"; - label = "Music"; - path = "~/Music"; - type = "sendonly"; - }; + settings.folders.music = { + enable = true; + devices = [ "nebula" ]; + path = "~/Music"; + type = "sendonly"; }; - user = config.constants.userName; }; } diff --git a/linux/comet/default.nix b/linux/comet/default.nix index 9370739..6e416bb 100644 --- a/linux/comet/default.nix +++ b/linux/comet/default.nix @@ -3,11 +3,10 @@ { imports = with inputs; [ hardware.nixosModules.common-cpu-intel - ] ++ [ + ../../common ./configuration.nix ./hardware-configuration.nix ./network.nix ./tailscale.nix - ../../common ]; } diff --git a/linux/nebula/default.nix b/linux/nebula/default.nix index 9b7feab..8c533ed 100644 --- a/linux/nebula/default.nix +++ b/linux/nebula/default.nix @@ -5,7 +5,7 @@ disko.nixosModules.default hardware.nixosModules.common-cpu-amd hardware.nixosModules.common-cpu-amd-pstate - ] ++ [ + ../../common ./conduit.nix ./configuration.nix ./disko.nix @@ -16,6 +16,5 @@ ./syncthing.nix ./tailscale.nix ./zfs.nix - ../../common ]; } diff --git a/linux/nebula/network.nix b/linux/nebula/network.nix index fcc6900..c40df04 100644 --- a/linux/nebula/network.nix +++ b/linux/nebula/network.nix @@ -9,7 +9,6 @@ wifi.backend = "iwd"; }; nftables.enable = true; - tempAddresses = "disabled"; wireless.iwd.enable = true; }; services.openssh.enable = true; diff --git a/linux/nebula/syncthing.nix b/linux/nebula/syncthing.nix index 3767734..90f5aa5 100644 --- a/linux/nebula/syncthing.nix +++ b/linux/nebula/syncthing.nix @@ -1,27 +1,13 @@ -{ config, ... }: +{ ... }: { - services.syncthing = let home = config.constants.homeDir; in { + services.syncthing = { enable = true; - configDir = "${home}/.config/syncthing"; - dataDir = "${home}/.local/share/syncthing"; - openDefaultPorts = true; - overrideDevices = true; - overrideFolders = true; - settings = let pc = "blitzar"; in { - devices.${pc} = { - name = pc; - id = "KGCBCIZ-GG6KMQ2-FLK5BWW-GLCEDML-5LCI24S-UKO5UWL-HWNCPYX-ZWWD5AQ"; - }; - folders.music = { - enable = true; - devices = [ pc ]; - id = "Music"; - label = "Music"; - path = "~/Music"; - type = "receiveonly"; - }; + settings.folders.music = { + enable = true; + devices = [ "blitzar" ]; + path = "~/Music"; + type = "receiveonly"; }; - user = config.constants.userName; }; } diff --git a/linux/protostar/configuration.nix b/linux/protostar/configuration.nix index d64b1a7..2342a7a 100644 --- a/linux/protostar/configuration.nix +++ b/linux/protostar/configuration.nix @@ -6,10 +6,13 @@ { # Configuration boot - boot.loader = { - efi.canTouchEfiVariables = true; - systemd-boot.enable = true; - timeout = 0; + boot = { + initrd.systemd.enable = true; + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + timeout = 0; + }; }; # Change secrets file diff --git a/linux/protostar/default.nix b/linux/protostar/default.nix index 3175da6..de1930a 100644 --- a/linux/protostar/default.nix +++ b/linux/protostar/default.nix @@ -4,15 +4,15 @@ imports = with inputs; [ disko.nixosModules.default jovian.nixosModules.default - ] ++ [ + ../../common ./configuration.nix ./disko.nix ./gui.nix ./hardware-configuration.nix + ./locale.nix ./network.nix ./syncthing.nix ./tailscale.nix ./zfs.nix - ../../common ]; } diff --git a/linux/protostar/gui.nix b/linux/protostar/gui.nix index a2e82f9..d81d3f0 100644 --- a/linux/protostar/gui.nix +++ b/linux/protostar/gui.nix @@ -1,18 +1,30 @@ -{ config, ... }: +{ config, inputs, pkgs, ... }: -let usr = config.constants.userName; in { +let + usr = config.constants.userName; + jovianPkgs = pkgs.extend inputs.jovian.overlays.default; +in +{ + home-manager.users.${usr}.home.packages = with jovianPkgs; [ + (retroarch.override { + cores = with libretro; [ + pcsx2 + ppsspp + ]; + }) + yuzu + ]; jovian = { + decky-loader = { + enable = true; + user = usr; + }; devices.steamdeck.enable = true; steam = { enable = true; autoStart = true; - desktopSession = "plasma"; + desktopSession = "gamescope-wayland"; user = usr; }; }; - - services.xserver = { - enable = true; - desktopManager.plasma6.enable = true; - }; } diff --git a/linux/protostar/locale.nix b/linux/protostar/locale.nix new file mode 100644 index 0000000..a73b7dd --- /dev/null +++ b/linux/protostar/locale.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +{ + # Configure default fonts + fonts = { + fontconfig.defaultFonts = { + serif = [ "Noto Serif" "Noto Serif CJK SC" ]; + sansSerif = [ "Inter" "Noto Sans CJK SC" ]; + monospace = [ "Iosevka" "Noto Sans Mono CJK SC" ]; + }; + packages = with pkgs; [ + sarasa-gothic + noto-fonts-emoji + ]; + }; +} diff --git a/linux/protostar/network.nix b/linux/protostar/network.nix index 2ef8d95..85cf799 100644 --- a/linux/protostar/network.nix +++ b/linux/protostar/network.nix @@ -1,10 +1,15 @@ -{ ... }: +{ config, ... }: { networking = { + firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ]; hostId = "74247225"; - networkmanager.enable = true; + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; nftables.enable = true; + wireless.iwd.enable = true; }; services.openssh.enable = true; } diff --git a/linux/protostar/syncthing.nix b/linux/protostar/syncthing.nix index e8e3a571..0bb4881 100644 --- a/linux/protostar/syncthing.nix +++ b/linux/protostar/syncthing.nix @@ -1,18 +1,9 @@ -{ config, ... }: +{ ... }: { - services.syncthing = let home = config.constants.homeDir; in { + services.syncthing = { enable = true; - configDir = "${home}/.config/syncthing"; - dataDir = "${home}/.local/share/syncthing"; - openDefaultPorts = true; - overrideDevices = true; - overrideFolders = true; # settings = let pc = "blitzar"; in { - # devices.${pc} = { - # name = pc; - # id = "KGCBCIZ-GG6KMQ2-FLK5BWW-GLCEDML-5LCI24S-UKO5UWL-HWNCPYX-ZWWD5AQ"; - # }; # folders.music = { # enable = true; # devices = [ pc ]; @@ -22,6 +13,5 @@ # type = "receiveonly"; # }; # }; - user = config.constants.userName; }; } diff --git a/linux/singularity/default.nix b/linux/singularity/default.nix index 3123e8d..4ed99a0 100644 --- a/linux/singularity/default.nix +++ b/linux/singularity/default.nix @@ -1,8 +1,9 @@ { inputs, ... }: { - imports = [ - inputs.mailserver.nixosModules.default + imports = with inputs; [ + mailserver.nixosModules.default + ../../common ./caddy.nix ./configuration.nix ./hardware-configuration.nix @@ -10,6 +11,5 @@ ./mailserver.nix ./network.nix ./vaultwarden.nix - ../../common ]; }