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,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.nightLight;
|
cfg = config.services.nightLight;
|
||||||
|
pkg = pkgs.callPackage ./default.nix { };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.nightLight = {
|
options.services.nightLight = {
|
||||||
|
|
@ -15,5 +17,23 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.zigbee2mqtt.enable = true;
|
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