1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.services.sundtek;
9
10in
11{
12 options.services.sundtek = {
13 enable = lib.mkEnableOption "Sundtek driver";
14 };
15
16 config = lib.mkIf cfg.enable {
17
18 environment.systemPackages = [ pkgs.sundtek ];
19
20 systemd.services.sundtek = {
21 description = "Sundtek driver";
22 wantedBy = [ "multi-user.target" ];
23
24 serviceConfig = {
25 Type = "oneshot";
26 ExecStart = ''
27 ${pkgs.sundtek}/bin/mediasrv -d -v -p ${pkgs.sundtek}/bin ;\
28 ${pkgs.sundtek}/bin/mediaclient --start --wait-for-devices
29 '';
30 ExecStop = "${pkgs.sundtek}/bin/mediaclient --shutdown";
31 RemainAfterExit = true;
32 };
33 };
34 };
35}