dotfiles/justfile

64 lines
2.1 KiB
Makefile
Raw Normal View History

2023-01-12 02:53:21 +00:00
#!/usr/bin/env -S just --justfile
# Naive check if /Users or /home for home.
2023-01-17 23:19:04 +00:00
OS := if "${HOME}" =~ '/U.*' {
"macos"
} else {
if `cat /etc/issue | grep -i debian` =~ "Deb.*" { "debian" } else { "ubuntu" }
}
2023-01-12 02:53:21 +00:00
HOSTNAME := `hostname| sed 's/.local//'`
2023-01-16 05:55:12 +00:00
NIXPATH := "nixpkgs=/nix/var/nix/profiles/per-user/tyrel/channels/nixpkgs:/nix/var/nix/profiles/per-user/tyrel/channels"
setup:
just setup-{{OS}}
setup-ubuntu:
NIX_PATH={{NIXPATH}} nix-channel --add https://nixos.org/channels/nixos-22.11 nixos
NIX_PATH={{NIXPATH}} nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager
2023-01-17 23:34:52 +00:00
NIX_PATH={{NIXPATH}} nix-channel --add https://channels.nixos.org/nixos-22.11 nixpkgs
2023-01-16 05:55:12 +00:00
NIX_PATH={{NIXPATH}} nix-channel --update
NIX_PATH={{NIXPATH}} nix-shell '<home-manager>' -A install
2023-01-12 02:53:21 +00:00
2023-01-17 23:19:04 +00:00
setup-debian:
NIX_PATH={{NIXPATH}} nix-channel --add https://nixos.org/channels/nixos-22.11 nixos
NIX_PATH={{NIXPATH}} nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager
2023-01-17 23:34:52 +00:00
NIX_PATH={{NIXPATH}} nix-channel --add https://channels.nixos.org/nixos-22.11 nixpkgs
2023-01-17 23:19:04 +00:00
NIX_PATH={{NIXPATH}} nix-channel --update
NIX_PATH={{NIXPATH}} nix-shell '<home-manager>' -A install
2023-01-12 02:53:21 +00:00
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:
2023-01-12 03:20:33 +00:00
nix-collect-garbage --delete-older-than 7d
2023-01-12 02:53:21 +00:00
home-manager expire-generations "-7 days"
2023-01-17 23:54:19 +00:00
vimpacker:
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
2023-01-12 02:53:21 +00:00
rebuild: git-add clean
just rebuild-{{OS}}
rebuild-macos:
./result/sw/bin/darwin-rebuild switch --flake ./hosts/{{HOSTNAME}}
rebuild-ubuntu:
2023-01-16 05:55:12 +00:00
NIX_PATH={{NIXPATH}} nix run ./hosts/{{HOSTNAME}} switch -vv
NIX_PATH={{NIXPATH}} home-manager switch --flake ./hosts/{{HOSTNAME}}
2023-01-17 23:45:16 +00:00
2023-01-17 23:54:19 +00:00
rebuild-debian:
NIX_PATH={{NIXPATH}} nix run ./hosts/{{HOSTNAME}} switch -vv
NIX_PATH={{NIXPATH}} home-manager switch --flake ./hosts/{{HOSTNAME}}