summary refs log blame commit diff
path: root/nixos/modules/services/misc/sundtek.nix
blob: e3234518c940a3d65ff4e65082a51fc90cd90be2 (plain) (tree)
























                                                                      
                                                                    






                                                                
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.sundtek;

in
{
  options.services.sundtek = {
    enable = mkEnableOption "Sundtek driver";
  };

  config = mkIf cfg.enable {

    environment.systemPackages = [ pkgs.sundtek ];

    systemd.services.sundtek = {
      description = "Sundtek driver";
      wantedBy = [ "multi-user.target" ];

      serviceConfig = {
        Type = "oneshot";
        ExecStart = ''
          ${pkgs.sundtek}/bin/mediasrv -d -v -p ${pkgs.sundtek}/bin ;\
          ${pkgs.sundtek}/bin/mediaclient --start --wait-for-devices
          '';
        ExecStop = "${pkgs.sundtek}/bin/mediaclient --shutdown";
        RemainAfterExit = true;
      };
    };
  };
}