From c71675303bdbbcc385418b4a950752a5398be154 Mon Sep 17 00:00:00 2001 From: Bauke Date: Mon, 13 Feb 2023 12:24:12 +0100 Subject: [PATCH] Add a rebuild option to copy-nixos-config. --- .bauke/scripts/copy-nixos-config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bauke/scripts/copy-nixos-config.ts b/.bauke/scripts/copy-nixos-config.ts index 6392172..fdd654d 100644 --- a/.bauke/scripts/copy-nixos-config.ts +++ b/.bauke/scripts/copy-nixos-config.ts @@ -11,6 +11,10 @@ async function main(): Promise { default: (await runAndReturnStdout({ cmd: ["hostname"] })).trim(), }) .option("--diff", 'Output diffs between local and "/etc/nixos/" files.') + .option( + "--rebuild ", + 'Run "sudo nixos-rebuild " after copying.', + ) .parse(Deno.args); const sourceDir = new URL(`../nix/${options.hostname}/`, import.meta.url); @@ -39,6 +43,12 @@ async function main(): Promise { "/etc/nixos/", ], }).status(); + + if (options.rebuild) { + await Deno.run({ + cmd: ["sudo", "nixos-rebuild", options.rebuild], + }).status(); + } } if (import.meta.main) {