all repos — nixfiles @ e4f0b634766dfa52a3e3985c8e0ad19887e0cfad

System and user configuration, managed by nix and home-manager

move os update script to repo bin and call via just

Alin
commit

e4f0b634766dfa52a3e3985c8e0ad19887e0cfad

parent

c4af1a8e98ff24621ab47c31020a7d67292acfd8

1 file changed, 35 insertions(+), 0 deletions(-)

changed files
A bin/os_update_remote
@@ -0,0 +1,35 @@
+#!/usr/bin/env fish + +argparse --move-unknown "r/remote&" "b/build-host=&" "e/elevation-strategy=&" -- $argv + +set --local target $argv[1] +set --local actions $argv[2] switch + +set --local user_regex '(?<user>[[:graph:]]+)' +set --local host_regex '(?<host>[[:alnum:]\-]*)' +set --local fqdn_regex "(?<fqdn>$host_regex(?:\.[[:alnum:]\-.]+)?)" +string match --quiet --regex --groups-only "(?:$user_regex@)?$fqdn_regex" $target + +set --local action $actions[1] +set --local build_host $_flag_build_host $target + +set --local elevation_strategy $_flag_elevation_strategy ( + if test "$user" = "root" + echo none + else + echo passwordless + end +) + +if set --query _flag_remote; or set --query _flag_build_host + set --function build_host_arg --build-host $build_host[1] +end + +nh os $action \ + --file . nixosConfigurations.{$host} \ + $build_host_arg \ + --use-substitutes \ + --target-host {$target} \ + --show-trace \ + --elevation-strategy $elevation_strategy[1] \ + $argv_opts