nixos-config/overlays/sandbox.nix

176 lines
5.0 KiB
Nix

final: prev:
let
wrapInSandbox = prev.callPackage ../lib/sandbox.nix {};
in {
discord-app-wrapped = wrapInSandbox {
name = "discord-app-wrapped";
launchScriptName = "discord-app";
binary = "${prev.discord-app}/bin/discord-app";
mountInHome = [ ".local/share/discord-app" ];
additionalBlacklist = [ "/mnt" ];
chdirTo = "/home/$USER";
preDesktopFilePhase = ''
mkdir -p $out/share/icons
cp -L ${prev.discord}/share/pixmaps/discord.png $out/share/icons/discord.png
'';
desktopFileAttributes = {
name = "discord-app-wrapped";
#exec = "discord";
icon = "discord";
desktopName = "Discord-App (wrapped)";
genericName = "Instant Messenger";
#categories = [ "Network" "InstantMessaging" ];
};
enableDesktopFile = true;
};
/*minecraft-wrapped = wrapInSandbox {
name = "minecraft-launcher";
package = prev.minecraft;
binaryName = "minecraft-launcher";
mountInHome = [ ".local/share/minecraft" ".minecraft" ];
additionalBlacklist = [ "/mnt" ];
chdirTo = "/home/$USER";
};*/
steam-wrapped = wrapInSandbox {
name = "steam-wrapped";
binary = "${prev.steam}/bin/steam";
launchScriptName = "steam";
mountInHome = [
".steam"
".local/share/Steam"
"Downloads/Skyrim Mods"
];
additionalBlacklist = [ "/mnt" ];
additionalMounts = [ "/mnt/Storage/Games/SteamLibrary" ];
chdirTo = "/home/$USER";
preDesktopFilePhase = ''
cp -Lr ${prev.steam}/share/icons $out/share/icons
'';
desktopFileAttributes = {
name = "steam-wrapped";
icon = "steam";
desktopName = "Steam (wrapped)";
};
enableDesktopFile = true;
};
spotify-wrapped = wrapInSandbox {
name = "spotify-wrapped";
launchScriptName = "spotify";
binary = "${prev.spotify}/bin/spotify";
additionalBlacklist = [ "/mnt" ];
mountInHome = [ ".config/spotify" ];
chdirTo = "/home/$USER";
preDesktopFilePhase = ''
cp -Lr ${prev.spotify}/share/icons $out/share/icons
'';
desktopFileAttributes = {
name = "spotify-wrapped";
icon = "spotify-client";
desktopName = "Spotify (wrapped)";
};
enableDesktopFile = true;
};
lutris-free-wrapped = wrapInSandbox {
name = "lutris-free-wrapped";
launchScriptName = "lutris";
binary = "${prev.lutris-free}/bin/lutris";
additionalBlacklist = [ "/mnt" ];
additionalMounts = [
"/mnt/Storage/Games/LeagueOfLegends"
];
mountInHome = [ ".local/share/lutris" ".config/lutris" "Games" ];
chdirTo = "/home/$USER";
preDesktopFilePhase = ''
mkdir -p $out/share/
cp -Lr ${prev.lutris-free}/share/icons $out/share/icons/
'';
desktopFileAttributes = {
name = "lutris-wrapped";
icon = "lutris";
desktopName = "Lutris (wrapped)";
};
enableDesktopFile = true;
};
discord-wrapped = let
discordPkg = prev.discord;
in wrapInSandbox {
name = "discord-wrapped";
launchScriptName = "discord";
binary = "${discordPkg}/bin/discord";
mountInHome = [ ".config/discord" ".config/BetterDiscord" ];
additionalBlacklist = [ "/mnt" ];
chdirTo = "/home/$USER";
preDesktopFilePhase = ''
mkdir -p $out/share/icons
cp -L ${discordPkg}/share/pixmaps/discord.png $out/share/icons/discord.png
'';
desktopFileAttributes = {
name = "discord-wrapped";
#exec = "discord";
icon = "discord";
desktopName = "Discord (wrapped)";
genericName = "Instant Messenger";
#categories = [ "Network" "InstantMessaging" ];
};
enableDesktopFile = true;
};
vortex-wrapped = let
# The path to the wine prefix Vortex is installed in
prefixPath = "/mnt/Storage/Games/NewVortex";
vortexStartScript = prev.writeShellScriptBin "start-vortex.sh" ''
WINEARCH=win64 \
WINEPREFIX=${prefixPath} \
${prev.wineWowPackages.staging}/bin/wine "C:\Program Files\Black Tree Gaming Ltd\Vortex\Vortex.exe"
'';
vortexIcon = builtins.fetchurl {
url = "https://www.nexusmods.com/bootstrap/images/vortex/vortex-logomark.svg";
sha256 = "0237wbbyvgapmmjsq5xab0izzaciqjx1si163r75wa2g7xvz4s22";
};
in wrapInSandbox {
name = "vortex-wrapped";
launchScriptName = "vortex";
binary = "${vortexStartScript}/bin/start-vortex.sh";
chdirTo = "/mnt/Storage/Games/";
additionalBlacklist = [ "/mnt" ];
additionalMounts = [
# TODO: It doesn't work if we restrict it more
"/mnt/Storage"
# Wine prefix
#"/mnt/Storage/Games/NewVortex"
# Mod cache
#"/mnt/Storage/Vortex Mods"
# Only access Skyrim: SE
#"/mnt/Storage/Games/SteamLibrary/SteamLibrary/steamapps/common/Skyrim\ Special\ Edition/"
];
mountInHome = [
# Mod downloads
"Downloads/Skyrim Mods"
];
preDesktopFilePhase = ''
mkdir -p $out/share/icons
cp ${vortexIcon} $out/share/icons/vortex.svg
'';
desktopFileAttributes = {
name = "vortex-wrapped";
icon = "vortex";
desktopName = "Vortex Mod Manager (wrapped)";
};
enableDesktopFile = true;
};
}