1
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Bauke 02677cf26e
Make diff a standalone option. 2023-02-13 12:25:38 +01:00
Bauke c71675303b
Add a rebuild option to copy-nixos-config. 2023-02-13 12:25:18 +01:00
1 changed files with 13 additions and 1 deletions

View File

@ -10,7 +10,13 @@ async function main(): Promise<void> {
.option("--hostname", "The machine's configuration to copy.", {
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);
const sourceDir = new URL(`../nix/${options.hostname}/`, import.meta.url);
@ -39,6 +45,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) {