-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmain.nu
More file actions
executable file
·25 lines (20 loc) · 976 Bytes
/
main.nu
File metadata and controls
executable file
·25 lines (20 loc) · 976 Bytes
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
#!/usr/bin/env nu
def "main deploy" [ host: string ] {
let toplevel = (^nix eval --raw $".#nixosConfigurations.($host).config.system.build.toplevel")
let dl_cmd = (^printf "'%s' " ...[$"sudo" "nix" "build" "--no-link" "--accept-flake-config" "--option" "narinfo-cache-negative-ttl" "0" $"--profile" "/nix/var/nix/profiles/system" $toplevel ])
let switch_cmd = (^printf "'%s' " ...[ "sudo" $"($toplevel)/bin/switch-to-configuration" "switch" ])
let cmd = $"($dl_cmd) && ($switch_cmd)"
^ssh $"cole@($host)" -- $cmd
header "light_green_reverse" $"deploy\(($host)\): done"
print -e $"(char nl)"
}
def "main selfup" [] {
sudo nix build --accept-flake-config --profile "/nix/var/nix/profiles/system" $".#toplevels.(^hostname | str trim)"
sudo ./result/bin/switch-to-configuration switch
}
def "main darwinup" [] {
sudo darwin-rebuild switch --option narinfo-cache-negative-ttl 0 --flake /Users/cole/code/nixcfg
}
def main [] {
print -e "run a command!"
}