Add night-light to the module
This commit is contained in:
parent
5aab908591
commit
a7d27d91b4
1 changed files with 20 additions and 0 deletions
20
module.nix
20
module.nix
|
|
@ -1,12 +1,14 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.nightLight;
|
||||
pkg = pkgs.callPackage ./default.nix { };
|
||||
in
|
||||
{
|
||||
options.services.nightLight = {
|
||||
|
|
@ -15,5 +17,23 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
services.zigbee2mqtt.enable = true;
|
||||
users.groups.night-light = { };
|
||||
users.users.night-light = {
|
||||
isSystemUser = true;
|
||||
description = "Night Light";
|
||||
group = "night-light";
|
||||
};
|
||||
systemd.services.night-light = {
|
||||
description = "Night Light";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkg}/bin/NightLight";
|
||||
Restart = "on-failure";
|
||||
User = "night-light";
|
||||
Group = "night-light";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue