Add temporary firefox policy fix

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-26 11:16:53 +00:00
parent a3dc4129d6
commit 93c13d8537
4 changed files with 59 additions and 29 deletions

View File

@@ -0,0 +1,85 @@
{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{
config,
lib,
pkgs,
...
}:
{
environment.persistence."/persist" = {
"${home}/.steam" = { };
"${home}/.local/share/Steam" = { };
};
programs = {
steam = {
enable = true;
localNetworkGameTransfers.openFirewall = true;
extest.enable = true;
protontricks.enable = true;
};
gamescope = {
enable = true;
args = [
"--rt"
"-f"
];
};
gamemode.enable = true;
};
home-manager.users.${user} = {
systemd.user = {
services.steam-ln =
let
steamLn = lib.meta.getExe (
pkgs.writeShellApplication {
name = "steam-ln";
runtimeInputs = with pkgs; [ coreutils ];
text = builtins.readFile ./scripts/steam-ln.sh;
}
);
in
{
Unit = {
Description = "Sync Steam games with Games directory";
After = [
config.environment.persistence."/persist"."${home}/.local/share/Steam".mount
config.environment.persistence."/persist"."${home}/Games".mount
];
DefaultDependencies = false;
};
Service = {
ExecStart = steamLn;
Type = "oneshot";
};
Install.WantedBy = [ "graphical-session.target" ];
};
paths.steam-ln = {
Unit = {
Description = "Monitor Steam games directory for changes";
After = [
config.environment.persistence."/persist"."${home}/.local/share/Steam".mount
config.environment.persistence."/persist"."${home}/Games".mount
];
};
Path.PathChanged = "${home}/.local/share/Steam/steamapps/common";
Install.WantedBy = [ "graphical-session.target" ];
};
};
home = {
packages = with pkgs; [ protonup ];
sessionVariables.STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${home}/.steam/root/compatibilitytools.d";
};
};
}

View File

@@ -0,0 +1,59 @@
# shellcheck shell=bash
STEAM="$HOME/.local/share/Steam/steamapps/common"
GAMES="$HOME/Games"
EXCLUDE=(
"Proton - Experimental"
"SteamLinuxRuntime_sniper"
"Steamworks Shared"
"Steam.dll"
)
is_excluded() {
local dir=$1
for exclude in "${EXCLUDE[@]}"; do
if [[ "$dir" == "$exclude" ]]; then
return 0
fi
done
return 1
}
for game in "$STEAM"/*/; do
name=$(basename "$game")
if is_excluded "$name"; then
echo "Excluding $name from symlink creation."
continue
fi
if [[ -L "$GAMES/$name" ]]; then
continue
fi
if [[ -d "$GAMES/$name" || -f "$GAMES/$name" ]]; then
>&2 echo "Error: $name is already a regular directory or file."
continue
fi
echo "Creating symlink for $name..."
ln -srf "$game" "$GAMES/$name"
done
for link in "$GAMES"/*; do
target=$(readlink "$link")
if [[ ! "$target" == "$STEAM/"* ]]; then
continue
fi
name=$(basename "$target")
if [[ -e "$target" ]] && ! is_excluded "$name"; then
continue
fi
echo "Removing symlink $link..."
rm "$link"
done