-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·46 lines (33 loc) · 1.43 KB
/
setup.sh
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
#!/usr/bin/env bash
set -eu
#
# set up a devbox with an orbstack vm
#
NAME=${NAME:-nixos}
ORB_CMD="orb -m $NAME"
SET_DEFAULT="${SET_DEFAULT:-true}"
# create vm
orbctl create nixos "$NAME"
[ "$SET_DEFAULT" == "true" ] && orbctl default "$NAME"
# switch to unstable, this needs root
$ORB_CMD sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
$ORB_CMD sudo nixos-rebuild switch --upgrade
# install home-manager. the version maps to the nix release being used.
# unstable,
$ORB_CMD nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
# 23.05,
# $ORB_CMD nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
$ORB_CMD nix-channel --update
$ORB_CMD nix-shell '<home-manager>' -A install
# run home-manager
DOTFILES_DIR=/Users/nate/code/dotfiles
$ORB_CMD home-manager switch -f "${DOTFILES_DIR}/home-manager/home.nix"
# run nixos-rebuild
$ORB_CMD sudo nixos-rebuild switch -I nixos-config="${DOTFILES_DIR}/configuration.nix"
# the host's $HOME will be mounted automatically at /Users/<user>, create some symlinks between the host and the guest
# homedirs for ergonomics
$ORB_CMD ln -s ~/.local/share/fish/fish_history /home/nate/.local/share/fish/fish_history
$ORB_CMD ln -s ~/code/ /home/nate/code
$ORB_CMD rm /home/nate/.gitconfig
$ORB_CMD ln -s ~/.gitconfig /home/nate/.gitconfig
echo "Done!"