-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·71 lines (53 loc) · 1.11 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
function check {
nix flake check
}
function collect-garbage {
nix-collect-garbage -d
sudo nix-collect-garbage -d
}
function format {
nix fmt flake.nix home hosts lib modules
}
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"
}
function home-manager:build {
_home build "$@"
}
function home-manager:switch {
_home switch "$@"
}
function nixos:build {
_nixos build "$@"
}
function nixos:switch {
_nixos switch "$@"
}
function nixos:test {
_nixos test "$@"
}
function update {
nix flake update
}
function _home {
local command="$1"
shift 1
NIXPKGS_ALLOW_UNFREE=1 home-manager "$command" \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
--flake ".#$(whoami)@$(hostname)" \
--impure "$@"
}
function _nixos {
local command="$1"
shift 1
sudo nixos-rebuild "$command" --flake . "$@"
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"