nixos/ipfs: improve how the commandline flags are generated

Use `utils.escapeSystemdExecArgs` instead of relying on the exact way in which `toString` formats a list.
In https://github.com/NixOS/nixpkgs/pull/156706#discussion_r795867283 a suggestion was made and then implemented to replace `toString` with `concatStringsSep " "`.
@pennae then suggested to use `utils.escapeSystemdExecArgs` instead in https://github.com/NixOS/nixpkgs/pull/164846#issuecomment-1073001848.
main
Luflosi 2 years ago committed by pennae
parent c2e8907d62
commit ec415055ba
  1. 9
      nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
  2. 2
      nixos/doc/manual/release-notes/rl-2205.section.md
  3. 17
      nixos/modules/services/network-filesystems/ipfs.nix

@ -467,6 +467,15 @@
its reliance on python2.
</para>
</listitem>
<listitem>
<para>
<literal>services.ipfs.extraFlags</literal> is now escaped
with <literal>utils.escapeSystemdExecArgs</literal>. If you
rely on systemd interpolating <literal>extraFlags</literal> in
the service <literal>ExecStart</literal>, this will no longer
work.
</para>
</listitem>
<listitem>
<para>
The <literal>matrix-synapse</literal> service

@ -157,6 +157,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The `mailpile` email webclient (`services.mailpile`) has been removed due to its reliance on python2.
- `services.ipfs.extraFlags` is now escaped with `utils.escapeSystemdExecArgs`. If you rely on systemd interpolating `extraFlags` in the service `ExecStart`, this will no longer work.
- The `matrix-synapse` service (`services.matrix-synapse`) has been converted to use the `settings` option defined in RFC42.
This means that options that are part of your `homeserver.yaml` configuration, and that were specified at the top-level of the
module (`services.matrix-synapse`) now need to be moved into `services.matrix-synapse.settings`. And while not all options you

@ -1,16 +1,17 @@
{ config, lib, pkgs, options, ... }:
{ config, lib, pkgs, options, utils, ... }:
with lib;
let
cfg = config.services.ipfs;
opt = options.services.ipfs;
ipfsFlags = toString ([
(optionalString cfg.autoMount "--mount")
(optionalString cfg.enableGC "--enable-gc")
(optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=false")
(optionalString (cfg.defaultMode == "offline") "--offline")
(optionalString (cfg.defaultMode == "norouting") "--routing=none")
] ++ cfg.extraFlags);
ipfsFlags = utils.escapeSystemdExecArgs (
optional cfg.autoMount "--mount" ++
optional cfg.enableGC "--enable-gc" ++
optional (cfg.serviceFdlimit != null) "--manage-fdlimit=false" ++
optional (cfg.defaultMode == "offline") "--offline" ++
optional (cfg.defaultMode == "norouting") "--routing=none" ++
cfg.extraFlags
);
profile =
if cfg.localDiscovery

Loading…
Cancel
Save