From 1073f00c240d7fc80712f08f49c13fdeb9444e26 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Thu, 6 Jun 2024 22:00:49 +0200 Subject: [PATCH] Thaw script --- src/bin/thaw | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 src/bin/thaw 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 +}