1
Fork 0

Add a rebuild option to copy-nixos-config.

This commit is contained in:
Bauke 2023-02-13 12:24:12 +01:00
parent a62d8b4164
commit c71675303b
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,10 @@ async function main(): Promise<void> {
default: (await runAndReturnStdout({ cmd: ["hostname"] })).trim(),
})
.option("--diff", 'Output diffs between local and "/etc/nixos/" files.')
.option(
"--rebuild <rebuild:string>",
'Run "sudo nixos-rebuild <rebuild>" after copying.',
)
.parse(Deno.args);
const sourceDir = new URL(`../nix/${options.hostname}/`, import.meta.url);
@ -39,6 +43,12 @@ async function main(): Promise<void> {
"/etc/nixos/",
],
}).status();
if (options.rebuild) {
await Deno.run({
cmd: ["sudo", "nixos-rebuild", options.rebuild],
}).status();
}
}
if (import.meta.main) {