Files
dotfiles/justfile
servius 34c0bf9616
Some checks failed
Flake checker / Build Nix targets (push) Has been cancelled
feat(Justfile): Add comments and update ast-grep pattern for program addition
2026-01-13 11:40:18 +05:30

43 lines
1.2 KiB
Makefile

set dotenv-load
[macos]
install:
sudo nix run nix-darwin -- switch --flake .
[linux]
install:
sudo nixos-rebuild switch --flake . --builders '' --max-jobs 1
[macos]
build:
nix run nix-darwin -- build --flake . --show-trace
[linux]
build:
nixos-rebuild build --flake . --show-trace
nix args:
nix --extra-experimental-features "nix-command flakes" {{args}}
home:
nix --extra-experimental-features "nix-command flakes" run home-manager/master -- switch --flake . --show-trace
nvim:
nix run .#neovim
[linux]
rollback:
sudo nixos-rebuild switch --rollback --flake .
add program:
echo '{pkgs, ...}: { home.packages = [pkgs.{{program}}];}' > home/programs/{{program}}.nix
# https://ast-grep.github.io/advanced/pattern-parse.html#incomplete-pattern-code
# Since the imports doesn't match the whole pattern we need to use the selector binding and the attr expression to match it properly.
ast-grep run -p '{ imports = [$$$ITEMS] }' --selector binding --rewrite 'imports = [$$$ITEMS ./{{program}}.nix ]' home/programs/default.nix -i
alejandra fmt home/programs/{{program}}.nix home/programs/default.nix
git add home/programs/{{program}}.nix