Compare commits
2 Commits
a62d8b4164
...
02677cf26e
Author | SHA1 | Date |
---|---|---|
Bauke | 02677cf26e | |
Bauke | c71675303b |
|
@ -10,7 +10,13 @@ async function main(): Promise<void> {
|
||||||
.option("--hostname", "The machine's configuration to copy.", {
|
.option("--hostname", "The machine's configuration to copy.", {
|
||||||
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.', {
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
.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 +45,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