macs: Make darwin config a bit more robust
Eelco Dolstra committed
Aug 18, 2019 at 22:09 UTC
4cdcd7e5814848ed68d7130dd4dd460d2c372d7f
1 file changed
+15
-3
macs/guest/apply.sh
+15
-3
@@ -49,7 +49,7 @@ echo "%admin ALL = NOPASSWD: ALL" | tee /etc/sudoers.d/passwordless
49
export HOME=~root
50
export ALLOW_PREEXISTING_INSTALLATION=1
51
env
52
- curl https://nixos.org/releases/nix/nix-2.1.3/install > ~nixos/install-nix
52
+ curl https://nixos.org/releases/nix/nix-2.2.2/install > ~nixos/install-nix
53
chmod +rwx ~nixos/install-nix
54
cat /dev/null | sudo -i -H -u nixos -- sh ~nixos/install-nix --daemon
55
)
@@ -65,12 +65,17 @@ echo "%admin ALL = NOPASSWD: ALL" | tee /etc/sudoers.d/passwordless
65
ls -la /private/var || true
66
ls -la /private/var/run || true
67
ln -s /private/var/run /run || true
68
- nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
68
+
69
+ # todo: clean up this channel business, which is complicated because
70
+ # channels on darwin are a bit ill defined and have a very bad UX.
71
+ # If me, Graham, the author of the multi-user darwin installer can't
72
+ # even figure this out, how can I possibly expect anybody else to know.
73
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
74
+ nix-channel --add https://nixos.org/channels/nixpkgs-19.03-darwin nixpkgs
75
nix-channel --update
76
72
- sudo -i -H -u nixos -- nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
77
sudo -i -H -u nixos -- nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
78
+ sudo -i -H -u nixos -- nix-channel --add https://nixos.org/channels/nixpkgs-19.03-darwin nixpkgs
79
sudo -i -H -u nixos -- nix-channel --update
80
81
export NIX_PATH=$NIX_PATH:darwin=https://github.com/LnL7/nix-darwin/archive/master.tar.gz
@@ -91,5 +96,12 @@ echo "%admin ALL = NOPASSWD: ALL" | tee /etc/sudoers.d/passwordless
96
ln -s /etc/static/bashrc /etc/bashrc
97
. /etc/static/bashrc
98
cat /Volumes/CONFIG/darwin-configuration.nix | sudo -u nixos -- tee ~nixos/.nixpkgs/darwin-configuration.nix
99
+
100
+ while ! sudo -i -H -u nixos -- nix ping-store; do
101
+ cat /var/log/nix-daemon.log
102
+ sleep 1
103
+ done
104
+
105
sudo -i -H -u nixos -- darwin-rebuild switch
106
)
107
+