add fall back for pinix to oizys

This commit is contained in:
Daylin Morgan 2024-03-08 09:39:56 -06:00
parent 40fb99a47b
commit 53e6e9951c
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 16 additions and 3 deletions

View file

@ -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"

View file

@ -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
<!-- generated with <3 by daylinmorgan/todo -->