all repos — nixfiles @ edaa5128dfb3dd4234e07c69f10475ddc9f2fe76

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

scripts/os/update (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env fish
# update server with nixos-rebuild

if test (path basename $PWD) != nixfiles
    echo "not in nixfiles directory!" >&2
    return 1
end

argparse --move-unknown "r/remote&" "b/build-host=&" "e/elevation-strategy=&" -- $argv

set --local target "$argv[1]"
if test -z $target
    echo "please specify target hostname" >&2
    return 1
end

set --local targetPlainHostname (string split --fields 1 --max 1 . $target)
set --local actions $argv[2] switch
set --local action $actions[1]
set --local build_host $_flag_build_host $target
set --local elevation_strategy $_flag_elevation_strategy passwordless

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.{$targetPlainHostname} \
    $build_host_arg \
    --use-substitutes \
    --target-host {$target} \
    --show-trace \
    --elevation-strategy $elevation_strategy[1] \
    $argv_opts