Skip to content

Commit d50b3cf

Browse files
committed
feat(pharos): add Pharos service configuration and module
1 parent 6c3aa34 commit d50b3cf

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

modules/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
./random-alerts
88
./host-info.nix
99
./secrets.nix
10+
./pharos
1011
];
1112
}

modules/pharos/default.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{ ... }:
2+
{
3+
flake.modules.nixos.pharos =
4+
{
5+
config,
6+
lib,
7+
...
8+
}:
9+
let
10+
cfg = config.services.pharos;
11+
in
12+
{
13+
options.services.pharos = with lib; {
14+
enable = mkEnableOption (lib.mdDoc "Pharos");
15+
network = mkOption {
16+
type = types.enum [
17+
"testnet"
18+
"devnet"
19+
"mainnet"
20+
];
21+
default = "testnet";
22+
description = "Network to connect to";
23+
};
24+
};
25+
config = {
26+
virtualisation.oci-containers.containers."pharos-${cfg.network}" = {
27+
image =
28+
{
29+
"testnet" = "public.ecr.aws/k2g7b7g1/pharos/testnet:63b85b6b";
30+
"devnet" = "public.ecr.aws/k2g7b7g1/pharos:latest";
31+
}
32+
."${cfg.testnet}";
33+
volumes = [
34+
"/var/lib/pharos-${cfg.network}:/data"
35+
];
36+
ports = [
37+
"18100:18100"
38+
"18200:18200"
39+
"19000:19000"
40+
];
41+
};
42+
assertions = [
43+
{
44+
assertion = cfg.network != "mainnet";
45+
message = "Pharos is not available on mainnet yet";
46+
}
47+
];
48+
system.activationScripts."pharos-${cfg.network}" = ''
49+
mkdir -p /var/lib/pharos-${cfg.network}
50+
'';
51+
};
52+
};
53+
}

0 commit comments

Comments
 (0)