aboutsummaryrefslogtreecommitdiffhomepage
path: root/justfile
blob: 78345cd2440f4cfe00adacc9bd7f3a3cd9bf2d15 (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
default_host := trim_start_match(file_stem(shell('grep -R -l "$1" "$2"', '"hostname": "' + shell('uname -n') + '"', join(justfile_directory(), "mitamae"))), 'node.')

help:
    @just --list

update HOST=default_host:
    nix flake update
    just update-and-commit "{{HOST}}"

update-nur-packages HOST=default_host:
    nix flake update nur-packages
    just update-and-commit "{{HOST}}"

update-and-commit HOST:
    just switch "{{HOST}}"
    just generate-package-versions
    git add -- flake.lock home-manager/package-versions.txt
    git commit -m "nix: update flake"
    git diff --color=always HEAD~ -- home-manager/package-versions.txt

sync HOST=default_host:
    git fetch --all
    if git diff --quiet; then \
        git switch -d origin/main; \
    else \
        git stash save; \
        git switch -d origin/main; \
        git stash pop; \
    fi
    just switch "{{HOST}}"

switch HOST=default_host:
    home-manager switch --flake ".#{{HOST}}"

generate-package-versions:
    home-manager packages | grep -v '\bman$' > home-manager/package-versions.txt

gc:
    home-manager expire-generations '-1 month'
    nix profile wipe-history
    nix store gc

# TODO
copy-claude-code-settings:
    cp .config/claude/settings.json ~/.claude/settings.json