nix icon indicating copy to clipboard operation
nix copied to clipboard

Nix-daemon systemd unit missing `NIX_SSL_CERT_FILE`

Open xbreak opened this issue 5 years ago • 7 comments

If NIX_SSL_CERT_FILE exist during the multi-user installation it will be used and the Nix provided bundle will not be installed (c.f https://github.com/NixOS/nix/pull/2181). In this case I think the installed systemd unit file for nix-daemon.service should also provide this environment variable:

[Service]
...
Environment="NIX_SSL_CERT_FILE=<value>"

Otherwise the installation will succeed but any non-root user will not be able to download anything via the daemon due to missing environment unless:

  • SSL_CERT_FILE is exported (unlikely in systemd units)
  • You happen to use a distribution with a bundle in "/etc/ssl/certs/ca-certificates.crt" C.f.: https://github.com/NixOS/nix/blob/ab4dd1d78306c58cb9ee1fa5009ef18b67e26314/src/libstore/globals.cc#L48-L55

See also https://github.com/NixOS/nix/pull/3141 where I try to get some observability logging accepted.

cc: @grahamc

xbreak avatar Oct 17 '19 13:10 xbreak

Ran into this while installing Nix in Fedora 32 just now; ugly workaround for the meantime is a ln -sf /etc/ssl/certs/ca-{bundle,certificates}.crt.

zakame avatar Sep 13 '20 18:09 zakame

I marked this as stale due to inactivity. → More info

stale[bot] avatar Mar 16 '21 03:03 stale[bot]

I ran into this while doing a multi-user Nix installation on AlmaLinux.

Xbreak's solution mentioned in a nixpkgs issue worked for me: systemctl edit nix-daemon.service, paste in:

[Service]
Environment="NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"

Skyfold avatar Jun 11 '21 07:06 Skyfold

Same issue in RHEL 7, modifying the systemd service file worked for me as well

gpanders avatar Jun 24 '21 18:06 gpanders

I marked this as stale due to inactivity. → More info

stale[bot] avatar Jan 03 '22 20:01 stale[bot]

Users are still reporting issues with this in https://github.com/NixOS/nixpkgs/issues/70939

xbreak avatar Apr 28 '22 10:04 xbreak

Same issue in Fedora 35. Doing @zakame workaround, solved for me: sudo ln -sf /etc/ssl/certs/ca-{bundle,certificates}.crt

miguelbaldi avatar Sep 22 '22 12:09 miguelbaldi

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-cannot-find-my-custom-ssl-certificate/27361/5

nixos-discourse avatar Apr 18 '23 10:04 nixos-discourse