From 53e6e9951cf60b845d17fb2866a95bc8bc6989b1 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 8 Mar 2024 09:39:56 -0600 Subject: [PATCH] add fall back for pinix to oizys --- oizys/oizys.nim | 16 +++++++++++++++- todo.md | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/oizys/oizys.nim b/oizys/oizys.nim index 9789213..fe4fb4f 100644 --- a/oizys/oizys.nim +++ b/oizys/oizys.nim @@ -17,6 +17,14 @@ proc error(args: varargs[string, `$`]) = args.join("") ) +proc warn(args: varargs[string, `$`]) = + stdout.styledWriteLine( + fgCyan, "oizys", resetStyle, "|", + fgYellow, "WARN", resetStyle, "| ", + args.join("") + ) + + type OizysContext = object flake, host: string @@ -43,7 +51,13 @@ proc check(c: OizysContext) = info "host: ", c.host proc cmd(c: OizysContext): string {.inline.} = - if c.pinix: "pix" else: "nix" + let pixExists = findExe("pix") != "" + if c.pinix: + if pixExists: + return "pix" + else: + warn "pinix not found, falling back to nix" + return "nix" proc systemFlakePath(c: OizysContext): string = c.flake & "#nixosConfigurations." & c.host & ".config.system.build.toplevel" diff --git a/todo.md b/todo.md index ee9f68a..a7ee541 100644 --- a/todo.md +++ b/todo.md @@ -1,8 +1,7 @@ # oizys todo's -- [ ] add graceful fall back for oizys-cli if pinix isn't installed system-wide yet +- [-] add graceful fall back for oizys-cli if pinix isn't installed system-wide yet - [ ] trackdown wezterm bug... (try building from flake?) > https://github.com/wez/wezterm/issues/5067 -- [ ] add auto-sleep functionality to hyprland environment