Extract kernel version from flake input to ensure version in sync

This commit is contained in:
Lan Tian 2026-03-04 23:39:18 -08:00
parent 8ea11ba1b5
commit e8fd643d68
No known key found for this signature in database
GPG Key ID: 04E66B6B25A0862B
2 changed files with 21 additions and 15 deletions

View File

@ -129,6 +129,8 @@
cachyosKernels = self.legacyPackages."${final.stdenv.hostPlatform.system}"; cachyosKernels = self.legacyPackages."${final.stdenv.hostPlatform.system}";
}; };
cachyos-kernel-input-path = inputs.cachyos-kernel.outPath;
mkCachyKernel = mkCachyKernel =
{ buildLinux, pkgs, ... }@args: { buildLinux, pkgs, ... }@args:
(import ./kernel-cachyos/mkCachyKernel.nix) { (import ./kernel-cachyos/mkCachyKernel.nix) {

View File

@ -1,15 +1,19 @@
import json import json
from pathlib import Path from pathlib import Path
import re
import subprocess import subprocess
import tempfile
import requests
def get_srctag(variant: str = "latest") -> str: def get_srctag(variant: str = "latest") -> str:
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as dir:
subprocess.run(
["nix", "build", ".#cachyos-kernel-input-path", "-o", f"{dir}/result"], check=True
)
pkgbuild_path = f"linux-cachyos-{variant}" if variant != "latest" else "linux-cachyos" pkgbuild_path = f"linux-cachyos-{variant}" if variant != "latest" else "linux-cachyos"
url = f"https://github.com/CachyOS/linux-cachyos/raw/refs/heads/master/{pkgbuild_path}/PKGBUILD"
pkgbuild = requests.get(url).text with open(f"{dir}/result/{pkgbuild_path}/PKGBUILD") as f:
pkgbuild = f.read()
script = pkgbuild + "\necho $_srctag" script = pkgbuild + "\necho $_srctag"
result = subprocess.run( result = subprocess.run(