Skip to content

Commit fd9cfbb

Browse files
committed
[WIP]
1 parent 9eda07a commit fd9cfbb

File tree

4 files changed

+59
-40
lines changed

4 files changed

+59
-40
lines changed

arion-compose.nix

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{ pkgs, ... }:
2+
let
3+
pwd = "/tmp/";
24

5+
in
36
{
47
# NOTE: still can't remember it...
58
# ports = [ "host:container" ]
@@ -15,7 +18,7 @@
1518
image = "nginx:1.20.2-alpine";
1619
ports = [ "8080:80" ];
1720
volumes = [
18-
"${toString ./.}/nft-marketplace/build:/usr/share/nginx/html"
21+
# "${toString ./.}/nft-marketplace/build:/usr/share/nginx/html"
1922
"${toString ./.}/config/nginx.conf:/etc/nginx/nginx.conf"
2023
];
2124
healthcheck = {
@@ -54,7 +57,7 @@
5457
image = "cardanosolutions/ogmios:v5.2.0-testnet";
5558
ports = [ "1337:1337" ];
5659
volumes = [
57-
"${toString ./.}/data/cardano-node/ipc:/ipc"
60+
"${pwd}/data/cardano-node/ipc:/ipc"
5861
"${toString ./.}/config:/config"
5962
];
6063
};
@@ -76,8 +79,8 @@
7679
environment = { NETWORK = "testnet"; };
7780
image = "inputoutput/cardano-node:1.33.0";
7881
volumes = [
79-
"${toString ./.}/data/cardano-node/ipc:/ipc"
80-
"${toString ./.}/data/cardano-node/cardano-node-data:/data"
82+
"${pwd}/data/cardano-node/ipc:/ipc"
83+
"${pwd}/data/cardano-node/cardano-node-data:/data"
8184
];
8285
healthcheck = {
8386
test = [
@@ -105,8 +108,9 @@
105108
timeout = "5s";
106109
retries = 3;
107110
};
108-
volumes =
109-
[ "${toString ./.}/data/postgres-data:/var/lib/postgresql/data" ];
111+
volumes = [
112+
"${pwd}/data/postgres-data:/var/lib/postgresql/data"
113+
];
110114
};
111115
nft-marketplace-server.service = {
112116
command = [
@@ -135,7 +139,9 @@
135139
};
136140
useHostStore = true;
137141
restart = "always";
138-
volumes = [ "${toString ./.}/config/tmp:/tmp" ];
142+
volumes = [
143+
"${pwd}/config/tmp:/tmp"
144+
];
139145
};
140146
};
141147
}

flake.lock

Lines changed: 6 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
;
6767

6868
# TODO: system-agnostic
69-
# inherit (inputs.ogmios-datum-cache.packages.${system}) ogmios-datum-cache;
69+
inherit (inputs.ogmios-datum-cache.packages.${system}) ogmios-datum-cache;
7070

7171
cardano-transaction-lib-server =
7272
cardano-transaction-lib.packages.${system}."cardano-browser-tx-server:exe:cardano-browser-tx-server";
@@ -130,14 +130,37 @@
130130
let
131131
pkgs = pkgsFor system;
132132
vm = nixosConfigurations.seabug-vm.config.system.build.vm;
133+
program = pkgs.writeShellScript "run-vm" ''
134+
set -euo pipefail
135+
# set -x
136+
137+
[ -x nixos.qcow2 ] && echo "⚠️ nixos.qcow2 already exists..."
138+
139+
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:8008"
140+
export QEMU_OPTS
141+
${vm}/bin/run-nixos-vm &
142+
PID=$!
143+
144+
# Wait for the VM to start
145+
while ! curl -m 1 -s http://localhost:8080/;
146+
do
147+
if ! kill -0 $PID; then
148+
echo "❌ VM failed to start"
149+
exit 1
150+
fi
151+
sleep 1;
152+
done
153+
154+
${pkgs.python3}/bin/python -c 'import webbrowser; webbrowser.open("http://localhost:8080/")' &
155+
156+
# Wait for the VM to exit
157+
wait $PID
158+
'';
133159
in
134160
{
135161
default = {
136162
type = "app";
137-
program = pkgs.writeShellScript "run-vm" ''
138-
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:80"
139-
${vm}/bin/run-nixos-vm
140-
'';
163+
program = "${program}";
141164
};
142165
});
143166

seabug-module.nix

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{arionModule, seabugOverlay}: {
2-
lib,
3-
config,
4-
...
5-
}:
1+
{ arionModule, seabugOverlay }: { lib
2+
, config
3+
, ...
4+
}:
65
with lib; let
76
cfg = config.services.seabug;
8-
in {
7+
in
8+
{
99
options.services.seabug = {
1010
enable = mkEnableOption ''
1111
Seabug
@@ -17,10 +17,13 @@ in {
1717
];
1818

1919
config = mkIf cfg.enable {
20-
nixpkgs.overlays = [seabugOverlay];
20+
networking.firewall.enable = false;
21+
nixpkgs.overlays = [ seabugOverlay ];
2122
virtualisation.arion = {
22-
backend = "podman-socket";
23-
projects.seabug.settings.imports = [./arion-compose.nix];
23+
# backend = "podman-socket";
24+
backend = "docker";
25+
projects.seabug.settings.imports = [ ./arion-compose.nix ];
26+
2427
};
2528
};
2629
}

0 commit comments

Comments
 (0)