Thaw script

This commit is contained in:
Nox Sluijtman 2024-06-06 22:00:49 +02:00
parent e28f136446
commit 1073f00c24
Signed by: Egg
SSH key fingerprint: SHA256:2sG9X3C7Xvq2svGumz1/k7cm8l4G9+qAtAeugqB4J9M

34
src/bin/thaw Executable file
View 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
}