2024-07-08 18:20:17 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
|
2025-02-14 07:48:53 +00:00
|
|
|
function build {
|
|
|
|
_nixos build "$@"
|
|
|
|
}
|
|
|
|
|
2024-07-08 18:20:17 +00:00
|
|
|
function check {
|
|
|
|
nix flake check
|
|
|
|
}
|
|
|
|
|
2024-11-25 08:03:59 +00:00
|
|
|
function collect-garbage {
|
|
|
|
nix-collect-garbage -d
|
|
|
|
sudo nix-collect-garbage -d
|
|
|
|
}
|
|
|
|
|
2024-09-23 12:17:10 +00:00
|
|
|
function format {
|
|
|
|
nix fmt flake.nix home hosts lib modules
|
|
|
|
}
|
|
|
|
|
2024-07-08 18:20:17 +00:00
|
|
|
function help {
|
|
|
|
printf "%s <task> [args]\n\nTasks:\n" "$0"
|
|
|
|
|
|
|
|
compgen -A function | grep -v "^_" | cat -n
|
|
|
|
|
|
|
|
printf "\nExtended help:\n Each task has comments for general usage\n"
|
|
|
|
}
|
|
|
|
|
2025-02-14 07:48:53 +00:00
|
|
|
function switch {
|
2024-07-08 18:20:17 +00:00
|
|
|
_nixos switch "$@"
|
|
|
|
}
|
|
|
|
|
2025-02-14 07:48:53 +00:00
|
|
|
function test {
|
2024-07-08 18:20:17 +00:00
|
|
|
_nixos test "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
function update {
|
|
|
|
nix flake update
|
|
|
|
}
|
|
|
|
|
|
|
|
function _nixos {
|
|
|
|
local command="$1"
|
|
|
|
shift 1
|
|
|
|
|
|
|
|
sudo nixos-rebuild "$command" --flake . "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
TIMEFORMAT=$'\nTask completed in %3lR'
|
|
|
|
time "${@:-help}"
|