Files
nix/modules/software/gaming/roblox.nix
T
2026-10-25 10:08:15 -05:00

40 lines
1.6 KiB
Nix

{
# Roblox client manager. The package is built privately by Gitea Actions on box
# (repo <owner>/roblox) and served from the private attic cache; nothing here is
# fetchable without the tokens in ~/.config/nix/{netrc,roblox.conf}.
den.aspects.software.gaming = {
# roblox.conf holds the cache substituter, its public key and `netrc-file`.
nixos = { config, host, ... }: {
nix.extraOptions = "!include ${config.users.users.${host.owner}.home}/.config/nix/roblox.conf";
};
homeManager = { pkgs, host, ... }: let
roblox = pkgs.writeShellApplication {
name = "roblox-manager";
runtimeInputs = with pkgs; [ curl coreutils ];
text = ''
state="''${XDG_STATE_HOME:-$HOME/.local/state}/roblox"
mkdir -p "$state"
# Follow the latest CI build; keep the last one when offline.
if path=$(curl -fsS --max-time 10 --netrc-file "$HOME/.config/nix/netrc" \
"https://git.${host.domain}/${host.owner}/roblox/raw/branch/release/path") \
&& [[ "$(readlink "$state/current" || true)" != "$path" ]]; then
nix-store --realise "$path" --add-root "$state/current" >/dev/null
fi
[[ -e "$state/current" ]] || { echo "roblox-manager: no build available yet" >&2; exit 1; }
exec "$state/current/bin/roblox" "$@"
'';
};
in {
home.packages = [ roblox ];
xdg.desktopEntries.roblox-manager = {
name = "Roblox Manager";
comment = "Roblox client manager";
exec = "roblox-manager";
icon = "applications-games";
categories = [ "Game" ];
};
};
};
}