|
|
|
GSF=git submodule foreach
|
|
|
|
TIME=time
|
|
|
|
|
|
|
|
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:
|
|
|
|
$(TIME) time nixos-rebuild build --fallback --show-trace
|
|
|
|
|
|
|
|
rebuild-switch:
|
|
|
|
$(TIME) time nixos-rebuild switch --fallback --show-trace
|
|
|
|
|
|
|
|
show-diff-with-current:
|
|
|
|
-diff /run/current-system/configuration.nix /etc/nixos/configuration.nix
|
|
|
|
|
|
|
|
show-roots:
|
|
|
|
nix-store --gc --print-roots
|
|
|
|
|
|
|
|
store-repair:
|
|
|
|
$(TIME) nix-store --verify --check-contents --repair
|
|
|
|
|
|
|
|
upgrade:
|
|
|
|
$(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
|
|
|
|
|