Compare commits

..

3 commits

Author SHA1 Message Date
3191780ea7 flake.lock: Update
Flake lock file updates:

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=9b54342baa27d8de0460e1103ec4c3cc65592ed8' (2024-09-03)
  → 'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=727f1b54cd1ba48774092a5d54acc0e55f3ffe0f' (2024-09-05)
• Updated input 'hyprland-contrib':
    'github:hyprwm/contrib/ae618eafa81b596db034c5df1d75d4eddf785824' (2024-09-02)
  → 'github:hyprwm/contrib/1e531dc49ad36c88b45bf836081a7a2c8927e072' (2024-09-05)
• Updated input 'lix':
    '02eb07cfd5.tar.gz?narHash=sha256-QBXwqyPuHUKBiuyzHBxqH/MpjPY9DQiY2M81P2t6b/0%3D&rev=02eb07cfd539c34c080cb1baf042e5e780c1fcc2' (2024-09-01)
  → '72589e7032.tar.gz?narHash=sha256-UtHpRNYPabG0zW3XB8Dldb68O7n1JLSUczTwg37dcsA%3D&rev=72589e703258e5cb4de091390291ff84c3a22bf2' (2024-09-03)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/12228ff1752d7b7624a54e9c1af4b222b3c1073b' (2024-08-31)
  → 'github:nixos/nixpkgs/ad416d066ca1222956472ab7d0555a6946746a80' (2024-09-04)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/52b72b12c456a5c0c87c40941ef79335e8d61104' (2024-09-02)
  → 'github:nix-community/nixpkgs-wayland/5502df5dcd4157b8195fdf61da29bb560f4bceab' (2024-09-05)
• Updated input 'nixpkgs-wayland/nixpkgs':
    'github:nixos/nixpkgs/71e91c409d1e654808b2621f28a327acfdad8dc2' (2024-08-28)
  → 'github:nixos/nixpkgs/ad416d066ca1222956472ab7d0555a6946746a80' (2024-09-04)
• Updated input 'pixi':
    'github:daylinmorgan/pixi-flake/e18817720f229f350e4d25eecda3ed24d99b2d53' (2024-08-29)
  → 'github:daylinmorgan/pixi-flake/820ce16a1a39c469628d8ccea077827779496bda' (2024-09-04)
• Updated input 'roc':
    'github:roc-lang/roc/c80eede300f1d48a307c4e5ace4fe13cbfc98c60' (2024-09-03)
  → 'github:roc-lang/roc/640bd15ca1dcf82bebe6a357e1a384b3ffdd4658' (2024-09-05)
• Updated input 'tsm':
    'github:daylinmorgan/tsm/7fb9a2d6b4005a614cb19c7f376551252ddf1f14?dir=nix' (2024-08-16)
  → 'github:daylinmorgan/tsm/15e5cf6933a319503697f53d287e817fcafe7949?dir=nix' (2024-09-05)
• Added input 'tsm/nim2nix':
    'github:daylinmorgan/nim2nix/42af12ca45025c7146bc24e27f5d8b65b003d663' (2024-09-04)
• Added input 'tsm/nim2nix/nixpkgs':
    'github:nixos/nixpkgs/d0e1602ddde669d5beb01aec49d71a51937ed7be' (2024-08-24)
• Updated input 'utils':
    'git+https://git.dayl.in/daylin/utils.git?ref=refs/heads/main&rev=03069333f260e50940eb4007cf15862bf23ab98e' (2024-09-03)
  → 'git+https://git.dayl.in/daylin/utils.git?ref=refs/heads/main&rev=1032b97146ff7ef74df06e5e3babdde244c08280' (2024-09-05)
• Updated input 'zig-overlay':
    'github:mitchellh/zig-overlay/fb3b6628ebf2e0c8e4e346d5ed1de5fce60ece07' (2024-09-03)
  → 'github:mitchellh/zig-overlay/5848c57bc396697ae4ed69f5e1295fe655c3ffae' (2024-09-05)
2024-09-05 19:10:43 +00:00
c995d60900
disable spinner 2024-09-05 14:08:08 -05:00
cd105ae69a
debug 2024-09-05 12:39:41 -05:00
4 changed files with 91 additions and 47 deletions

View file

