You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nixos-template-base/Makefile

109 lines
2.5 KiB
Makefile

GSF=git submodule foreach
TIME=time
CHRONY_STATUS=chronyc tracking
CHRONY_STATS=chronyc sources -v
all: rebuild-switch
date
##--------- Commandes spécifiques pour NixOS
clean:
$(TIME) nix-collect-garbage -d --delete-older-than 15d
clean-aggressive:
$(TIME) nix-collect-garbage -d --delete-older-than 1d
clean-total:
$(TIME) nix-collect-garbage -d
clean-log:
journalctl --flush --rotate
journalctl --vacuum-size=1G
full-auto: submodules-update upgrade clean optimise
@date
optimise:
$(TIME) nix-store --optimise
rebuild-build:
nix-channel --add https://nixos.org/channels/nixos-18.03 nixos
$(TIME) time nixos-rebuild build --fallback --show-trace
rebuild-switch:
$(TIME) time nixos-rebuild switch --fallback --show-trace
show-blackholed:
-@ip route |grep blackhole |wc -l| awk '{print "Il y a "$$1" route(s) en blackhole sur";system("hostname ")}' |cowsay
show-diff-with-current:
-diff /run/current-system/configuration.nix /etc/nixos/configuration.nix
show-roots:
nix-store --gc --print-roots
show-time:
-@$(CHRONY_STATUS) && $(CHRONY_STATS)
-@watch -d -n 5 "$(CHRONY_STATUS) && echo "--" && $(CHRONY_STATS)"
store-repair:
$(TIME) nix-store --verify --check-contents --repair
upgrade:
nix-channel --add https://nixos.org/channels/nixos-18.03 nixos
$(TIME) nixos-rebuild switch --upgrade --fallback --show-trace
##--------- Commandes spécifiques pour NixOS -- Opérations non courantes
download-sources:
# https://nixos.org/wiki/Download_all_sources
nix-store -r $$(grep -l outputHash $$(nix-store -qR $$(nix-instantiate '<nixpkgs>' -A geeqie) | grep '.drv$$'))
build-iso:
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=/etc/nixos/base/iso-image/livecd-minimal.nix
##--------- Commandes spécifiques pour GIT
push: submodules-push
git push --all
git push --tags
submodules-update:
#git submodule update --remote
#$(GSF) git co master
$(GSF) git ff
$(GSF) git gc --auto
submodules-push:
$(GSF) git push --all
$(GSF) git push --tags
submodules-tag:
$(GSF) git tag -f "$$(date +%F)-$$(hostname -s)"
template:
find . -name "*.nix" -exec meld /etc/nixos/base/module-template.nix {} \;
tag: submodules-tag
git tag -f "$$(date +%F)-$$(hostname -s)"
##--------- Munin
munin:
pushd /var/www/munin/ ; python -m SimpleHTTPServer 8000
##--------- Gestion d'un système de fichier monté en mémoire
tmpfs-create:
mkdir -p /mnt/tmpfs
tmpfs-mount: tmpfs-create
mount -t tmpfs -o size=10G tmpfs /mnt/tmpfs
tmpfs-umount:
umount /mnt/tmpfs
tmpfs-destroy: tmpfs-umount
rmdir /mnt/tmpfs