3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services
Matthew Bauer b36ef706fb nixos/ipfs: add startWhenNeeded option
This makes it possible to only start IPFS when needed. So a user’s
IPFS daemon only starts when they actually use it.

A few important warnings though:

  - This probably shouldn’t be mixed with services.ipfs.autoMount
    since you want /ipfs and /ipns aren’t activated like this
  - ipfs.socket assumes that you are using ports 5001 and 8080 for the
    API and gateway respectively. We could do some parsing to figure
    out what is in apiAddress and gatewayAddress, but that’s kind of
    difficult given the nonstandard address format.
  - Apparently? this doesn’t work with the --api commands used in the tests.

Of course you can always start automatically with startWhenNeeded =
false, or just running ‘systemctl start ipfs.service’.

Tested with the following test (modified from tests/ipfs.nix):

  import ./make-test-python.nix ({ pkgs, ...} : {
    name = "ipfs";

    nodes.machine = { ... }: {
      services.ipfs = {
        enable = true;
        startWhenNeeded = true;
      };
    };

    testScript = ''
      start_all()

      machine.wait_until_succeeds("ipfs id")
      ipfs_hash = machine.succeed("echo fnord | ipfs add | awk '{ print $2 }'")

      machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
    '';
  })

Fixes #90145

Update nixos/modules/services/network-filesystems/ipfs.nix

Co-authored-by: Florian Klink <flokli@flokli.de>
2020-06-12 17:15:27 -05:00
..
admin
amqp treewide: add bool type to enable options, or make use of mkEnableOption 2020-04-21 08:55:36 +02:00
audio mpd: remove user/group from conf 2020-05-10 20:24:33 +02:00
backup Merge pull request #87599 from helsinki-systems/znapzend-oracle-mode 2020-05-12 15:39:25 +02:00
cluster The systemd unit for k3s should differ between agents and servers 2020-04-23 07:55:23 +02:00
computing nixos/boinc: create boinc group 2020-03-25 13:26:31 +01:00
continuous-integration nixos/gitlab-runner: support multiple services 2020-05-02 11:59:57 +02:00
databases redis: handle changes to systemd support 2020-05-17 20:23:48 +12:00
desktops Merge pull request #83400 from jtojnar/malcontent-0.7 2020-04-08 17:38:17 +02:00
development nixos/jupyter: Fix documentation example for jupyter.kernels (#56415) 2020-01-31 15:30:02 +01:00
editors treewide: use https for nixos.org and hydra.nixos.org 2020-05-03 22:14:21 -07:00
games nixos/factorio: add extraSettings and package options 2020-01-10 23:36:14 +00:00
hardware nixos/udev: support /run/current-system/systemd in udevRules 2020-05-22 14:43:58 +02:00
logging nixos/logrotate: add newline before extraConfig 2020-05-13 20:52:26 -07:00
mail Merge pull request #87255 from symphorien/dovecot-restart-module 2020-05-08 15:05:10 +01:00
misc treewide: replace bazaar with breezy 2020-05-25 09:22:54 +02:00
monitoring nixos/*: use $out instead of $bin with buildGoPackage 2020-04-28 20:30:29 +10:00
network-filesystems nixos/ipfs: add startWhenNeeded option 2020-06-12 17:15:27 -05:00
networking nixos/networkmanager: apply --filter-policy=STRICT to modemmanager service 2020-05-23 20:49:13 -04:00
printing nixos/printing: make access to web-interface configurable 2020-04-25 19:48:34 +02:00
scheduling atd: systemd-udev-settle serves no purpose 2020-03-21 11:15:06 +08:00
search solr: drop 7.x series 2020-01-18 08:50:35 -05:00
security Merge pull request #75435 from Elyhaka/fprintd 2020-05-25 12:22:48 +02:00
system earlyoom: patch absolute dbus path and make nixos module up to date (#88443) 2020-05-25 10:13:55 -05:00
torrent Merge pull request #83287 from iv-nn/add-rtorrent-service 2020-05-24 08:14:41 -04:00
ttys
wayland nixos/cage: move ConditionPathExists to service config 2020-03-09 00:47:49 +01:00
web-apps Merge pull request #82753 from Kloenk/feature/engelsystem 2020-05-24 16:31:23 +02:00
web-servers nixos/nginx: always run systemctl of the currently running systemd 2020-05-21 10:31:47 +02:00
x11 Merge pull request #87934 from gnidorah/cde 2020-05-24 15:16:43 +02:00