summary refs log tree commit diff
path: root/nixos/modules/services/network-filesystems/ipfs.nix
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2021-04-22 20:04:26 +0200
committerLuflosi <luflosi@luflosi.de>2021-04-22 21:13:05 +0200
commitb32b56cd542b2f980eb46aa8a38430b127bea8c5 (patch)
tree9ca13c18c6deff1c0261a95131c4796375de0049 /nixos/modules/services/network-filesystems/ipfs.nix
parentf3f3822dca57ba709cf0578370d672e52187c5da (diff)
downloadnixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar.gz
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar.bz2
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar.lz
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar.xz
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.tar.zst
nixpkgs-b32b56cd542b2f980eb46aa8a38430b127bea8c5.zip
nixos/ipfs: remove separate ipfs-init systemd unit
There is no need for a separate unit. Simplify the NixOS module by adding the shell code to preStart of the main unit, where the other initialization code already is.
Diffstat (limited to 'nixos/modules/services/network-filesystems/ipfs.nix')
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix30
1 files changed, 4 insertions, 26 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index 88d355ff32c..6d8dfcce933 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -216,14 +216,11 @@ in {
 
     systemd.packages = [ cfg.package ];
 
-    systemd.services.ipfs-init = {
-      description = "IPFS Initializer";
-
+    systemd.services.ipfs = {
+      path = [ "/run/wrappers" cfg.package ];
       environment.IPFS_PATH = cfg.dataDir;
 
-      path = [ cfg.package ];
-
-      script = ''
+      preStart = ''
         if [[ ! -f ${cfg.dataDir}/config ]]; then
           ipfs init ${optionalString cfg.emptyRepo "-e"} \
             ${optionalString (! cfg.localDiscovery) "--profile=server"}
@@ -233,26 +230,7 @@ in {
             else "ipfs config profile apply server"
           }
         fi
-      '';
-
-      wantedBy = [ "default.target" ];
-
-      serviceConfig = {
-        Type = "oneshot";
-        RemainAfterExit = true;
-        User = cfg.user;
-        Group = cfg.group;
-      };
-    };
-
-    systemd.services.ipfs = {
-      path = [ "/run/wrappers" cfg.package ];
-      environment.IPFS_PATH = cfg.dataDir;
-
-      wants = [ "ipfs-init.service" ];
-      after = [ "ipfs-init.service" ];
-
-      preStart = optionalString cfg.autoMount ''
+      '' + optionalString cfg.autoMount ''
         ipfs --local config Mounts.FuseAllowOther --json true
         ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
         ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}