only run nixos-generate-config in upd when a flag is given

this prevents the system from breaking on reboot when a docker container
or other storage mount is provided in the hardware configuration but is
not accessible anymore when booting
This commit is contained in:
cswimr 2025-01-14 12:18:47 -06:00
parent e70e06fdc0
commit a6efbc9ea1
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087

View file

@ -55,6 +55,8 @@ def _upd(args: list):
"Visual Studio Code user settings": ".config/Code/User/settings.json.bak",
"fontconfig": ".config/fontconfig/conf.d/10-hm-fonts.conf.bak"
}
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}")
run(["sudo", "nixos-generate-config", "--dir", ".",], cwd=path / "hosts")
print(f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}")