justfiles

This commit is contained in:
Tyrel Souza 2023-01-11 21:53:21 -05:00
parent d93dd1e643
commit 93d9761e03
2 changed files with 38 additions and 25 deletions

View File

@ -2,28 +2,6 @@
.PHONY: rebuild-macos
## Management
git-add:
git add .
update: update-neovim
update-os:
sudo nixos-rebuild switch
update-neovim:
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
sync:
sudo nix-channel --update
nix-channel --update
clean:
sudo nix-collect-garbage --delete-older-than 7d
home-manager expire-generations "-7 days"
rebuild-macos: git-add
./rebuild-macos.sh
rebuild-ubuntu: git-add
./rebuild-ubuntu.sh
install-just:
curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to ~/
sudo cp ~/just /usr/local/bin

35
justfile Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env -S just --justfile
# Naive check if /Users or /home for home.
OS := if "${HOME}" =~ '/U.*' { "macos" } else { "ubuntu" }
HOSTNAME := `hostname| sed 's/.local//'`
git-add:
git add .
update: update-neovim
update-os:
sudo nixos-rebuild switch
update-neovim:
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
sync:
sudo nix-channel --update
nix-channel --update
clean:
sudo nix-collect-garbage --delete-older-than 7d
home-manager expire-generations "-7 days"
rebuild: git-add clean
just rebuild-{{OS}}
rebuild-macos:
./result/sw/bin/darwin-rebuild switch --flake ./hosts/{{HOSTNAME}}
rebuild-ubuntu:
NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/tyrel/channels/nixpkgs:/nix/var/nix/profiles/per-user/tyrel/channels
nix run ./hosts/{{HOSTNAME}} switch -vv
home-manager switch --flake ./hosts/{{HOSTNAME}}