mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
ipfs: added defaultMode, added norouting service
This commit is contained in:
parent
cb2f2aa563
commit
0f02879e01
1 changed files with 36 additions and 3 deletions
|
@ -49,6 +49,12 @@ in
|
|||
description = "The data dir for IPFS";
|
||||
};
|
||||
|
||||
defaultMode = mkOption {
|
||||
description = "systemd service that is enabled by default";
|
||||
type = types.enum [ "online" "offline" "norouting" ];
|
||||
default = "online";
|
||||
};
|
||||
|
||||
autoMigrate = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -147,10 +153,11 @@ in
|
|||
systemd.services.ipfs = {
|
||||
description = "IPFS Daemon";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wantedBy = mkIf (cfg.defaultMode == "online") [ "multi-user.target" ];
|
||||
|
||||
after = [ "network.target" "local-fs.target" "ipfs-init.service" ];
|
||||
|
||||
conflicts = [ "ipfs-offline.service" ];
|
||||
conflicts = [ "ipfs-offline.service" "ipfs-norouting.service"];
|
||||
wants = [ "ipfs-init.service" ];
|
||||
|
||||
environment.IPFS_PATH = cfg.dataDir;
|
||||
|
@ -169,9 +176,11 @@ in
|
|||
systemd.services.ipfs-offline = {
|
||||
description = "IPFS Daemon (offline mode)";
|
||||
|
||||
wantedBy = mkIf (cfg.defaultMode == "offline") [ "multi-user.target" ];
|
||||
|
||||
after = [ "local-fs.target" "ipfs-init.service" ];
|
||||
|
||||
conflicts = [ "ipfs.service" ];
|
||||
conflicts = [ "ipfs.service" "ipfs-norouting.service"];
|
||||
wants = [ "ipfs-init.service" ];
|
||||
|
||||
environment.IPFS_PATH = cfg.dataDir;
|
||||
|
@ -186,5 +195,29 @@ in
|
|||
RestartSec = 1;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.ipfs-norouting = {
|
||||
description = "IPFS Daemon (no routing mode)";
|
||||
|
||||
wantedBy = mkIf (cfg.defaultMode == "norouting") [ "multi-user.target" ];
|
||||
|
||||
after = [ "local-fs.target" "ipfs-init.service" ];
|
||||
|
||||
conflicts = [ "ipfs.service" "ipfs-offline.service"];
|
||||
wants = [ "ipfs-init.service" ];
|
||||
|
||||
environment.IPFS_PATH = cfg.dataDir;
|
||||
|
||||
path = [ pkgs.ipfs ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${ipfs}/bin/ipfs daemon ${ipfsFlags} --routing=none";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue