18 lines
703 B
Nu
18 lines
703 B
Nu
# cmd must be one string: nu treats bare --flags as belonging to `remote`.
|
|
def "main remote" [
|
|
host: string
|
|
cmd: string # e.g. "setup --clean" or "migrate /var/lib/hermes"
|
|
--flake: string = "git+ssh://gitea@gitea.skyg.ca/ari/hermenix.git"
|
|
] {
|
|
let words = $cmd | split row " " | where {|w| $w != "" }
|
|
if ($words | is-empty) {
|
|
die $'usage: hermenix remote <host> "<setup|migrate> [args...]"'
|
|
}
|
|
|
|
let quoted_args = $words | each {|a| shquote $a } | str join " "
|
|
let remote_cmd = $"nix run --no-write-lock-file --refresh (shquote $flake)#hermenix -- ($quoted_args)"
|
|
|
|
say $"Running on ($host): ($cmd)"
|
|
^ssh -t -o StrictHostKeyChecking=accept-new $host $remote_cmd
|
|
}
|