diff --git a/src/bin/thaw b/src/bin/thaw new file mode 100755 index 0000000..955e5de --- /dev/null +++ b/src/bin/thaw @@ -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 +}