From 8ab0c10ae1db44037ff0489b49eff65a2ba008fa Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 5 May 2024 15:03:35 -0500 Subject: [PATCH] actually pass "flake" to nixos-rebuild --- pkgs/oizys/oizys-go/pkg/oizys/oizys.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/oizys/oizys-go/pkg/oizys/oizys.go b/pkgs/oizys/oizys-go/pkg/oizys/oizys.go index 27eae08..246e104 100644 --- a/pkgs/oizys/oizys-go/pkg/oizys/oizys.go +++ b/pkgs/oizys/oizys-go/pkg/oizys/oizys.go @@ -27,10 +27,10 @@ func TerminalSize() (int, int) { func ParseDryRunOutput(nixOutput string) { output := termenv.NewOutput(os.Stdout) parts := strings.Split(nixOutput, "\nthese") - if len(parts) != 3 { - log.Println("no changes...") - return - } + if len(parts) != 3 { + log.Println("no changes...") + return + } built := strings.Split(strings.TrimSpace(parts[1]), "\n")[1:] fetched := strings.Split(strings.TrimSpace(parts[2]), "\n")[1:] @@ -71,9 +71,15 @@ func NixDryRun(path string) { } func NixosRebuild(subcmd string, flake string, rest ...string) { - args := []string{subcmd, "--flake"} + args := []string{ + "nixos-rebuild", + subcmd, + "--flake", + flake, + } + fmt.Println(args) args = append(args, rest...) - cmd := exec.Command("nixos-rebuild", args...) + cmd := exec.Command("sudo", args...) runCommand(cmd) }