Skip to content

Commit 69dfdec

Browse files
committed
build nft-marketplace with flake
1 parent fd9cfbb commit 69dfdec

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

arion-compose.nix

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
{ pkgs, ... }:
2-
let
3-
pwd = "/tmp/";
1+
{ pkgs, lib, config, ... }:
42

3+
let
4+
inherit (config) share_dir;
5+
inherit (pkgs.lib) mkOption;
56
in
7+
68
{
9+
options = {
10+
share_dir = mkOption {
11+
default = "/var/lib/seabug";
12+
};
13+
};
14+
715
# NOTE: still can't remember it...
816
# ports = [ "host:container" ]
917
config.services = {
@@ -19,6 +27,7 @@ in
1927
ports = [ "8080:80" ];
2028
volumes = [
2129
# "${toString ./.}/nft-marketplace/build:/usr/share/nginx/html"
30+
"${pkgs.nft-marketplace}/lib/node_modules/nft-marketplace/build:/usr/share/nginx/html"
2231
"${toString ./.}/config/nginx.conf:/etc/nginx/nginx.conf"
2332
];
2433
healthcheck = {
@@ -57,7 +66,7 @@ in
5766
image = "cardanosolutions/ogmios:v5.2.0-testnet";
5867
ports = [ "1337:1337" ];
5968
volumes = [
60-
"${pwd}/data/cardano-node/ipc:/ipc"
69+
"${share_dir}/data/cardano-node/ipc:/ipc"
6170
"${toString ./.}/config:/config"
6271
];
6372
};
@@ -79,8 +88,8 @@ in
7988
environment = { NETWORK = "testnet"; };
8089
image = "inputoutput/cardano-node:1.33.0";
8190
volumes = [
82-
"${pwd}/data/cardano-node/ipc:/ipc"
83-
"${pwd}/data/cardano-node/cardano-node-data:/data"
91+
"${share_dir}/data/cardano-node/ipc:/ipc"
92+
"${share_dir}/data/cardano-node/cardano-node-data:/data"
8493
];
8594
healthcheck = {
8695
test = [
@@ -109,7 +118,7 @@ in
109118
retries = 3;
110119
};
111120
volumes = [
112-
"${pwd}/data/postgres-data:/var/lib/postgresql/data"
121+
"${share_dir}/data/postgres-data:/var/lib/postgresql/data"
113122
];
114123
};
115124
nft-marketplace-server.service = {
@@ -140,7 +149,7 @@ in
140149
useHostStore = true;
141150
restart = "always";
142151
volumes = [
143-
"${pwd}/config/tmp:/tmp"
152+
"${share_dir}/config/tmp:/tmp"
144153
];
145154
};
146155
};

flake.nix

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@
4646
, nft-marketplace-server
4747
, ogmios-datum-cache
4848
, cardano-transaction-lib
49+
, dream2nix
4950
, ...
5051
} @ inputs:
5152
let
53+
nft-marketplace-flake = dream2nix.lib.makeFlakeOutputs {
54+
systems = supportedSystems;
55+
config.projectRoot = inputs.nft-marketplace;
56+
source = inputs.nft-marketplace;
57+
};
58+
5259
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
5360

5461
perSystem = nixpkgs.lib.genAttrs supportedSystems;
@@ -70,6 +77,8 @@
7077

7178
cardano-transaction-lib-server =
7279
cardano-transaction-lib.packages.${system}."cardano-browser-tx-server:exe:cardano-browser-tx-server";
80+
81+
inherit (nft-marketplace-flake.packages.${system}) nft-marketplace;
7382
};
7483

7584
pkgsFor = system:
@@ -136,11 +145,18 @@
136145
137146
[ -x nixos.qcow2 ] && echo "⚠️ nixos.qcow2 already exists..."
138147
139-
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:8008"
140-
export QEMU_OPTS
148+
export QEMU_NET_OPTS="hostfwd=tcp::2221-:22,hostfwd=tcp::8080-:8080"
149+
export QEMU_OPTS="-serial stdio"
141150
${vm}/bin/run-nixos-vm &
142151
PID=$!
143152
153+
sleep 3
154+
${pkgs.sshpass}/bin/sshpass -p toor \
155+
${pkgs.openssh}/bin/ssh [email protected] -p 2221 \
156+
-o "UserKnownHostsFile=/dev/null" \
157+
-o "StrictHostKeyChecking=no" \
158+
journalctl -f -u arion-seabug.service &
159+
144160
# Wait for the VM to start
145161
while ! curl -m 1 -s http://localhost:8080/;
146162
do
@@ -151,7 +167,7 @@
151167
sleep 1;
152168
done
153169
154-
${pkgs.python3}/bin/python -c 'import webbrowser; webbrowser.open("http://localhost:8080/")' &
170+
${pkgs.python3}/bin/python -m webbrowser http://localhost:8080 &
155171
156172
# Wait for the VM to exit
157173
wait $PID

seabug-module.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ in
2020
networking.firewall.enable = false;
2121
nixpkgs.overlays = [ seabugOverlay ];
2222
virtualisation.arion = {
23-
# backend = "podman-socket";
24-
backend = "docker";
23+
backend = "podman-socket";
24+
# backend = "docker";
2525
projects.seabug.settings.imports = [ ./arion-compose.nix ];
2626

2727
};

0 commit comments

Comments
 (0)