Working state

This commit is contained in:
2026-09-27 11:11:02 +02:00
parent 639fbcd75d
commit 57d4f6f55b
4 changed files with 86 additions and 0 deletions
+16
View File
@@ -1,2 +1,18 @@
# better-xcloud-nix # better-xcloud-nix
A Nix flake providing a standalone Chromium wrapper for Better xCloud.
## Current State
Functional. The flake builds a shell script wrapper that deploys a pre-configured Chromium profile and launches the browser with required extensions.
## Versions
* **Nixpkgs**: nixos-unstable
* **Violentmonkey**: v2.49.0 (Manifest V3)
* **Better xCloud**: v6.7.12 (State saved within `preferences.tar.gz`)
## How It Works
1. The flake uses `fetchzip` to download the Violentmonkey extension release.
2. `writeShellScriptBin` generates the executable wrapper script.
3. Upon execution, the script checks for the existence of `$HOME/.config/better-xcloud-wrapper`.
4. If the profile directory is missing, it extracts the local `preferences.tar.gz` archive into this path. This archive contains the required browser settings, Violentmonkey configuration, and the installed Better xCloud userscript.
5. The script executes Chromium, passing the downloaded extension via `--load-extension` and the extracted profile via `--user-data-dir`. This isolates the application from your primary browser state.
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1790463110,
"narHash": "sha256-hKlVl12B1dF0Q5vd9dY3lIJM5mFGWYSlXwSLAqHZ1+s=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e158d9ed9b51c98974c5e66e1ba1c9e0255fecaa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+43
View File
@@ -0,0 +1,43 @@
{
description = "A chromium wrapper for Better xCloud";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = inputs: {
packages = builtins.mapAttrs (
system: pkgs:
let
tamper-monkey-ext = pkgs.fetchzip {
url = "https://github.com/violentmonkey/violentmonkey/releases/download/v2.49.0/Violentmonkey-mv3-v2.49.0.zip";
hash = "sha256-jeIaytwDzN0Q+Lg+K19HWKZlTzEzBPiUjJy6M+H1kZc=";
stripRoot = false;
};
# better-xcloud-script = pkgs.fetchurl {
# url = "https://github.com/redphx/better-xcloud/releases/download/v6.7.12/better-xcloud.user.js";
# hash = "sha256-u3iTG07JTWjLGNqX+krh+I5rMQO8FZkFkxsiOKUbUX4=";
# };
better-xcloud = pkgs.writeShellScriptBin "better-xcloud-wrapper" ''
CONF_DIR=$HOME/.config/better-xcloud-wrapper
PROF_DIR=$CONF_DIR/better-xcloud-wrapper
if [[ ! -d $CONF_DIR ]]; then
mkdir -p $CONF_DIR
fi
if [[ ! -d $PROF_DIR ]]; then
tar -xzf ${./preferences.tar.gz} -C $CONF_DIR
fi
${pkgs.chromium}/bin/chromium --load-extension=${tamper-monkey-ext} --user-data-dir=$HOME/.config/better-xcloud-wrapper --app=https://www.xbox.com/play/
'';
in
{
better-xcloud-wrapper = better-xcloud;
default = inputs.self.packages.${system}.better-xcloud-wrapper;
}
) inputs.nixpkgs.legacyPackages;
};
}
Binary file not shown.