git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitb32b56cd542b2f980eb46aa8a38430b127bea8c5 authorLuflosi <luflosi@luflosi.de> dateThu 22 Apr 2021, 20:04 (6 years ago) parentf3f3822
1 file changed+4−26
nixos/modules/services/network-filesystems/ipfs.nix+4−26
nixos/modules/services/network-filesystems/ipfs.nix+4−26
@@ -216,14 +216,11 @@ in {
216216
217217 systemd.packages = [ cfg.package ];
218218
219− systemd.services.ipfs-init = {
220− description = "IPFS Initializer";
221−
219+ systemd.services.ipfs = {
220+ path = [ "/run/wrappers" cfg.package ];
222221 environment.IPFS_PATH = cfg.dataDir;
223222
224− path = [ cfg.package ];
225−
226− script = ''
223+ preStart = ''
227224 if [[ ! -f ${cfg.dataDir}/config ]]; then
228225 ipfs init ${optionalString cfg.emptyRepo "-e"} \
229226 ${optionalString (! cfg.localDiscovery) "--profile=server"}
@@ -233,26 +230,7 @@ in {
233230 else "ipfs config profile apply server"
234231 }
235232 fi
236− '';
237−
238− wantedBy = [ "default.target" ];
239−
240− serviceConfig = {
241− Type = "oneshot";
242− RemainAfterExit = true;
243− User = cfg.user;
244− Group = cfg.group;
245− };
246− };
247−
248− systemd.services.ipfs = {
249− path = [ "/run/wrappers" cfg.package ];
250− environment.IPFS_PATH = cfg.dataDir;
251−
252− wants = [ "ipfs-init.service" ];
253− after = [ "ipfs-init.service" ];
254−
255− preStart = optionalString cfg.autoMount ''
233+ '' + optionalString cfg.autoMount ''
256234 ipfs --local config Mounts.FuseAllowOther --json true
257235 ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
258236 ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}