Code change:
}; }; <ins> listenOptions = { options = { address = mkOption { type = types.str; description = lib.mdDoc '' Address of the interface for `upsd` to listen on. See `man upsd.conf` for details. ''; }; port = mkOption { type = types.port; default = defaultPort; description = lib.mdDoc '' TCP port for `upsd` to listen on. See `man upsd.conf` for details. ''; }; }; }; upsdOptions = { options = { enable = mkOption { type = types.bool; defaultText = literalMD "`true` if `mode` is one of `standalone`, `netserver`"; description = mdDoc "Whether to enable `upsd`."; }; listen = mkOption { type = with types; listOf (submodule listenOptions); default = []; example = [ { address = "192.168.50.1"; } { address = "::1"; port = 5923; } ]; description = lib.mdDoc '' Address of the interface for `upsd` to listen on. See `man upsd` for details`. ''; }; extraConfig = mkOption { type = types.lines; default = ""; description = lib.mdDoc '' Additional lines to add to `upsd.conf`. ''; }; }; config = { enable = mkDefault (elem cfg.mode [ "standalone" "netserver" ]); }; }; monitorOptions = { name, config, ... }: { options = { system = mkOption { type = types.str; default = name; description = lib.mdDoc '' Identifier of the UPS to monitor, in this form: `<upsname>[@<hostname>[:<port>]]` See `upsmon.conf` for details. ''; }; powerValue = mkOption { type = types.int; default = 1; description = lib.mdDoc '' Number of power supplies that the UPS feeds on this system. See `upsmon.conf` for details. ''; }; user = mkOption { type = types.str; description = lib.mdDoc '' Username from `upsd.users` for accessing this UPS. See `upsmon.conf` for details. ''; }; passwordFile = mkOption { type = types.str; defaultText = literalMD "power.ups.users.${user}.passwordFile"; description = lib.mdDoc '' The full path to a file containing the password from `upsd.users` for accessing this UPS. The password file is read on service start. See `upsmon.conf` for details. ''; }; type = mkOption { type = types.str; default = "master"; description = lib.mdDoc '' The relationship with `upsd`. See `upsmon.conf` for details. ''; }; }; config = { passwordFile = mkDefault cfg.users.${config.user}.passwordFile; }; }; upsmonOptions = { options = { enable = mkOption { type = types.bool; defaultText = literalMD "`true` if `mode` is one of `standalone`, `netserver`, `netclient`"; description = mdDoc "Whether to enable `upsmon`."; }; monitor = mkOption { type = with types; attrsOf (submodule monitorOptions); default = {}; description = lib.mdDoc '' Set of UPS to monitor. See `man upsmon.conf` for details. ''; }; settings = mkOption { type = nutFormat.type; default = {}; defaultText = literalMD '' { MINSUPPLIES = 1; RUN_AS_USER = "root"; NOTIFYCMD = "''${pkgs.nut}/bin/upssched"; SHUTDOWNCMD = "''${pkgs.systemd}/bin/shutdown now"; } ''; description = mdDoc "Additional settings to add to `upsmon.conf`."; example = literalMD '' { MINSUPPLIES = 2; NOTIFYFLAG = [ [ "ONLINE" "SYSLOG+EXEC" ] [ "ONBATT" "SYSLOG+EXEC" ] ]; } ''; }; }; config = { enable = mkDefault (elem cfg.mode [ "standalone" "netserver" "netclient" ]); settings = { RUN_AS_USER = "root"; # TODO: replace 'root' by another username. MINSUPPLIES = mkDefault 1; NOTIFYCMD = mkDefault "${pkgs.nut}/bin/upssched"; SHUTDOWNCMD = mkDefault "${pkgs.systemd}/bin/shutdown now"; MONITOR = flip mapAttrsToList cfg.upsmon.monitor (name: monitor: with monitor; [ system powerValue user ""@upsmon_password_${name}@"" type ]); }; }; }; userOptions = { options = { passwordFile = mkOption { type = types.str; description = lib.mdDoc '' The full path to a file that contains the user's (clear text) password. The password file is read on service start. ''; }; actions = mkOption { type = with types; listOf str; default = []; description = lib.mdDoc '' Allow the user to do certain things with upsd. See `man upsd.users` for details. ''; }; instcmds = mkOption { type = with types; listOf str; default = []; description = lib.mdDoc '' Let the user initiate specific instant commands. Use "ALL" to grant all commands automatically. For the full list of what your UPS supports, use "upscmd -l". See `man upsd.users` for details. ''; }; upsmon = mkOption { type = with types; nullOr str; default = null; description = lib.mdDoc '' Add the necessary actions for a upsmon process to work. See `man upsd.users` for details. ''; }; }; }; </ins> in

Related discussion:
text: Describe the bug I'm trying to use NixOS in a UPS client (not server). When , the and services shouldn't be running. There is a note that says that is not used currently. To Reproduce Steps to reproduce the behavior: Error: and fail. Expected behavior only upsmon should be running Notify maintainers <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Metadata Maintainer information: See also
Looks like there's a pretty simple workaround:
I marked this as stale due to inactivity. &rarr;