Merge pull request #120254 from Luflosi/ipfs-simplify-systemd-unit
nixos/ipfs: remove separate ipfs-init systemd unit
This commit is contained in:
commit
4230f632cc
1 changed files with 4 additions and 26 deletions
|
@ -216,14 +216,11 @@ in {
|
||||||
|
|
||||||
systemd.packages = [ cfg.package ];
|
systemd.packages = [ cfg.package ];
|
||||||
|
|
||||||
systemd.services.ipfs-init = {
|
systemd.services.ipfs = {
|
||||||
description = "IPFS Initializer";
|
path = [ "/run/wrappers" cfg.package ];
|
||||||
|
|
||||||
environment.IPFS_PATH = cfg.dataDir;
|
environment.IPFS_PATH = cfg.dataDir;
|
||||||
|
|
||||||
path = [ cfg.package ];
|
preStart = ''
|
||||||
|
|
||||||
script = ''
|
|
||||||
if [[ ! -f ${cfg.dataDir}/config ]]; then
|
if [[ ! -f ${cfg.dataDir}/config ]]; then
|
||||||
ipfs init ${optionalString cfg.emptyRepo "-e"} \
|
ipfs init ${optionalString cfg.emptyRepo "-e"} \
|
||||||
${optionalString (! cfg.localDiscovery) "--profile=server"}
|
${optionalString (! cfg.localDiscovery) "--profile=server"}
|
||||||
|
@ -233,26 +230,7 @@ in {
|
||||||
else "ipfs config profile apply server"
|
else "ipfs config profile apply server"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
'';
|
'' + optionalString cfg.autoMount ''
|
||||||
|
|
||||||
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 ''
|
|
||||||
ipfs --local config Mounts.FuseAllowOther --json true
|
ipfs --local config Mounts.FuseAllowOther --json true
|
||||||
ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
|
ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
|
||||||
ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}
|
ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}
|
||||||
|
|
Loading…
Reference in a new issue