module change
This commit is contained in:
parent
f6b8169fa7
commit
500ef0ed5a
2 changed files with 15 additions and 3 deletions
|
@ -114,6 +114,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
}) // {
|
}) // {
|
||||||
nixosModules.thekenlicht-daemon = ./module.nix;
|
nixosModules.thekenlicht-daemon = (import ./module.nix {flake=self;});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
16
module.nix
16
module.nix
|
@ -1,3 +1,4 @@
|
||||||
|
{flake}:
|
||||||
{ self, config, pkgs, lib, ... }:
|
{ self, config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.thekenlicht-daemon;
|
cfg = config.services.thekenlicht-daemon;
|
||||||
|
@ -6,16 +7,27 @@ in
|
||||||
options = {
|
options = {
|
||||||
services.thekenlicht-daemon = {
|
services.thekenlicht-daemon = {
|
||||||
enable = lib.mkEnableOption "Enable Module";
|
enable = lib.mkEnableOption "Enable Module";
|
||||||
serialPort = lib.mkStringOption "Serial Port";
|
serialPort = lib.mkOption {
|
||||||
|
description = "Serial Port";
|
||||||
|
type = lib.types.uniq lib.types.str;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
users.users.thekenlicht-daemon = {
|
||||||
|
isSystemUser = true;
|
||||||
|
extraGroups = [ "dialout" ];
|
||||||
|
group = "thekenlicht-daemon";
|
||||||
|
};
|
||||||
|
users.groups.thekenlicht-daemon = {};
|
||||||
systemd.services.thekenlicht-daemon = {
|
systemd.services.thekenlicht-daemon = {
|
||||||
description = "converts artnet to serial thekenlicht commands";
|
description = "converts artnet to serial thekenlicht commands";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig.ExecStart = "${self.packages.thekenlicht-daemon}/bin/thekenlicht-daemon ${cfg.serialPort}";
|
serviceConfig.ExecStart = "${flake.packages.${pkgs.system}.default}/bin/thekenlicht-daemon ${cfg.serialPort}";
|
||||||
serviceConfig.Restart = "on-failure";
|
serviceConfig.Restart = "on-failure";
|
||||||
|
serviceConfig.User = "thekenlicht-daemon";
|
||||||
|
serviceConfig.Group = "thekenlicht-daemon";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue