-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
38 lines (30 loc) · 997 Bytes
/
justfile
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
35
36
37
# Define constants
IP := "192.168.2.12"
USER := "root"
SSH_USER := "raspy"
FLAKE := ".#homeserver"
# Define the default recipe to list available commands
default:
@just --list
# Wipes nixos, and puts new config on it. Also wipes the known host lines
wipe:
@echo "Removing known host entries for {{IP}}"
sed -i '/{{IP}}/d' ~/.ssh/known_hosts
nix run github:nix-community/nixos-anywhere -- --flake {{FLAKE}} {{USER}}@{{IP}}
# Local Rebuild nixos, no wipe
rebuild-local:
git fetch
git pull
sudo nixos-rebuild switch --flake {{FLAKE}}
# Rebuilds nixos, doesn't wipe
rebuild *args:
@echo "use --option eval-cache false for no cache"
nixos-rebuild switch --flake {{FLAKE}} --target-host {{USER}}@{{IP}} {{args}}
# Builds an SD image so you can flash this using dd!
image:
nix build .#nixosConfigurations.homeserver-image.config.system.build.sdImage
# Connects to the remote machine
connect-root:
ssh {{USER}}@{{IP}}
connect:
ssh {{SSH_USER}}@{{IP}}