mirror of
https://github.com/xddxdd/nix-cachyos-kernel.git
synced 2026-07-03 11:08:07 +02:00
Extract kernel version from flake input to ensure version in sync
This commit is contained in:
parent
8ea11ba1b5
commit
e8fd643d68
@ -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) {
|
||||||
|
|||||||
@ -1,25 +1,29 @@
|
|||||||
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:
|
||||||
pkgbuild_path = f"linux-cachyos-{variant}" if variant != "latest" else "linux-cachyos"
|
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as dir:
|
||||||
url = f"https://github.com/CachyOS/linux-cachyos/raw/refs/heads/master/{pkgbuild_path}/PKGBUILD"
|
subprocess.run(
|
||||||
pkgbuild = requests.get(url).text
|
["nix", "build", ".#cachyos-kernel-input-path", "-o", f"{dir}/result"], check=True
|
||||||
|
)
|
||||||
|
|
||||||
script = pkgbuild + "\necho $_srctag"
|
pkgbuild_path = f"linux-cachyos-{variant}" if variant != "latest" else "linux-cachyos"
|
||||||
result = subprocess.run(
|
|
||||||
["bash"],
|
with open(f"{dir}/result/{pkgbuild_path}/PKGBUILD") as f:
|
||||||
input=script,
|
pkgbuild = f.read()
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
script = pkgbuild + "\necho $_srctag"
|
||||||
check=True,
|
result = subprocess.run(
|
||||||
)
|
["bash"],
|
||||||
return result.stdout.strip()
|
input=script,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
return result.stdout.strip()
|
||||||
|
|
||||||
|
|
||||||
def nix_sha256_to_sri(hash: str) -> str:
|
def nix_sha256_to_sri(hash: str) -> str:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user