-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
45 lines (32 loc) · 1.15 KB
/
Vagrantfile
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
Vagrant.configure("2") do |config|
config.vm.box = "debian/bookworm64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provision "shell", inline: <<-SHELL
# install nix
apt-get update && apt-get install -y curl git
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# setup user
useradd -ms /bin/bash claytonjy
cp -pr /home/vagrant/.ssh /home/claytonjy
chown -R claytonjy:claytonjy /home/claytonjy
echo "claytonjy ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# run home-manager bootstrap commands as user
sudo -u claytonjy -i bash <<'EOF'
# bootstrap home-manager
mkdir -p ~/.local/state/nix/profiles
nix run home-manager/master -- switch --flake /vagrant
# change shell to fish
echo $(which fish) | sudo tee -a /etc/shells
sudo chsh -s $(which fish) "$USER"
# install poetry w/ pipx
pipx install poetry
EOF
SHELL
VAGRANT_COMMAND = ARGV[0]
if VAGRANT_COMMAND == "ssh"
config.ssh.username = 'claytonjy'
end
end