@ -323,11 +323,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1725465540,
"narHash": "sha256-9OhDjPMwomJbGuIv5mFAvu/AV6ETTVHz08wVP1goNkY=",
"lastModified": 1725563063,
"narHash": "sha256-tnBDplJLVDCfQyU8QV/WMlKXWqdburHmC3tp2XZmhtA=",
"ref": "refs/heads/main",
"rev": "027140b7315efe3cd2e7b78fa608bd36da839894",
"revCount": 5184,
"rev": "727f1b54cd1ba48774092a5d54acc0e55f3ffe0f",
"revCount": 5188,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland/"
@ -559,6 +559,24 @@
}
},
"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": {
"nixpkgs": [
"utils",
@ -820,6 +838,22 @@
}
},
"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": {
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
@ -866,11 +900,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1725518286,
"narHash": "sha256-Ki6GmGryNQB8u/DpqdorJ1xysKsdC0u7HKImZ9b+oQk=",
"lastModified": 1725557788,
"narHash": "sha256-mPw63Fk1veQx18OVQijlvKbxxXF1uzI8N+0pF/tDnqE=",
"owner": "roc-lang",
"repo": "roc",
"rev": "6cec54487278f9b271ae4b65260d735a331e5685",
"rev": "640bd15ca1dcf82bebe6a357e1a384b3ffdd4658",
"type": "github"
},
"original": {
@ -1071,17 +1105,18 @@
},
"tsm": {
"inputs": {
"nim2nix": "nim2nix_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"dir": "nix",
"lastModified": 1723828016,
"narHash": "sha256-s47lZE4T59+ohZpa5TqS1wKyTDYJOYO6yc7lM9giDJQ=",
"lastModified": 1725560270,
"narHash": "sha256-daF97eJRmjyGMr/sz+Bdd5ZbPvoLKS2p4edoh35jzto=",
"owner": "daylinmorgan",
"repo": "tsm",
"rev": "7fb9a2d6b4005a614cb19c7f376551252ddf1f14",
"rev": "15e5cf6933a319503697f53d287e817fcafe7949",
"type": "github"
},
"original": {
@ -1093,15 +1128,15 @@
},
"utils": {
"inputs": {
"nim2nix": "nim2nix_2",
"nixpkgs": "nixpkgs_7"
"nim2nix": "nim2nix_3",
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1725474427,
"narHash": "sha256-xxsSqw22akPxbUyakThoBwZI0DuO/OkvigAX6zZFEeg=",
"lastModified": 1725558444,
"narHash": "sha256-ahxree7yZD9YuOUG0Z3R0qQjkGL+ZrgiKVcXa8kSNBo=",
"ref": "refs/heads/main",
"rev": "b04a01afc3e79758a2ca337decd23bf51ad101a2",
"revCount": 10,
"rev": "1032b97146ff7ef74df06e5e3babdde244c08280",
"revCount": 11,
"type": "git",
"url": "https://git.dayl.in/daylin/utils.git"
},

View file

@ -16,45 +16,50 @@ proc runCmd*(cmd: string): int =
debug fmt"running cmd: {cmd}"
execCmd cmd
proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
type
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 p = startProcess(
args[0],
args = args[1..^1],
options = {poUsePath}
)
let outstrm = outputStream p
let errstrm = errorStream p
# result.exitCode = -1
# var line: string
let
outstrm = peekableOutputStream p
errstrm = peekableErrorStream p
result.exitCode = -1
var line: string
# var cnt: int
# while true:
# echo cnt
# if outstrm.readLine(line):
# result.stdout.add line & '\n'
# if errstrm.readLine(line):
# result.stderr.add line & '\n'
# result.exitCode = peekExitCode(p)
# if result.exitCode != -1: break
# inc cnt
echo "process should have started?"
echo p.running, "<--running?"
p.resume
# result = (
# readAll outstrm,
# readAll errstrm,
# -1,
# )
echo "is this not reached?"
echo result
close p
while true:
if CaptStdout in capture:
if outstrm.readLine(line):
result.stdout.add line & '\n'
if CaptStderr in capture:
if errstrm.readLine(line):
result.stderr.add line & '\n'
result.exitCode = peekExitCode(p)
if result.exitCode != -1: break
# result.exitCode = waitForExit p
# result.exitCode = waitForExit p
# close p
close p
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =
debug fmt"running command: {cmd}"
proc runCmdCaptWithSpinner*(
cmd: string,
msg: string = "",
capture: set[CaptureGrp] = {CaptStdout}
): tuple[output, err: string] =
withSpinner(msg):
let (output, err, code) = runCmdCapt(cmd)
let (output, err, code) = runCmdCapt(cmd, capture)
if code != 0:
stderr.writeLine("stdout\n" & output)
stderr.writeLine("stderr\n" & err)

View file

@ -111,7 +111,7 @@ proc toBuildNixosConfiguration(): seq[string] =
cmd.addArg "--dry-run"
cmd.addArgs nixosConfigAttrs()
# let (_, err) = runCmdCaptWithSpinner(cmd, "running dry run build for: " & getHosts().join(" "))
let (_, err, _) = runCmdCapt(cmd)
let (_, err, _) = runCmdCapt(cmd, {CaptStderr})
let output = parseDryRunOutput err
return output.toBuild.mapIt(it.storePath)

View file

@ -179,9 +179,13 @@ proc error*(spinny: Spinny, msg: string) =
template withSpinner*(msg: string = "", body: untyped): untyped =
var spinner {.inject.} = newSpinny(msg, Dots)
spinner.setSymbolColor(fgBlue)
start spinner
if isatty(stdout): # don't spin if it's not a tty
start spinner
body
stop spinner
if isatty(stdout):
stop spinner
template withSpinner*(body: untyped): untyped =
withSpinner("", body)