1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-05 01:19:46 +01:00
home-manager/tests/modules/services/osmscout-server/basic-setup.nix
Tom Hall 0f11c14065
osmscout-server: add module
Osmscout-server includes a setting in its UI to create a systemd user
service and socket to run the server on demand. This does not function
correctly on NixOS, for two reasons:

1. It assumes that the binary path is stable (e.g.
   /usr/bin/osmscout-server), which is not the case on NixOS.

2. It auto-detects the unwrapped binary path, which doesn't work.

This module allows the user to access the same functionality on NixOS.
2023-12-28 09:28:48 +01:00

43 lines
1,022 B
Nix

{ config, ... }:
{
services.osmscout-server = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@osmscout-server@"; };
network = {
startWhenNeeded = true;
listenAddress = "0.0.0.0";
port = 55555;
};
};
nmt.script = ''
assertFileContent \
home-files/.config/systemd/user/osmscout-server.service \
${
builtins.toFile "osmscout-server.service" ''
[Service]
ExecStart='@osmscout-server@/bin/osmscout-server' --systemd --quiet
[Unit]
Description=OSM Scout Server
''
}
assertFileContent \
home-files/.config/systemd/user/osmscout-server.socket \
${
builtins.toFile "osmscout-server.socket" ''
[Install]
WantedBy=sockets.target
[Socket]
ListenStream=0.0.0.0:55555
TriggerLimitBurst=1
TriggerLimitIntervalSec=60s
[Unit]
Description=OSM Scout Server Socket
''
}
'';
}