integrate lock functionality into upd

This commit is contained in:
cswimr 2025-01-30 11:33:40 -06:00
parent c4db0959a2
commit e2fb552850
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087

View file

@ -85,6 +85,10 @@ def _upd(args: list):
run(["git", "pull"], cwd=path)
else:
args.remove("--no-pull")
if "--lock" in args:
args.remove("--lock")
print(f"{c.BLUE}Updating {c.YELLOW}Nix Flake{c.BLUE} lock file{c.END}")
run(["nix", "flake", "update", *args], cwd=path)
if "--rewrite-hardware-configuration" in args:
args.remove("--rewrite-hardware-configuration")
print(f"{c.BLUE}Updating {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE}{c.END}")
@ -111,14 +115,6 @@ def _upd(args: list):
print(f"{c.RED}WARNING: The --impure flag is set!{c.END}")
run(["sudo", "nixos-rebuild", subcommand, *args], cwd=path)
@aliases.register
def _lock(args):
path = Path("/etc/nixos")
if path.exists():
c = colors.Colors
print(f"{c.BLUE}Updating {c.YELLOW}Nix Flake{c.BLUE} lock file{c.END}")
run(["nix", "flake", "update", *args], cwd=path)
@aliases.register
@aliases.return_command
def _edit(args):