Skip to content

Commit fe8584e

Browse files
committed
Fix some more things
1 parent bfcd78f commit fe8584e

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

arion-compose.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ in
102102
];
103103
interval = "10s";
104104
timeout = "5s";
105-
start_period = "15m";
105+
start_period = "120m";
106106
retries = 3;
107107
};
108108
};

config/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ http {
4040
proxy_redirect off;
4141
}
4242
}
43-
}
43+
}

flake.nix

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
environment.systemPackages = with pkgs; [ htop curl ];
109109

110110
virtualisation = {
111-
diskSize = 8000; # MB
112-
memorySize = 2048; # MB
111+
diskSize = 25000; # MB
112+
memorySize = 8196; # MB
113113
writableStoreUseTmpfs = false;
114114
};
115115
services.qemuGuest.enable = true;
@@ -124,20 +124,41 @@
124124
let
125125
pkgs = pkgsFor system;
126126
vm = nixosConfigurations.seabug-vm.config.system.build.vm;
127+
path = pkgs.lib.makeBinPath (with pkgs; [
128+
busybox
129+
curl
130+
openssh
131+
python3
132+
qemu
133+
sshpass
134+
vm
135+
]);
127136
program = pkgs.writeShellScript "run-vm" ''
128137
set -euo pipefail
129-
# set -x
138+
set -x
130139
131-
[ -x nixos.qcow2 ] && echo "⚠️ nixos.qcow2 already exists..."
140+
export PATH=${pkgs.lib.escapeShellArg path}
141+
142+
(![ -x nixos.qcow2 ] || echo "⚠️ nixos.qcow2 already exists...")
132143
133144
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:8080"
134145
export QEMU_OPTS="-serial stdio"
135-
${vm}/bin/run-nixos-vm &
146+
run-nixos-vm &
136147
PID=$!
137148
138-
sleep 3
139-
${pkgs.sshpass}/bin/sshpass -p toor \
140-
${pkgs.openssh}/bin/ssh [email protected] -p 2221 \
149+
# Wait for ssh port to open
150+
while ! (echo | telnet localhost:2221);
151+
do
152+
if ! kill -0 $PID; then
153+
echo "❌ VM failed to start"
154+
exit 1
155+
fi
156+
sleep 0.2;
157+
done
158+
159+
# Show arion log
160+
sshpass -p toor \
161+
ssh [email protected] -p 2221 \
141162
-o "UserKnownHostsFile=/dev/null" \
142163
-o "StrictHostKeyChecking=no" \
143164
journalctl -f -u arion-seabug.service &
@@ -152,7 +173,7 @@
152173
sleep 1;
153174
done
154175
155-
${pkgs.python3}/bin/python -m webbrowser http://localhost:8080 &
176+
python -m webbrowser http://localhost:8080 &
156177
157178
# Wait for the VM to exit
158179
wait $PID

seabug-module.nix

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
{ arionModule, seabugOverlay }: { lib
2-
, config
3-
, ...
4-
}:
1+
{ arionModule, seabugOverlay }:
2+
{ lib, config, ... }:
3+
54
with lib; let
65
cfg = config.services.seabug;
76
in
@@ -17,7 +16,7 @@ in
1716
];
1817

1918
config = mkIf cfg.enable {
20-
networking.firewall.enable = false;
19+
networking.firewall.allowedTCPPorts = [ 8080 ];
2120
nixpkgs.overlays = [ seabugOverlay ];
2221
virtualisation.arion = {
2322
backend = "podman-socket";

0 commit comments

Comments
 (0)