NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.39k stars 14.34k forks source link

wakapi: setting passwordSaltFile does not work when smtpPasswordFile is unset #360749

Open sochotnicky opened 1 day ago

sochotnicky commented 1 day ago

Describe the bug

systemd service for wakapi uses following construct:

EnvironmentFile = [
          (optional (cfg.passwordSaltFile != null) cfg.passwordSaltFile)
          (optional (cfg.smtpPasswordFile != null) cfg.smtpPasswordFile)
];

At: https://github.com/NixOS/nixpkgs/blob/a466f1462734692cd484f184a978187f250eabdc/nixos/modules/services/web-apps/wakapi.nix#L146-L147

When passwordSaltFile is set but smtpPasswordFile is unset this results in following in systemd unit:

EnvironmentFile=<path to salt file>
EnvironmentFile=

As per systemd docs - this results in "wiping" EnvironmentFile config.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set passwordSaltFile and unset smtpPasswordFile
  2. Try to login with valid password
  3. Failure...

Expected behavior

It should be possible to set passwordSaltFile without setting smtpPasswordFile

Additional context

Perhaps just using mkIf instead of optional might serve?

As a workaround setting smtpPasswordFile to same value as passwordSaltFile makes things work.

Metadata

Notify maintainers

@isabelroses @NotAShelf


Note for maintainers: Please tag this issue in your PR.


Add a :+1: reaction to issues you find important.

NotAShelf commented 1 day ago

Thanks for the report, I will take a look and submit a patch shortly.