This commit is contained in:
mjallen18
2026-01-21 21:43:31 -06:00
parent 94c3d6d6ff
commit e2e2d814fe
23 changed files with 478 additions and 572 deletions

View File

@@ -23,10 +23,11 @@ let
# Source Versions #
# ######################################################
versionSpec = importJSON ./version.json;
mkVersions = selected:
mkVersions =
selected:
let
s = selected.sources;
vars = selected.variables or {};
vars = selected.variables or { };
in
{
suffix = vars.suffix or "";

View File

@@ -18,11 +18,7 @@
final,
}:
let
version =
if stdenv.isAarch64 then
"6.12.47"
else
cachyConfig.versions.linux.version;
version = if stdenv.isAarch64 then "6.12.47" else cachyConfig.versions.linux.version;
# Single-value optional attr
optionalAttr =
key: pred: value:

View File

@@ -9,11 +9,7 @@
commonMakeFlags,
}:
let
version =
if stdenv.isAarch64 then
"6.12.47"
else
cachyConfig.versions.linux.version;
version = if stdenv.isAarch64 then "6.12.47" else cachyConfig.versions.linux.version;
majorMinor = lib.versions.majorMinor version;
@@ -36,26 +32,24 @@ let
inherit (cachyConfig.versions.linux) hash;
}
else
(
if stdenv.isAarch64
then
let
modDirVersion = "6.12.47";
tag = "stable_20250916";
hash = "sha256-Rjn+eWl5cLcc9wgjS3HYVaWM5eKMN3pPfPbsu+QGR/M=";
in
fetchurl {
url = "https://github.com/raspberrypi/linux/archive/refs/tags/${tag}.tar.gz";
hash = hash;
}
else
fetchurl {
url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${
if version == "${majorMinor}.0" then majorMinor else version
}.tar.xz";
inherit (cachyConfig.versions.linux) hash;
}
);
(
if stdenv.isAarch64 then
let
tag = "stable_20250916";
hash = "sha256-Rjn+eWl5cLcc9wgjS3HYVaWM5eKMN3pPfPbsu+QGR/M=";
in
fetchurl {
url = "https://github.com/raspberrypi/linux/archive/refs/tags/${tag}.tar.gz";
hash = hash;
}
else
fetchurl {
url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${
if version == "${majorMinor}.0" then majorMinor else version
}.tar.xz";
inherit (cachyConfig.versions.linux) hash;
}
);
schedPatches =
if cachyConfig.cpuSched == "eevdf" then
@@ -324,8 +318,8 @@ let
"-e CONFIG_PINCTRL_BCM2712"
"-e CONFIG_PINCTRL_BCM2835"
"-e CONFIG_ARCH_BCM"
"-e CONFIG_ARCH_BCM2835"
"-e CONFIG_ARCH_BRCMSTB"
"-e CONFIG_ARCH_BCM2835"
"-e CONFIG_ARCH_BRCMSTB"
"-e CONFIG_AHCI_BRCM"
"-e CONFIG_BRCMUTIL"
"-e CONFIG_BRCMSMAC"

View File

