33 lines
984 B
Nix
33 lines
984 B
Nix
{flake}:
|
|
{ self, config, pkgs, lib, ... }:
|
|
let
|
|
cfg = config.services.thekenlicht-daemon;
|
|
in
|
|
{
|
|
options = {
|
|
services.thekenlicht-daemon = {
|
|
enable = lib.mkEnableOption "Enable Module";
|
|
serialPort = lib.mkOption {
|
|
description = "Serial Port";
|
|
type = lib.types.uniq lib.types.str;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
users.users.thekenlicht-daemon = {
|
|
isSystemUser = true;
|
|
extraGroups = [ "dialout" ];
|
|
group = "thekenlicht-daemon";
|
|
};
|
|
users.groups.thekenlicht-daemon = {};
|
|
systemd.services.thekenlicht-daemon = {
|
|
description = "converts artnet to serial thekenlicht commands";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig.ExecStart = "${flake.packages.${pkgs.system}.default}/bin/thekenlicht-daemon ${cfg.serialPort}";
|
|
serviceConfig.Restart = "on-failure";
|
|
serviceConfig.User = "thekenlicht-daemon";
|
|
serviceConfig.Group = "thekenlicht-daemon";
|
|
};
|
|
};
|
|
}
|