Code change:
let cfg = config.power.ups; <del> in </del> <ins> defaultPort = 3493; nutFormat = { type = with lib.types; let singleAtom = nullOr (oneOf [ bool int float str ]) // { description = "atom (null, bool, int, float or string)"; }; in attrsOf (oneOf [ singleAtom (listOf (nonEmptyListOf singleAtom)) ]); generate = name: value: let normalizedValue = lib.mapAttrs (key: val: if lib.isList val then forEach val (elem: if lib.isList elem then elem else [elem]) else if val == null then [] else [[val]] ) value; mkValueString = concatMapStringsSep " " (v: let str = generators.mkValueStringDefault {} v; in # Quote the value if it has spaces and isn't already quoted. if (hasInfix " " str) && !(hasPrefix """ str && hasSuffix """ str) then ""${str}"" else str ); in pkgs.writeText name (lib.generators.toKeyValue { mkKeyValue = generators.mkKeyValueDefault { inherit mkValueString; } " "; listsAsDuplicateKeys = true; } normalizedValue); }; installSecrets = source: target: secrets: pkgs.writeShellScript "installSecrets.sh" '' install -m0600 -D ${source} "${target}" ${concatLines (forEach secrets (name: '' ${pkgs.replace-secret}/bin/replace-secret  '@${name}@'  "$CREDENTIALS_DIRECTORY/${name}"  "${target}" ''))} chmod u-w "${target}" ''; upsmonConf = nutFormat.generate "upsmon.conf" cfg.upsmon.settings; upsdUsers = pkgs.writeText "upsd.users" (let # This looks like INI, but it's not quite because the # 'upsmon' option lacks a '='. See: man upsd.users userConfig = name: user: concatStringsSep "n      " (concatLists [ [ "[${name}]" "password = "@upsdusers_password_${name}@"" ] (optional (user.upsmon != null) "upsmon ${user.upsmon}") (forEach user.actions (action: "actions = ${action}")) (forEach user.instcmds (instcmd: "instcmds = ${instcmd}")) ]); in concatStringsSep "nn" (mapAttrsToList userConfig cfg.users)); </ins> <del> let </del> upsOptions = {name, config, ...}: { options = {

Related discussion:
text: Describe the bug The following snippet: results in services failing to start due to missing config files etc. : : ( fails too, but that could be down to the fact that I haven't plugged the UPS in yet -- but for the record, it complains ) Expected behavior I'd expect the services to start successfully (and probably complain about the missing actual UPS). Notify maintainers (The UPS module appears to have received only drive-by changes for the last several years, so no idea who to bug personally). Metadata system: host os: multi-user?: sandbox: version: channels(root): nixpkgs: Maintainer information:
OK, should've read the whole module: I'm supposed to supply the missing /etc/nut files myself because it's unwise to keep them in the store (they could contain passwords and whatnot, I guess?). Declaring (in the service definitions) the state directory to be but creating for the purpose appears to be a real bug, though :)
Also (sorry for the semi-off-topic) what are best practices for referencing hand-written config files without their contents winding up in the store? Double-symlinking? If this is documented somewhere, then I haven't found where.
I was struggling with the same problem as until I noticed this bug report. After copying and editing , , and from to (and setting on all those files), I was able to get it to work. I think this should be more discoverable. If it's not appropriate to copy those sample files to on the users behalf, there should at least be detailed instructions on the option to explain what else needs to be done.
I marked this as stale due to inactivity. &rarr;
Agreed this should be more discoverable. Perhaps at least could be defaulted to empty and written, since I seem to be getting away without anything in there. In case it helps anyone, I got it working with something like this:
I was hit this bug today, too. Maybe we can fix it by using a startup unit that handles the secrets and setup the state directories like nextcloud or syncthing do
Been working on today and wanted to put some notes here. Using version 2.7.4. First, isn't used by for PIDs and it will try to write to .