Thaw script
This commit is contained in:
parent
e28f136446
commit
1073f00c24
34
src/bin/thaw
Executable file
34
src/bin/thaw
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def main [
|
||||
--machine(-m): string # Machine flake to build
|
||||
--build-on-machine(-b) # Whether to build it on the given machine
|
||||
--push-to-machine(-p) # Whether or not to push the result to the given machine
|
||||
--print-build-logs(-L) # Print full build logs on standard error.
|
||||
command # 'nixos-rebuild' command to execute
|
||||
#...misc # misc parameters
|
||||
] {
|
||||
let flake = $".#($machine)"
|
||||
|
||||
let buildOnMachine = if $build_on_machine {
|
||||
$"--build-host ($machine)"
|
||||
}
|
||||
|
||||
let pushToMachine = if $push_to_machine {
|
||||
$"--target-host ($machine)"
|
||||
}
|
||||
|
||||
let printBuildLogs = if $print_build_logs {
|
||||
$"-L"
|
||||
}
|
||||
|
||||
let command = [
|
||||
"nixos-rebuild"
|
||||
$command
|
||||
$"--flake .#($machine)"
|
||||
$pushToMachine
|
||||
$buildOnMachine
|
||||
$printBuildLogs
|
||||
] | filter {|| $in | is-not-empty} | str join " "
|
||||
$command
|
||||
}
|
Loading…
Reference in a new issue