feat(mail): build dovecot 2.3 with GSSAPI #293
No reviewers
Labels
No labels
bug
enhancement
in-progress
needs-info
needs-triage
p0
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/nixos!293
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/290"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Builds Dovecot 2.3 with GSSAPI on
mail. Package change only — inert until the follow-up enables the mechanism.grep -rn 'auth_mechanisms\|auth_krb5_keytab\|auth_username_format' --include=*.nixover the repo returns nothing, so no config references GSSAPI and nothing about IMAP/SMTP auth changes.Why an overlay, and why it must replace the attribute
.overridecannot help — nixpkgs'pkgs/by-name/do/dovecot/generic.nixexposes nowithGSSAPIargument — so the derivation's attributes are extended instead.The override has to replace the
pkgs.dovecot_2_3attribute rather than sit inline onservices.dovecot2.package, and this is the pigeonhole trap the issue flags. Inpkgs/top-level/all-packages.nix:all-packages.nixisres: pkgs: super:…with pkgs;, andpkgsis the final overlaid fixpoint (lib.extendsisfinal: let prev = f final; …, andallPackagessits belowoverlaysinstage.nix'stoFix). So replacing the attribute makesdovecot_pigeonhole_0_5rebuild against the overridden dovecot, andpassthru.dovecot_pigeonhole— whichoverrideAttrsleaves untouched — resolves to that same rebuilt pigeonhole. An inlineoverrideAttrsat the use site would instead leave the passthru pointing at pigeonhole built against the un-overridden dovecot, which is the version mismatch that broke sieve/managesieve on this host once before.No eval cycle:
passthruis inargumentAttrsToRemoveinmake-derivation.nix, so it is stripped beforederivationArgand forcing dovecot'sdrvPathnever forces it. The dovecot↔pigeonhole mutual reference already exists in unmodified nixpkgs; this replaces a node, it adds no edge.Two call sites ride on this, not one — the issue names
hosts/mail/modules/dovecot.nix:263, andhosts/mail/modules/rspamd.nix:157also runs${config.services.dovecot2.package.dovecot_pigeonhole}/bin/sievecin dovecot'spreStartto compile the spam-filter scripts. Both take the same passthru, so both stay consistent.Deviation from the issue's stated scope:
krb5also innativeBuildInputsThe issue specifies
krb5inbuildInputs+--with-gssapi=yes. That alone does not compile, and the failure is at configure time. Four facts, all from the pinned channel rev445d861c:pkgs/by-name/do/dovecot/generic.nix:231—strictDeps = true;pkgs/stdenv/generic/setup.sh:850—if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then addToSearchPath _PATH "$pkg/bin". WithstrictDepsset, onlynativeBuildInputs(hostOffset ≤ -1) reachPATH;buildInputsgo to_HOST_PATH, which is never folded intoPATH.pkgs/by-name/kr/krb5/package.nix:157—moveToOutput bin/krb5-config "$dev".m4/want_gssapi.m4detects GSSAPI only viaAC_CHECK_PROG(KRB5CONFIG, krb5-config, krb5-config, NO)— a bare$PATHwalk, no pkg-config, no direct lib probe — and onNOwithwant_gssapi != autoraisesAC_ERROR([Can't build with GSSAPI support: krb5-config not found]).So
--with-gssapi=yesmakes a missingkrb5-configa hard error. Addingkrb5tonativeBuildInputsfixes it:make-derivation.nix:559,715mapsgetDevover that list, so it resolves tokrb5.dev, whosebin/holdskrb5-config. This mirrors openssh'swithKerberosin nixpkgs, which puts krb5 in both lists for exactly this reason.buildInputsis still needed — that is what suppliesgssapi/gssapi.hand the link inputs.Note
--with-gssapi=<path>is not an option: dovecot'sTEST_WITHmacro accepts onlyyes|no|auto|pluginandAC_ERRORs on a path.=yesis correct for the issue's verification step —want_gssapi != plugintakes theAUTH_LIBS="$AUTH_LIBS $KRB5_LIBS"+AC_DEFINE(BUILTIN_GSSAPI)branch, linking GSSAPI intolibexec/dovecot/authrather than emitting a separate.so.pkgs.krb5is already in mail's closure (hosts/mail/modules/kerberos.nixsetssecurity.krb5.package = pkgs.krb5and runs the KDC), so this adds no new component.configureFlagsuses++, preserving--with-lucene(the host'smail_pluginsincludesfts_lucene),--with-ldap,--with-systemdand--with-moduledir. An assignment there would have broken the host.Blast radius
mailpreviously had nonixpkgs.overlaysat all; the new list contains only this overlay and deliberately does not pull inutils/overlays/packages.nix. No other host uses dovecot, so the overlay stays host-local — putting it inutils/would drag every host through the pre-commit dry-build for nothing.versionis untouched, so the module'sisPre24 = versionOlder cfg.package.version "2.4"gate and every 2.3-shaped default stay exactly as they are. Postfix, the dovecot exporter andhosts/mail/pkgs/sieve-spam-filterare unaffected. Expect dovecot and pigeonhole to be binary-cache misses and compile on the host, and dovecot to restart on the deploy (thepreStartstore path changes).Verification — please read
The dry-build gate did not run. This branch was prepared in an environment with no Nix (
/nixabsent,nix-instantiatenot onPATH), soscripts/pre-commit/scripts/test-configuration mailcould not execute —test-configurationexits early on its owncommand -v nix-instantiatecheck. Everything above is static verification against the pinned channel rev, not a build. Please run./scripts/test-configuration mailbefore merging.After deploy, the issue's gate for starting the follow-up:
readlink -f $(command -v sieve-test)must resolve under the same dovecot store path as above.systemctl status dovecot2clean; send and receive mail normally.Rollback is reverting the commit. If a future channel bump breaks this build,
mailstays on its previous generation — stale rather than down.Closes #290