mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-24 16:00:45 -06:00
Compare commits
2 commits
3191780ea7
...
fd3175d3a5
Author | SHA1 | Date | |
---|---|---|---|
fd3175d3a5 | |||
0aecfb2a3c |
4 changed files with 47 additions and 91 deletions
67
flake.lock
67
flake.lock
|
@ -323,11 +323,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725563063,
|
"lastModified": 1725465540,
|
||||||
"narHash": "sha256-tnBDplJLVDCfQyU8QV/WMlKXWqdburHmC3tp2XZmhtA=",
|
"narHash": "sha256-9OhDjPMwomJbGuIv5mFAvu/AV6ETTVHz08wVP1goNkY=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "727f1b54cd1ba48774092a5d54acc0e55f3ffe0f",
|
"rev": "027140b7315efe3cd2e7b78fa608bd36da839894",
|
||||||
"revCount": 5188,
|
"revCount": 5184,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyprwm/Hyprland/"
|
"url": "https://github.com/hyprwm/Hyprland/"
|
||||||
|
@ -559,24 +559,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nim2nix_2": {
|
"nim2nix_2": {
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs_7"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725469705,
|
|
||||||
"narHash": "sha256-4/iSUwB3XKmybdt4R87VhBPiD3z4BL6RrD9LyrrkesM=",
|
|
||||||
"owner": "daylinmorgan",
|
|
||||||
"repo": "nim2nix",
|
|
||||||
"rev": "42af12ca45025c7146bc24e27f5d8b65b003d663",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "daylinmorgan",
|
|
||||||
"repo": "nim2nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nim2nix_3": {
|
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"utils",
|
"utils",
|
||||||
|
@ -838,22 +820,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_7": {
|
"nixpkgs_7": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1724479785,
|
|
||||||
"narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_8": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725103162,
|
"lastModified": 1725103162,
|
||||||
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
||||||
|
@ -900,11 +866,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725557788,
|
"lastModified": 1725518286,
|
||||||
"narHash": "sha256-mPw63Fk1veQx18OVQijlvKbxxXF1uzI8N+0pF/tDnqE=",
|
"narHash": "sha256-Ki6GmGryNQB8u/DpqdorJ1xysKsdC0u7HKImZ9b+oQk=",
|
||||||
"owner": "roc-lang",
|
"owner": "roc-lang",
|
||||||
"repo": "roc",
|
"repo": "roc",
|
||||||
"rev": "640bd15ca1dcf82bebe6a357e1a384b3ffdd4658",
|
"rev": "6cec54487278f9b271ae4b65260d735a331e5685",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1105,18 +1071,17 @@
|
||||||
},
|
},
|
||||||
"tsm": {
|
"tsm": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nim2nix": "nim2nix_2",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "nix",
|
"dir": "nix",
|
||||||
"lastModified": 1725560270,
|
"lastModified": 1723828016,
|
||||||
"narHash": "sha256-daF97eJRmjyGMr/sz+Bdd5ZbPvoLKS2p4edoh35jzto=",
|
"narHash": "sha256-s47lZE4T59+ohZpa5TqS1wKyTDYJOYO6yc7lM9giDJQ=",
|
||||||
"owner": "daylinmorgan",
|
"owner": "daylinmorgan",
|
||||||
"repo": "tsm",
|
"repo": "tsm",
|
||||||
"rev": "15e5cf6933a319503697f53d287e817fcafe7949",
|
"rev": "7fb9a2d6b4005a614cb19c7f376551252ddf1f14",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1128,15 +1093,15 @@
|
||||||
},
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nim2nix": "nim2nix_3",
|
"nim2nix": "nim2nix_2",
|
||||||
"nixpkgs": "nixpkgs_8"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725558444,
|
"lastModified": 1725474427,
|
||||||
"narHash": "sha256-ahxree7yZD9YuOUG0Z3R0qQjkGL+ZrgiKVcXa8kSNBo=",
|
"narHash": "sha256-xxsSqw22akPxbUyakThoBwZI0DuO/OkvigAX6zZFEeg=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "1032b97146ff7ef74df06e5e3babdde244c08280",
|
"rev": "b04a01afc3e79758a2ca337decd23bf51ad101a2",
|
||||||
"revCount": 11,
|
"revCount": 10,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.dayl.in/daylin/utils.git"
|
"url": "https://git.dayl.in/daylin/utils.git"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,50 +16,45 @@ proc runCmd*(cmd: string): int =
|
||||||
debug fmt"running cmd: {cmd}"
|
debug fmt"running cmd: {cmd}"
|
||||||
execCmd cmd
|
execCmd cmd
|
||||||
|
|
||||||
type
|
proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
|
||||||
CaptureGrp* = enum
|
|
||||||
CaptStdout
|
|
||||||
CaptStderr
|
|
||||||
|
|
||||||
proc runCmdCapt*(
|
|
||||||
cmd: string,
|
|
||||||
capture: set[CaptureGrp],
|
|
||||||
): tuple[stdout, stderr: string, exitCode: int] =
|
|
||||||
debug fmt"running cmd: {cmd}"
|
|
||||||
let args = cmd.splitWhitespace()
|
let args = cmd.splitWhitespace()
|
||||||
let p = startProcess(
|
let p = startProcess(
|
||||||
args[0],
|
args[0],
|
||||||
args = args[1..^1],
|
args = args[1..^1],
|
||||||
options = {poUsePath}
|
options = {poUsePath}
|
||||||
)
|
)
|
||||||
let
|
let outstrm = outputStream p
|
||||||
outstrm = peekableOutputStream p
|
let errstrm = errorStream p
|
||||||
errstrm = peekableErrorStream p
|
# result.exitCode = -1
|
||||||
result.exitCode = -1
|
# var line: string
|
||||||
var line: string
|
|
||||||
# var cnt: int
|
# var cnt: int
|
||||||
while true:
|
# while true:
|
||||||
if CaptStdout in capture:
|
# echo cnt
|
||||||
if outstrm.readLine(line):
|
# if outstrm.readLine(line):
|
||||||
result.stdout.add line & '\n'
|
# result.stdout.add line & '\n'
|
||||||
if CaptStderr in capture:
|
# if errstrm.readLine(line):
|
||||||
if errstrm.readLine(line):
|
# result.stderr.add line & '\n'
|
||||||
result.stderr.add line & '\n'
|
# result.exitCode = peekExitCode(p)
|
||||||
result.exitCode = peekExitCode(p)
|
# if result.exitCode != -1: break
|
||||||
if result.exitCode != -1: break
|
# inc cnt
|
||||||
|
echo "process should have started?"
|
||||||
# result.exitCode = waitForExit p
|
echo p.running, "<--running?"
|
||||||
|
p.resume
|
||||||
|
# result = (
|
||||||
|
# readAll outstrm,
|
||||||
|
# readAll errstrm,
|
||||||
|
# -1,
|
||||||
|
# )
|
||||||
|
echo "is this not reached?"
|
||||||
|
echo result
|
||||||
|
close p
|
||||||
# result.exitCode = waitForExit p
|
# result.exitCode = waitForExit p
|
||||||
# close p
|
# close p
|
||||||
close p
|
|
||||||
|
|
||||||
proc runCmdCaptWithSpinner*(
|
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =
|
||||||
cmd: string,
|
debug fmt"running command: {cmd}"
|
||||||
msg: string = "",
|
|
||||||
capture: set[CaptureGrp] = {CaptStdout}
|
|
||||||
): tuple[output, err: string] =
|
|
||||||
withSpinner(msg):
|
withSpinner(msg):
|
||||||
let (output, err, code) = runCmdCapt(cmd, capture)
|
let (output, err, code) = runCmdCapt(cmd)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
stderr.writeLine("stdout\n" & output)
|
stderr.writeLine("stdout\n" & output)
|
||||||
stderr.writeLine("stderr\n" & err)
|
stderr.writeLine("stderr\n" & err)
|
||||||
|
|
|
@ -111,7 +111,7 @@ proc toBuildNixosConfiguration(): seq[string] =
|
||||||
cmd.addArg "--dry-run"
|
cmd.addArg "--dry-run"
|
||||||
cmd.addArgs nixosConfigAttrs()
|
cmd.addArgs nixosConfigAttrs()
|
||||||
# let (_, err) = runCmdCaptWithSpinner(cmd, "running dry run build for: " & getHosts().join(" "))
|
# let (_, err) = runCmdCaptWithSpinner(cmd, "running dry run build for: " & getHosts().join(" "))
|
||||||
let (_, err, _) = runCmdCapt(cmd, {CaptStderr})
|
let (_, err, _) = runCmdCapt(cmd)
|
||||||
let output = parseDryRunOutput err
|
let output = parseDryRunOutput err
|
||||||
return output.toBuild.mapIt(it.storePath)
|
return output.toBuild.mapIt(it.storePath)
|
||||||
|
|
||||||
|
|
|
@ -179,13 +179,9 @@ proc error*(spinny: Spinny, msg: string) =
|
||||||
template withSpinner*(msg: string = "", body: untyped): untyped =
|
template withSpinner*(msg: string = "", body: untyped): untyped =
|
||||||
var spinner {.inject.} = newSpinny(msg, Dots)
|
var spinner {.inject.} = newSpinny(msg, Dots)
|
||||||
spinner.setSymbolColor(fgBlue)
|
spinner.setSymbolColor(fgBlue)
|
||||||
if isatty(stdout): # don't spin if it's not a tty
|
start spinner
|
||||||
start spinner
|
|
||||||
|
|
||||||
body
|
body
|
||||||
|
stop spinner
|
||||||
if isatty(stdout):
|
|
||||||
stop spinner
|
|
||||||
|
|
||||||
template withSpinner*(body: untyped): untyped =
|
template withSpinner*(body: untyped): untyped =
|
||||||
withSpinner("", body)
|
withSpinner("", body)
|
||||||
|
|
Loading…
Reference in a new issue