grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderi dont remember7b15e76

main
831 B19 linesraw
1target host:
2    #!/usr/bin/env fish
3    set host {{quote(host)}}
4    string match --quiet --regex '^[a-zA-Z0-9][a-zA-Z0-9-]*$' -- $host; or exit 2
5    set archive (nix flake archive --to ssh://grace@dijkstra.i.gae.moe --json .)
6    or exit 1
7    set source (printf '%s\n' $archive | jq -er .path)
8    or exit 1
9    ssh grace@dijkstra.i.gae.moe \
10        "sudo -n systemd-run --unit=nixos-remote --collect --service-type=exec --uid=grace \
11        --setenv=PATH=/run/current-system/sw/bin:/usr/bin:/bin \
12        /run/current-system/sw/bin/nixos-rebuild switch \
13        --flake $source#$host --target-host grace@$host.i.gae.moe --sudo"
14
15logs:
16    ssh grace@dijkstra.i.gae.moe 'sudo -n journalctl --unit=nixos-remote.service --invocation=0 --lines=100 --follow --no-pager'
17
18gc host:
19    ssh {{host}} -- sudo nix-collect-garbage -d