66 lines
2.5 KiB
Nix
66 lines
2.5 KiB
Nix
{ inputs, ... }: {
|
|
flake-file.inputs.rosemary = {
|
|
url = "github:microlift/rosemary";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
den.aspects.software.gaming.homeManager = { pkgs, ... }:
|
|
let
|
|
rosemary = inputs.rosemary.packages.${pkgs.stdenv.hostPlatform.system}.rosemary;
|
|
|
|
mkRoblox = { name, kind, channel, zip, app }: pkgs.writeShellApplication {
|
|
inherit name;
|
|
runtimeInputs = [ pkgs.curl pkgs.jq pkgs.unzip pkgs.coreutils pkgs.findutils rosemary ];
|
|
text = ''
|
|
base="''${XDG_DATA_HOME:-$HOME/.local/share}/roblox-macos/${kind}"
|
|
mkdir -p "$base"
|
|
|
|
if version=$(curl -fsSL https://clientsettingscdn.roblox.com/v2/client-version/${channel} | jq -er .clientVersionUpload); then
|
|
dir="$base/$version"
|
|
if [ ! -d "$dir/${app}" ]; then
|
|
tmp=$(mktemp -d "$base/.dl.XXXXXX")
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
curl -fL -o "$tmp/r.zip" "https://setup.rbxcdn.com/mac/$version-${zip}"
|
|
unzip -q "$tmp/r.zip" -d "$tmp/out"
|
|
rm -rf "$dir"
|
|
mv "$tmp/out" "$dir"
|
|
fi
|
|
else
|
|
echo "${name}: version lookup failed, using newest cached build" >&2
|
|
dir=$(find "$base" -mindepth 1 -maxdepth 1 -name 'version-*' -printf '%T@ %p\n' | sort -rn | head -n1 | cut -d' ' -f2-)
|
|
[ -n "$dir" ] || { echo "${name}: nothing cached" >&2; exit 1; }
|
|
fi
|
|
|
|
exec rosemary run "$dir/${app}" "$@"
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
imports = [ inputs.rosemary.homeManagerModules.default ];
|
|
|
|
# programs.rosemary.steam.enable = true; # adds "Rosemary" to Steam compatibilitytools.d; pick it per-game in Steam > Properties > Compatibility
|
|
|
|
home.packages = [
|
|
rosemary
|
|
(mkRoblox { name = "roblox"; kind = "player"; channel = "MacPlayer"; zip = "RobloxPlayer.zip"; app = "RobloxPlayer.app"; })
|
|
(mkRoblox { name = "roblox-studio"; kind = "studio"; channel = "MacStudio"; zip = "RobloxStudioApp.zip"; app = "RobloxStudio.app"; })
|
|
];
|
|
|
|
xdg.desktopEntries = {
|
|
roblox-macos = {
|
|
name = "Roblox (macOS)";
|
|
exec = "roblox %u";
|
|
categories = [ "Game" ];
|
|
mimeType = [ "x-scheme-handler/roblox-player" "x-scheme-handler/roblox" ];
|
|
};
|
|
|
|
roblox-studio-macos = {
|
|
name = "Roblox Studio (macOS)";
|
|
exec = "roblox-studio %u";
|
|
categories = [ "Development" ];
|
|
mimeType = [ "x-scheme-handler/roblox-studio" "x-scheme-handler/roblox-studio-auth" ];
|
|
};
|
|
};
|
|
};
|
|
}
|