mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 18:30:43 -06:00
drop official logging
This commit is contained in:
parent
f35481f6bf
commit
b07f50a77a
1 changed files with 22 additions and 11 deletions
|
@ -1,11 +1,26 @@
|
||||||
import std/[logging, os, osproc, tables, times]
|
import std/[os, osproc, tables, times, strutils, terminal]
|
||||||
from std/nativesockets import getHostname
|
from std/nativesockets import getHostname
|
||||||
|
|
||||||
|
|
||||||
var logger = newConsoleLogger()
|
|
||||||
addHandler(logger)
|
|
||||||
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
|
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
|
||||||
|
|
||||||
|
|
||||||
|
proc info(args: varargs[string, `$`]) =
|
||||||
|
stdout.styledWriteLine(
|
||||||
|
fgCyan, "oizys", resetStyle, "|",
|
||||||
|
styleDim, "INFO", resetStyle, "| ",
|
||||||
|
args.join("")
|
||||||
|
)
|
||||||
|
|
||||||
|
proc error(args: varargs[string, `$`]) =
|
||||||
|
stdout.styledWriteLine(
|
||||||
|
fgCyan, "oizys", resetStyle, "|",
|
||||||
|
styleDim, "ERROR", resetStyle, "| ",
|
||||||
|
args.join("")
|
||||||
|
)
|
||||||
|
|
||||||
|
proc execQuit(cmd: string) =
|
||||||
|
quit (execCmd cmd)
|
||||||
|
|
||||||
type
|
type
|
||||||
OizysContext = object
|
OizysContext = object
|
||||||
flake, host: string
|
flake, host: string
|
||||||
|
@ -20,9 +35,6 @@ proc newCtx(): OizysContext =
|
||||||
proc systemFlakePath(c: OizysContext): string =
|
proc systemFlakePath(c: OizysContext): string =
|
||||||
c.flake & "#nixosConfigurations." & c.host & ".config.system.build.toplevel"
|
c.flake & "#nixosConfigurations." & c.host & ".config.system.build.toplevel"
|
||||||
|
|
||||||
proc execQuit(cmd: string) =
|
|
||||||
quit (execCmd cmd)
|
|
||||||
|
|
||||||
proc build(c: OizysContext) =
|
proc build(c: OizysContext) =
|
||||||
## build nixos
|
## build nixos
|
||||||
let
|
let
|
||||||
|
@ -34,7 +46,6 @@ proc dry(c: OizysContext) =
|
||||||
execQuit "nix build " & c.systemFlakePath & " --dry-run"
|
execQuit "nix build " & c.systemFlakePath & " --dry-run"
|
||||||
|
|
||||||
proc cache(c: OizysContext) =
|
proc cache(c: OizysContext) =
|
||||||
# Simple benchmarking
|
|
||||||
let start = cpuTime()
|
let start = cpuTime()
|
||||||
let code = execCmd """
|
let code = execCmd """
|
||||||
cachix watch-exec """ & c.cache & """ \
|
cachix watch-exec """ & c.cache & """ \
|
||||||
|
@ -99,9 +110,9 @@ proc parseFlag(c: var OizysContext, key, val: string) =
|
||||||
case key:
|
case key:
|
||||||
of "help":
|
of "help":
|
||||||
echo usage; quit 0
|
echo usage; quit 0
|
||||||
of "h","host":
|
of "h", "host":
|
||||||
c.host = val
|
c.host = val
|
||||||
of "f","flake":
|
of "f", "flake":
|
||||||
c.flake = val
|
c.flake = val
|
||||||
of "no-nom":
|
of "no-nom":
|
||||||
c.nom = false
|
c.nom = false
|
||||||
|
|
Loading…
Reference in a new issue