Add a rebuild option to copy-nixos-config.
This commit is contained in:
parent
a62d8b4164
commit
c71675303b
|
@ -11,6 +11,10 @@ async function main(): Promise<void> {
|
||||||
default: (await runAndReturnStdout({ cmd: ["hostname"] })).trim(),
|
default: (await runAndReturnStdout({ cmd: ["hostname"] })).trim(),
|
||||||
})
|
})
|
||||||
.option("--diff", 'Output diffs between local and "/etc/nixos/" files.')
|
.option("--diff", 'Output diffs between local and "/etc/nixos/" files.')
|
||||||
|
.option(
|
||||||
|
"--rebuild <rebuild:string>",
|
||||||
|
'Run "sudo nixos-rebuild <rebuild>" after copying.',
|
||||||
|
)
|
||||||
.parse(Deno.args);
|
.parse(Deno.args);
|
||||||
|
|
||||||
const sourceDir = new URL(`../nix/${options.hostname}/`, import.meta.url);
|
const sourceDir = new URL(`../nix/${options.hostname}/`, import.meta.url);
|
||||||
|
@ -39,6 +43,12 @@ async function main(): Promise<void> {
|
||||||
"/etc/nixos/",
|
"/etc/nixos/",
|
||||||
],
|
],
|
||||||
}).status();
|
}).status();
|
||||||
|
|
||||||
|
if (options.rebuild) {
|
||||||
|
await Deno.run({
|
||||||
|
cmd: ["sudo", "nixos-rebuild", options.rebuild],
|
||||||
|
}).status();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.main) {
|
if (import.meta.main) {
|
||||||
|
|
Loading…
Reference in New Issue