nixpkgs/nixos/modules/services/network-filesystems
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
..
litestream treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
openafs treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
orangefs nixos/orangefs: fix typo in group name 2023-10-07 00:07:23 +03:00
cachefilesd.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00
ceph.nix treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
davfs2.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00
diod.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00
drbd.nix drbd: fix path to drbdadm 2023-12-15 01:35:02 +05:30
eris-server.nix nixos/eris-server: init 2023-07-29 11:56:58 +01:00
glusterfs.nix treewide: use optional instead of 'then []' 2023-06-25 09:11:40 -03:00
kbfs.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00
kubo.nix nixos/kubo: fix potential panic on startup 2023-12-15 23:36:08 +01:00
moosefs.nix nixos/*: remove trailing period in mkEnableOptions 2023-02-08 15:23:34 +01:00
netatalk.nix nixos/*: automatically convert option descriptions 2022-08-31 16:32:53 +02:00
nfsd.nix nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
rsyncd.nix nixos/*: automatically convert option descriptions 2022-08-31 16:32:53 +02:00
samba-wsdd.nix nixos/samba-wsdd: add openFirewall option 2023-07-17 10:22:43 -04:00
samba.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
tahoe.nix treewide: use mkPackageOption 2023-11-27 01:28:36 +01:00
u9fs.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00
webdav-server-rs.nix webdav-server-rs: Add debug option 2023-02-09 11:53:06 +01:00
webdav.nix nixos/*: automatically convert option descriptions 2022-08-31 16:32:53 +02:00
xtreemfs.nix treewide: fix redirected and broken URLs 2023-11-11 10:49:01 +01:00
yandex-disk.nix nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00