-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap
executable file
·49 lines (39 loc) · 1.24 KB
/
bootstrap
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
#!/usr/bin/env bash
# NixOS bootstrap script
# Run this script on a clean install of NixOS to bootstrap it with my configs
OFF='\033[0m' # Text Reset
RED='\033[0;31m' # Red
BLUE='\033[0;34m' # Blue
export NIX_FLAGS="--extra-experimental-features flakes --extra-experimental-features nix-command"
export AUTHPATH="$(which sudo)"
if [[ -f "$(which doas)" ]]; then
export AUTHPATH="$(which doas)"
fi
function log(){
echo -e "$BLUE~>$OFF $1"
}
function homeManagerSetup(){
nix run '.#activate/celeste' $NIX_FLAGS
}
log "Bootstrap github: https://github.com/Interfiber/dotfiles"
log "Bootstrap author: Interfiber<webmaster@interfiber.dev>"
echo ""
echo ""
log "Formatting codebase..."
nix run $NIX_FLAGS nixpkgs#alejandra -- .
log "Updating Nix flake lock file..."
nix flake update $NIX_FLAGS
if [[ "$1" == "--only-home-manager" ]]; then
log "Building home-manager config flake..."
homeManagerSetup
exit 0
fi
export REBUILD_FLAGS=""
if [[ "$1" == "--update-grub" ]]; then
export REBUILD_FLAGS="--install-bootloader"
log "Notice: System update will also update GRUB"
fi
log "Applying system config..."
command $AUTHPATH nixos-rebuild switch --flake .# $REBUILD_FLAGS
log "Building home-manager config flake..."
homeManagerSetup