nixpkgs/nixos/modules
Luflosi d4fcb44dcc
nixos/kubo: fix potential panic on startup
This fixes a panic of the kubo daemon which could occur under certain conditions when the daemon was starting.
It was caused by the `ipfs.service` unit not depending on the `ipfs-api.socket` and `ipfs-gateway.socket` units with `Wants=`. This allows the `ipfs.service` to be started manually or by `nixos-rebuild` without the sockets being set up before that. When that happens, the daemon won't know about these sockets and will only use what is set in `services.kubo.settings.Addresses.Gateway` and `services.kubo.settings.Addresses.API`. By default the `API` is an empty list in NixOS though. The daemon doesn't like this at all and panics on startup, see https://github.com/ipfs/kubo/issues/10056.
With this commit, starting `ipfs.service` will first set up the two sockets before starting the actual service.
Adding the `Sockets=` option implicitly adds a `Wants=` for the sockets and this is exactly what we need. See https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Implicit%20Dependencies . This can be checked with `systemctl show ipfs.service`.

This should probably be upstreamed to the unit file in the Kubo repo.

The problem can be reproduced in the following way:
- Add `services.kubo.enable = true` to `/etc/nixos/configuration.nix`
- `sudo nixos-rebuild switch` (this may already fail, not sure why it's not deterministic for me)
- `sudo systemctl stop ipfs-api.socket`
- `sudo systemctl stop ipfs-gateway.socket`
- `sudo systemctl stop ipfs.service`
- `sudo systemctl start ipfs.service`

Fixes #248447.
2023-12-15 23:36:08 +01:00
..
config nixos/ldso: remove string context from linker soname 2023-12-15 12:39:26 +03:00
hardware nixos/qmk: ensure plugdev groups exists 2023-12-14 10:01:19 +01:00
i18n/input-method treewide: /lib/libexec -> /libexec 2023-11-26 10:55:37 +03:00
image nixos/image: fix layout of option examples in repart builder 2023-10-31 11:27:57 +01:00
installer nixos/system.disableInstallerTools: Do define options without effect 2023-11-19 21:21:16 +01:00
misc nixos/hound: adopt, rework, cleanup (#268983) 2023-12-05 15:59:26 +01:00
profiles nixos/stub-ld: init module 2023-12-11 05:47:23 -05:00
programs Merge pull request #270523 from m-bdf/river-xdg-portal-config 2023-12-14 14:07:08 +01:00
security Merge pull request #270224 from SuperSandro2000/patch-2 2023-12-11 09:03:32 +01:00
services nixos/kubo: fix potential panic on startup 2023-12-15 23:36:08 +01:00
system Merge pull request #270011 from christoph-heiss/networkd-fix-wgpeer-doc 2023-12-06 00:33:05 +01:00
tasks Merge pull request #270084 from Atemu/nixos/snapraid-top-level 2023-12-14 14:51:04 +01:00
testing nixos/test-instrumentation: Fix backdoor ordering 2023-11-12 15:04:38 -05:00
virtualisation nixos/lxc: remove with lib 2023-12-04 10:06:54 -05:00
module-list.nix Merge pull request #270084 from Atemu/nixos/snapraid-top-level 2023-12-14 14:51:04 +01:00
rename.nix prayer: remove 2023-11-10 20:44:28 -03:00