From 240bdfb6da8686d00d63be80a4e2f51f44459ed4 Mon Sep 17 00:00:00 2001 From: Madeleine Sydney Date: Thu, 10 Apr 2025 07:42:10 -0600 Subject: [PATCH] fix(steam): Impermanence + Steam --- flake.lock | 3 +-- hosts/sydpc/configuration.nix | 6 +++++- modules/home/steam.nix | 2 +- modules/home/users/crumb/tf2.nix | 3 ++- modules/nixos/steam.nix | 19 +++++++++++++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 1501e6c..1c59835 100644 --- a/flake.lock +++ b/flake.lock @@ -883,9 +883,8 @@ "sops-nix": "sops-nix", "stylix": "stylix", "sydnix-cli": "sydnix-cli", + "tf2-nix": "tf2-nix", "vpn-confinement": "vpn-confinement" - "sydnix-cli": "sydnix-cli", - "tf2-nix": "tf2-nix" } }, "sops-nix": { diff --git a/hosts/sydpc/configuration.nix b/hosts/sydpc/configuration.nix index 2972c69..c73135e 100644 --- a/hosts/sydpc/configuration.nix +++ b/hosts/sydpc/configuration.nix @@ -13,7 +13,11 @@ sydnix = { filesystemType = "btrfs"; - steam.enable = true; + steam = { + enable = true; + impermanenceUsers = ["crumb"]; + }; + niri.enable = true; stylix.enable = true; qemu.enable = true; diff --git a/modules/home/steam.nix b/modules/home/steam.nix index e92197e..591a374 100644 --- a/modules/home/steam.nix +++ b/modules/home/steam.nix @@ -19,7 +19,7 @@ in { # # https://github.com/ValveSoftware/steam-for-linux/issues/10552 # https://github.com/nix-community/impermanence/issues/165 - { directory = ".local/share/Steam"; method = "symlink"; } + # { directory = ".local/share/Steam"; method = "symlink"; } { directory = ".steam"; method = "symlink"; } ]; diff --git a/modules/home/users/crumb/tf2.nix b/modules/home/users/crumb/tf2.nix index 7f129dd..42b3a05 100644 --- a/modules/home/users/crumb/tf2.nix +++ b/modules/home/users/crumb/tf2.nix @@ -25,8 +25,9 @@ in { ./tf2/quake-hitsounds ]; }; + game-dir = ".local/share/Steam/steamapps/common/Team Fortress 2/tf"; in { - home.file."tf" = { + home.file.${game-dir} = { recursive = true; source = my-config; }; diff --git a/modules/nixos/steam.nix b/modules/nixos/steam.nix index 5f9c50b..02da658 100644 --- a/modules/nixos/steam.nix +++ b/modules/nixos/steam.nix @@ -4,6 +4,16 @@ let cfg = config.sydnix.steam; in { options.sydnix.steam = { enable = lib.mkEnableOption "Steam"; + impermanenceUsers = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + description = '' + A list of users for which ~/.local/share/Steam shall be persisted. This + is a disgusting hack to get around an issue with Impermanence's + home-manager module. + https://github.com/nix-community/impermanence/issues/165#issuecomment-2537723929 + ''; + }; }; config = lib.mkIf cfg.enable { @@ -28,5 +38,14 @@ in { enable = true; enable32Bit = true; }; + + environment.persistence.${config.sydnix.impermanence.persistDirectory}.users = + builtins.listToAttrs + (builtins.map + (user: { + name = user; + value.directories = [".local/share/Steam"]; + }) + cfg.impermanenceUsers); }; }