dotfiles/justfile

76 lines
2.4 KiB
Makefile
Raw Permalink 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 {
2023-01-18 02:16:37 +00:00
if `cat /etc/issue 2>/dev/null || true` =~ "Deb.*" { "debian" } else { "ubuntu" }
2023-01-17 23:19:04 +00:00
}
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-11-16 17:20:56 +00:00
update-hm:
NIX_PATH={{NIXPATH}} nix-shell '<home-manager>' -A update
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-02-18 04:28:19 +00:00
experimental:
mkdir -p ~/.config/nix
echo "extra-experimental-features = flakes nix-command" ~/.config/nix/nix.conf
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'
2023-07-05 05:28:54 +00:00
pi:
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerInstall'
2023-01-12 02:53:21 +00:00
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-18 02:16:37 +00:00
rebuild: git-add
2023-01-12 02:53:21 +00:00
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-18 02:16:37 +00:00
just clean
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}}
2023-01-18 02:16:37 +00:00
just clean