mirror of
https://github.com/xddxdd/nix-cachyos-kernel.git
synced 2026-07-03 19:18:07 +02:00
Wrap ZFS CachyOS update script as flake app to workaround missing PATH
This commit is contained in:
parent
197a74778b
commit
565b230f25
4
.github/workflows/auto-update.yml
vendored
4
.github/workflows/auto-update.yml
vendored
@ -66,9 +66,7 @@ jobs:
|
||||
run: |
|
||||
export TMPDIR=/nix/tmpdir
|
||||
nix flake update
|
||||
|
||||
chmod +x zfs-cachyos/update.py
|
||||
zfs-cachyos/update.py
|
||||
nix run .#update-zfs-cachyos
|
||||
|
||||
- name: Commit back to repository
|
||||
uses: stefanzweifel/git-auto-commit-action@v7
|
||||
|
||||
19
flake.nix
19
flake.nix
@ -68,6 +68,25 @@
|
||||
# Packages only contain linux-cachyos-* due to Flake schema requirements
|
||||
packages = lib.filterAttrs (_: lib.isDerivation) legacyPackages;
|
||||
|
||||
apps.update-zfs-cachyos = {
|
||||
type = "app";
|
||||
program =
|
||||
let
|
||||
python = pkgs.python3.withPackages (ps: [ ps.requests ]);
|
||||
script = pkgs.writeShellApplication {
|
||||
name = "update-zfs-cachyos";
|
||||
runtimeInputs = [
|
||||
python
|
||||
pkgs.nix-prefetch-git
|
||||
];
|
||||
text = ''
|
||||
python3 ${./zfs-cachyos/update.py}
|
||||
'';
|
||||
};
|
||||
in
|
||||
lib.getExe script;
|
||||
};
|
||||
|
||||
# Allow build unfree modules such as nvidia_x11
|
||||
_module.args.pkgs = lib.mkForce (
|
||||
import inputs.nixpkgs {
|
||||
|
||||
@ -99,8 +99,14 @@ def main() -> int:
|
||||
print("nix-prefetch-git execution failed, exiting")
|
||||
return 1
|
||||
|
||||
script_dir = Path(__file__).parent
|
||||
output_file = script_dir / "version.json"
|
||||
current = Path.cwd()
|
||||
while not (current / "flake.lock").exists():
|
||||
if current == current.parent:
|
||||
print("Could not find flake.lock in any parent directory, exiting")
|
||||
return 1
|
||||
current = current.parent
|
||||
|
||||
output_file = current / "zfs-cachyos" / "version.json"
|
||||
|
||||
save_version_info(latest_branch, prefetch_data, output_file)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user