Nixos: override stunnel module

Hi,

I’d like to use stunnel to connect to an IMAPs server, however the provided module does not expose the full configuration (it’s not possible to specify the protocol parameter).

Is it possible to override the modulo to handle additional config options or is simpler to write a custom service definition?

You can override only the file /etc/stunnel.cfg.

environment.etc."stunnel.cfg".text = pkgs.lib.mkForce ''
  write the entire configuration file yourself here
'';

Why, it’s possible to override the entire module. Here is how I override the “tomcat” module with a modified copy:

  disabledModules = [
    "services/web-servers/tomcat.nix"
  ];

  imports = [
    /path/to/nixpkgs/nixos/modules/services/web-servers/tomcat.nix
  ];

1 Like