62 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| set -o errexit
 | |
| set -o nounset
 | |
| set -o pipefail
 | |
| 
 | |
| function build {
 | |
|   _nixos build "$@"
 | |
| }
 | |
| 
 | |
| function clean {
 | |
|   nix store optimise --verbose
 | |
|   nix store gc --verbose
 | |
| }
 | |
| 
 | |
| function check {
 | |
|   nix flake check
 | |
| }
 | |
| 
 | |
| function clean {
 | |
|   nix store gc --verbose
 | |
|   nix store optimise --verbose
 | |
| }
 | |
| 
 | |
| 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 switch {
 | |
|   _nixos switch "$@"
 | |
| }
 | |
| 
 | |
| function test {
 | |
|   _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}"
 |