mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
ipfs: added defaultMode, added norouting service
This commit is contained in:
parent
cb2f2aa563
commit
0f02879e01
@ -49,6 +49,12 @@ in
|
|||||||
description = "The data dir for IPFS";
|
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 {
|
autoMigrate = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
@ -147,10 +153,11 @@ in
|
|||||||
systemd.services.ipfs = {
|
systemd.services.ipfs = {
|
||||||
description = "IPFS Daemon";
|
description = "IPFS Daemon";
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = mkIf (cfg.defaultMode == "online") [ "multi-user.target" ];
|
||||||
|
|
||||||
after = [ "network.target" "local-fs.target" "ipfs-init.service" ];
|
after = [ "network.target" "local-fs.target" "ipfs-init.service" ];
|
||||||
|
|
||||||
conflicts = [ "ipfs-offline.service" ];
|
conflicts = [ "ipfs-offline.service" "ipfs-norouting.service"];
|
||||||
wants = [ "ipfs-init.service" ];
|
wants = [ "ipfs-init.service" ];
|
||||||
|
|
||||||
environment.IPFS_PATH = cfg.dataDir;
|
environment.IPFS_PATH = cfg.dataDir;
|
||||||
@ -169,9 +176,11 @@ in
|
|||||||
systemd.services.ipfs-offline = {
|
systemd.services.ipfs-offline = {
|
||||||
description = "IPFS Daemon (offline mode)";
|
description = "IPFS Daemon (offline mode)";
|
||||||
|
|
||||||
|
wantedBy = mkIf (cfg.defaultMode == "offline") [ "multi-user.target" ];
|
||||||
|
|
||||||
after = [ "local-fs.target" "ipfs-init.service" ];
|
after = [ "local-fs.target" "ipfs-init.service" ];
|
||||||
|
|
||||||
conflicts = [ "ipfs.service" ];
|
conflicts = [ "ipfs.service" "ipfs-norouting.service"];
|
||||||
wants = [ "ipfs-init.service" ];
|
wants = [ "ipfs-init.service" ];
|
||||||
|
|
||||||
environment.IPFS_PATH = cfg.dataDir;
|
environment.IPFS_PATH = cfg.dataDir;
|
||||||
@ -186,5 +195,29 @@ in
|
|||||||
RestartSec = 1;
|
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 New Issue
Block a user