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:
parent
e70e06fdc0
commit
a6efbc9ea1
1 changed files with 10 additions and 8 deletions
|
@ -55,14 +55,16 @@ 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"
|
||||
}
|
||||
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}")
|
||||
run(["sudo", "rm", "configuration.nix"], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}")
|
||||
run(["sudo", "mv", "hardware-configuration.nix", "{hostname}.nix".format(hostname=gethostname())], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}")
|
||||
run(["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())], 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}")
|
||||
run(["sudo", "nixos-generate-config", "--dir", ".",], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}")
|
||||
run(["sudo", "rm", "configuration.nix"], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}")
|
||||
run(["sudo", "mv", "hardware-configuration.nix", "{hostname}.nix".format(hostname=gethostname())], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}")
|
||||
run(["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())], cwd=path)
|
||||
for file_description, file_path in files_to_delete.items():
|
||||
print(f"{c.BLUE}Deleting {c.YELLOW}{file_description}{c.BLUE} backup file{c.END}")
|
||||
run(["rm", file_path], exit_on_error=False, cwd="/home/cswimr")
|
||||
|
|
Loading…
Add table
Reference in a new issue