File tree Expand file tree Collapse file tree 4 files changed +112
-0
lines changed
Expand file tree Collapse file tree 4 files changed +112
-0
lines changed Original file line number Diff line number Diff line change 12421242 ./services/networking/lxd-image-server.nix
12431243 ./services/networking/magic-wormhole-mailbox-server.nix
12441244 ./services/networking/matterbridge.nix
1245+ ./services/networking/meshtasticd.nix
12451246 ./services/networking/microsocks.nix
12461247 ./services/networking/mihomo.nix
12471248 ./services/networking/minidlna.nix
Original file line number Diff line number Diff line change 1+ {
2+ config ,
3+ lib ,
4+ pkgs ,
5+ ...
6+ } :
7+
8+ let
9+ cfg = config . services . meshtasticd ;
10+ format = pkgs . formats . yaml { } ;
11+ configFile = format . generate "config.yaml" cfg . settings ;
12+ in
13+ {
14+ options . services . meshtasticd = {
15+ enable = lib . mkEnableOption "Meshtastic daemon" ;
16+ package = lib . mkPackageOption pkgs "meshtasticd" { } ;
17+
18+ port = lib . mkOption {
19+ type = lib . types . port ;
20+ default = 4403 ;
21+ description = "Port to listen on" ;
22+ } ;
23+
24+ settings = lib . mkOption {
25+ type = format . type ;
26+ description = ''
27+ TODO
28+ '' ;
29+ } ;
30+
31+ dataDir = lib . mkOption {
32+ default = "/var/lib/meshtasticd" ;
33+ type = lib . types . path ;
34+ description = ''
35+ The data directory.
36+ '' ;
37+ } ;
38+
39+ } ;
40+
41+ config = lib . mkIf cfg . enable {
42+ systemd . services . meshtasticd = {
43+ description = "Meshtastic daemon" ;
44+ after = [
45+ "network-online.target"
46+ "network.target"
47+ ] ;
48+ wants = [
49+ "network-online.target"
50+ "network.target"
51+ ] ;
52+ wantedBy = [ "multi-user.target" ] ;
53+
54+ serviceConfig = {
55+ DynamicUser = true ;
56+ StateDirectory = "meshtasticd" ;
57+ AmbientCapabilities = [
58+ "CAP_NET_BIND_SERVICE"
59+ ] ;
60+ ExecStart = "${ lib . getExe cfg . package } --port=${ builtins . toString cfg . port } --fsdir=${ cfg . dataDir } --config=${ configFile } --verbose" ;
61+ Restart = "always" ;
62+ RestartSec = "3" ;
63+ } ;
64+ } ;
65+ } ;
66+ }
Original file line number Diff line number Diff line change 937937 meilisearch = runTest ./meilisearch.nix ;
938938 memcached = runTest ./memcached.nix ;
939939 merecat = runTest ./merecat.nix ;
940+ meshtasticd = runTest ./networking/meshtasticd.nix ;
940941 metabase = runTest ./metabase.nix ;
941942 mihomo = runTest ./mihomo.nix ;
942943 mimir = runTest ./mimir.nix ;
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ pkgs ,
4+ ...
5+ } :
6+ let
7+ mainPort = 9445 ;
8+ webPort = 9446 ;
9+ in
10+ {
11+ name = "meshtasticd" ;
12+ meta . maintainers = [ lib . maintainers . drupol ] ;
13+
14+ nodes . machine = {
15+ services . meshtasticd = {
16+ enable = true ;
17+ port = mainPort ;
18+
19+ settings = {
20+ Lora = {
21+ Module = "sim" ;
22+ DIO2_AS_RF_SWITCH = false ;
23+ spiSpeed = "2000000" ;
24+ } ;
25+ Webserver = {
26+ Port = webPort ;
27+ RootPath = pkgs . meshtastic-web ;
28+ } ;
29+ General = {
30+ MaxNodes = 200 ;
31+ MaxMessageQueue = 100 ;
32+ MACAddressSource = "eth0" ;
33+ } ;
34+ } ;
35+ } ;
36+ } ;
37+
38+ testScript = ''
39+ with subtest("Test meshtasticd service"):
40+ machine.wait_for_unit("meshtasticd.service")
41+ machine.wait_for_open_port(${ builtins . toString mainPort } )
42+ machine.wait_for_open_port(${ builtins . toString webPort } )
43+ '' ;
44+ }
You can’t perform that action at this time.
0 commit comments