@@ -1,5 +1,4 @@
{
callPackage,
stdenvNoCC,
lib,
fetchurl,
@@ -8,8 +7,6 @@
# Repo metadata
owner ? "CachyOS",
repo ? "proton-cachyos",
# Behavior
withUpdateScript ? true,
# Variant selection (null -> use defaultVariant from version.json)
variant ? null,
# Packaging/customization knobs
@@ -26,7 +23,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec variant null;
vars = selected.variables or {};
vars = selected.variables or { };
base = vars.base;
release = vars.release;
@@ -66,24 +63,7 @@ stdenvNoCC.mkDerivation {
sed -i -r 's|"${toolPattern}"|"${toolTitle}"|' $out/bin/compatibilitytool.vdf
'';
passthru =
if withUpdateScript then
{
updateScript = callPackage ./update.nix {
inherit
tarballPrefix
tarballSuffix
releasePrefix
releaseSuffix
owner
repo
;
# Prefer explicit variant, otherwise use defaultVariant from the spec
variant = if variant != null then variant else (versionSpec.defaultVariant or "cachyos");
};
}
else
{ };
passthru = { };
meta = with lib; {
inherit homepage;

View File

@@ -1,95 +0,0 @@
{
writeShellScript,
lib,
coreutils,
findutils,
gnugrep,
curl,
jq,
git,
nix,
nix-prefetch-git,
moreutils,
yq,
# Config
tarballPrefix,
tarballSuffix,
releasePrefix,
releaseSuffix,
owner,
repo,
# New: which variant to update (defaults to version.json's defaultVariant)
variant ? null,
}:
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}
repoRoot="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
versionFile="$repoRoot/packages/proton-cachyos/version.json"
# Determine variant to update (prefer CLI arg, else defaultVariant in file)
variantEff="${variant:-}"
if [ -z "$variantEff" ]; then
variantEff="$(jq -r '.defaultVariant // empty' "$versionFile")"
fi
if [ -z "$variantEff" ]; then
variantEff="cachyos"
fi
# Read current values from the unified version.json
localBase="$(jq -r --arg v "$variantEff" '.variants[$v].variables.base' "$versionFile")"
localRelease="$(jq -r --arg v "$variantEff" '.variants[$v].variables.release' "$versionFile")"
localHash="$(jq -r --arg v "$variantEff" '.variants[$v].sources.proton.hash' "$versionFile")"
# Discover latest release tag
latestVer="$(
curl -fsSL "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
echo "No update needed for variant '$variantEff' (${localBase}.${localRelease})."
exit 0
fi
latestBase="$(echo "$latestVer" | grep -Po "(?<=^${releasePrefix})[^-]+")"
latestRelease="$(echo "$latestVer" | grep -Po "(?<=-)[^-]+(?=${releaseSuffix}$)")"
artifactUrl="https://github.com/${owner}/${repo}/releases/download/''${latestVer}/${tarballPrefix}''${latestVer}${tarballSuffix}"
latestSha256="$(nix-prefetch-url --type sha256 "$artifactUrl")"
latestHash="$(nix-hash --to-sri --type sha256 "$latestSha256")"
# Update the selected variant in version.json
tmp="$(mktemp)"
jq \
--arg v "$variantEff" \
--arg latestBase "$latestBase" \
--arg latestRelease "$latestRelease" \
--arg latestHash "$latestHash" \
'
.variants[$v].variables.base = $latestBase
| .variants[$v].variables.release = $latestRelease
| .variants[$v].sources.proton.hash = $latestHash
' "$versionFile" > "$tmp"
mv "$tmp" "$versionFile"
git -C "$repoRoot" add "packages/proton-cachyos/version.json"
git -C "$repoRoot" commit -m "${repo}(${variantEff}): ''${localBase}.''${localRelease} -> ''${latestBase}.''${latestRelease}"
''

View File

@@ -17,7 +17,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
extraVersion = vars.extraVersion or "rpi";

View File

@@ -15,7 +15,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
modDirVersion = vars.modDirVersion;

View File

@@ -6,7 +6,7 @@
let
inherit (lib.trivial) importJSON;
inherit (lib.${namespace}) versioning;
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
sources = versioning.mkAllSources selected;

View File

@@ -9,7 +9,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
in

View File

@@ -9,7 +9,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
in
stdenvNoCC.mkDerivation {

View File

@@ -9,7 +9,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
in
stdenvNoCC.mkDerivation rec {

View File

@@ -9,7 +9,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
defaultConfig = ''

View File

@@ -11,7 +11,7 @@ let
versionSpec = importJSON ./version.json;
selected = versioning.selectVariant versionSpec null null;
vars = selected.variables or {};
vars = selected.variables or { };
sources = versioning.mkAllSources selected;
in
vscode-utils.buildVscodeMarketplaceExtension {

View File

@@ -2,7 +2,6 @@
lib,
bc,
bison,
fetchurl,
flex,
gnutls,
installShellFiles,