{ config, lib, pkgs, inputs, ... }: { options = { myService.lightControl.enable = lib.mkEnableOption "enable lightControl Service"; }; config = lib.mkIf config.myService.lightControl.enable { systemd.services.lightcontrol = { description = "LightControl"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { ExecStart = "${inputs.lightcontrol.packages.${pkgs.system}.backend}/bin/backend"; Environment = [ "DEVICE_STORAGE_PATH=/srv/apps/lightcontrol/devices.json" "STATIC_FILES_DIR=${inputs.lightcontrol.packages.${pkgs.system}.frontend}" "WEB_PORT=8080" "TCP_PORT=1234" ]; Restart = "always"; RestartSec = 5; }; }; }; }