summaryrefslogtreecommitdiff
path: root/justfile
blob: ac69740728015e6aba0c3fa6206ae29b884268a8 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
alias b := build
alias c := check
alias d := deploy
alias da := deploy-all
alias dr := dry-run
alias p := pre-commit
alias sw := switch
alias sd := switch-and-deploy
alias t := test
alias u := update
alias ui := update-input

rebuildArgs := "--verbose"
rebuild := if os() == "macos" {"darwin-rebuild"} else {"nixos-rebuild"}
asRoot := if os() == "linux" {"true"} else {"false"}

default:
    @just --choose

[linux]
[macos]
[private]
rebuild subcmd root="false":
    {{ if root == "true" {"sudo "} else {""} }}{{rebuild}} {{subcmd}} {{rebuildArgs}} --flake .

[linux]
[macos]
build:
    @just rebuild build

check:
    nix flake check

deploy host:
    nix run .#{{ host }}

deploy-all: (deploy "atlas")

[linux]
[macos]
dry-run:
    @just rebuild dry-run

pre-commit:
    pre-commit run

[linux]
[macos]
switch:
    @just rebuild switch {{asRoot}}

switch-and-deploy: switch deploy-all

[linux]
[macos]
test:
    @just rebuild test {{asRoot}}

update:
    nix flake update

update-input input:
    nix flake lock \
      --update-input {{ input }} \
      --commit-lock-file \
      --commit-lockfile-summary "flake: update {{ input }}"