mirror of
https://github.com/Cian-H/My_NixOS_Config.git
synced 2026-01-18 10:21:57 +00:00
Improved justfile
This commit is contained in:
51
justfile
51
justfile
@@ -1,11 +1,29 @@
|
||||
set shell := ["bash", "-c"]
|
||||
|
||||
git := "true"
|
||||
flake := "true"
|
||||
flatpak := "true"
|
||||
|
||||
default:
|
||||
@just --list
|
||||
|
||||
prebuild:
|
||||
_git-sync:
|
||||
git pull --recurse
|
||||
git submodule update --remote --recursive
|
||||
|
||||
_flake-update:
|
||||
nix flake update
|
||||
|
||||
prebuild:
|
||||
@if [ "{{git}}" == "true" ]; then \
|
||||
echo ">> Syncing Git..."; \
|
||||
just _git-sync; \
|
||||
fi
|
||||
@if [ "{{flake}}" == "true" ]; then \
|
||||
echo ">> Updating Flake..."; \
|
||||
just _flake-update; \
|
||||
fi
|
||||
|
||||
_update-root:
|
||||
if `/usr/bin/env grep -Rq "nixos" /etc/*-release`; then \
|
||||
sudo nixos-rebuild switch --flake .?submodules=1#$HOSTNAME; \
|
||||
@@ -24,8 +42,35 @@ _update-home:
|
||||
|
||||
update-home: prebuild _update-home
|
||||
|
||||
update: prebuild _update-root _update-home
|
||||
update-flatpaks:
|
||||
@if [ "{{flatpak}}" == "true" ] && command -v flatpak &> /dev/null; then \
|
||||
echo ">> Updating Flatpaks..."; \
|
||||
flatpak update -y; \
|
||||
flatpak uninstall --unused -y; \
|
||||
else \
|
||||
echo ">> Flatpak not found or disabled. Skipping."; \
|
||||
fi
|
||||
|
||||
cleanup:
|
||||
history:
|
||||
@echo ">> System Generations:"
|
||||
@nix-env -p /nix/var/nix/profiles/system --list-generations | tail -n 5
|
||||
@echo "\n>> Home Manager Generations:"
|
||||
@home-manager generations | head -n 5
|
||||
|
||||
repl:
|
||||
nix repl --file flake.nix
|
||||
|
||||
update: prebuild _update-root _update-home update-flatpaks
|
||||
|
||||
cleanup days="":
|
||||
@if [ -n "{{days}}" ]; then \
|
||||
echo ">> Deleting system generations older than {{days}}..."; \
|
||||
sudo nix-collect-garbage --delete-older-than {{days}}; \
|
||||
fi
|
||||
@echo ">> Cleaning Nix Store..."
|
||||
nix-store --gc
|
||||
nix-store --optimise
|
||||
@if command -v flatpak &> /dev/null; then \
|
||||
echo ">> Cleaning unused Flatpaks..."; \
|
||||
flatpak uninstall --unused -y; \
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user