This commit is contained in:
mjallen18
2026-01-05 14:54:52 -06:00
parent cd03862e4b
commit 77c76e6483
14 changed files with 337 additions and 79 deletions

View File

@@ -0,0 +1,5 @@
{
"base": "10.0",
"release": "20251222",
"hash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}

View File

@@ -0,0 +1,5 @@
{
"base": "10.0",
"release": "20251222",
"hash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}

View File

@@ -0,0 +1,5 @@
{
"base": "10.0",
"release": "20251222",
"hash": "sha256-1+6nCUc93vVZg3j4oSwuM7DYOZ2bNbLIjbH+8OUOSAQ="
}

View File

@@ -0,0 +1,5 @@
{
"base": "10.0",
"release": "20251222",
"hash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
}

View File

@@ -0,0 +1,82 @@
{
callPackage,
stdenvNoCC,
lib,
fetchurl,
fetchzip,
# Required
versionFilename ? "cachyos-v4-version.json",
owner ? "CachyOS",
repo ? "proton-cachyos",
# Optional
withUpdateScript ? true,
toolTitle ? null,
toolPattern ? "proton-.*",
tarballPrefix ? "proton-",
tarballSuffix ? "-x86_64_v4.tar.xz",
releasePrefix ? "cachyos-",
releaseSuffix ? "-slr",
version ? lib.trivial.importJSON ./${versionFilename},
releaseVersion ? "${releasePrefix}${version.base}-${version.release}${releaseSuffix}",
homepage ? "https://github.com/${owner}/${repo}",
url ? "${homepage}/releases/download/${releaseVersion}/${tarballPrefix}${releaseVersion}${tarballSuffix}",
}:
let
intake =
if lib.strings.hasSuffix ".zip" url then
{
fetcher = fetchzip;
input = "$src/*.tar.xz";
}
else
{
fetcher = fetchurl;
input = "$src";
};
in
stdenvNoCC.mkDerivation {
name = repo;
version = "${version.base}.${version.release}";
src = intake.fetcher {
inherit url;
inherit (version) hash;
};
buildCommand = ''
mkdir -p $out/bin
tar -C $out/bin --strip=1 -x -f ${intake.input}
''
# Allow to keep the same name between updates
+ lib.strings.optionalString (toolTitle != null) ''
sed -i -r 's|"${toolPattern}"|"${toolTitle}"|' $out/bin/compatibilitytool.vdf
'';
passthru =
if withUpdateScript then
{
updateScript = callPackage ./update.nix {
inherit
tarballPrefix
tarballSuffix
releasePrefix
releaseSuffix
versionFilename
owner
repo
;
};
}
else
{ };
meta = with lib; {
inherit homepage;
description = "Compatibility tool for Steam Play based on Wine and additional components (patched and built by ${owner})";
license = licenses.bsd3;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [
pedrohlc
];
};
}

View File

@@ -0,0 +1,5 @@
{
"base": "10",
"release": "26",
"hash": "sha256-4v/Z0qHs4wtdo9PcnO2qgodQCNHJhLXvx2ZsAoID+ds="
}

View File

@@ -0,0 +1,63 @@
{
writeShellScript,
lib,
coreutils,
findutils,
gnugrep,
curl,
jq,
git,
nix,
nix-prefetch-git,
moreutils,
yq,
# Config
tarballPrefix,
tarballSuffix,
releasePrefix,
releaseSuffix,
versionFilename,
owner,
repo,
}:
let
path = lib.makeBinPath [
coreutils
curl
findutils
gnugrep
jq
moreutils
git
nix-prefetch-git
nix
yq
];
in
writeShellScript "update-${repo}" ''
set -euo pipefail
PATH=${path}
srcJson=pkgs/proton-bin/${versionFilename}
localBase=$(jq -r .base < $srcJson)
localRelease=$(jq -r .release < $srcJson)
latestVer=$(curl 'https://github.com/${owner}/${repo}/releases.atom' | xq -r '.feed.entry[].link."@href"' | grep -Po '(?<=/)${releasePrefix}[^/]+${releaseSuffix}$' | head -n 1)
if [ "${releasePrefix}''${localBase}-''${localRelease}${releaseSuffix}" == "$latestVer" ]; then
exit 0
fi
latestBase=$(echo $latestVer | grep -Po '(?<=^${releasePrefix})[^-]+')
latestRelease=$(echo $latestVer | grep -Po '(?<=-)[^-]+(?=${releaseSuffix}$)')
latestSha256=$(nix-prefetch-url --type sha256 "https://github.com/${owner}/${repo}/releases/download/''${latestVer}/${tarballPrefix}''${latestVer}${tarballSuffix}")
latestHash=$(nix-hash --to-sri --type sha256 $latestSha256)
jq \
--arg latestBase "$latestBase" --arg latestRelease "$latestRelease" --arg latestHash "$latestHash" \
'.base = $latestBase | .release = $latestRelease | .hash = $latestHash' \
"$srcJson" | sponge "$srcJson"
git add $srcJson
git commit -m "${repo}: ''${localBase}.''${localRelease} -> ''${latestBase}.''${latestRelease}"
''