Files
dotfiles/Makefile
T
Pierre Martin 4072cfe7e7 fix(make): find sans résultat bloquait sur stdin
- xargs -0 -r sur toutes les cibles : si find ne retourne rien,
  nixfmt/shfmt lisaient stdin et make fmt/check restait bloqué
  (testé et reproduit avant correction)
- CLAUDE.md : retire la ligne shell.nix (fichier inexistant)
2026-09-07 10:41:29 +02:00

58 lines
1.5 KiB
Makefile

.PHONY: all fmt fmt-nix fmt-shell lint lint-shell check clean apply update gc
export NIX_PAGER=
all: fmt lint
# Formatage
fmt: fmt-nix fmt-shell
fmt-nix:
find . -name '*.nix' -not -path './.direnv/*' -print0 | xargs -0 -r nixfmt
fmt-shell:
find . -name '*.sh' -not -path './.direnv/*' -print0 | xargs -0 -r shfmt -w -i 2
# Validation
lint: lint-shell
lint-shell:
find . -name '*.sh' -not -path './.direnv/*' -print0 | xargs -0 -r shellcheck
# Vérification sans modification
check:
find . -name '*.nix' -not -path './.direnv/*' -print0 | xargs -0 -r nixfmt --check
find . -name '*.sh' -not -path './.direnv/*' -print0 | xargs -0 -r shfmt -d -i 2
# Nettoyage
clean:
rm -rf .direnv result
# Appliquer la config sans mise à jour ni nettoyage
apply:
sudo nixos-rebuild switch
# Mise à jour NixOS + home-manager + garbage collect
update:
sudo nixos-rebuild switch --upgrade-all
$(MAKE) gc
# Nettoyage Nix (générations > 14 jours + garbage collect)
gc:
@echo "=== Générations utilisateur ==="
nix-env --list-generations
@echo ""
@echo "Suppression des générations utilisateur > 14 jours..."
nix-env --delete-generations 14d
@echo ""
@echo "=== Générations système ==="
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
@echo ""
@echo "Suppression des générations système > 14 jours..."
sudo nix-env --delete-generations 14d --profile /nix/var/nix/profiles/system
@echo ""
@echo "=== Garbage collection ==="
sudo nix-collect-garbage
@echo ""
@echo "=== Espace disque /nix/store ==="
du -sh /nix/store