modules/ipfs-cluster: make package configurable
This commit is contained in:
parent
2c8f38378b
commit
0c71c520fb
1 changed files with 10 additions and 4 deletions
|
@ -20,6 +20,12 @@ in {
|
|||
enable = mkEnableOption
|
||||
"Pinset orchestration for IPFS - requires ipfs daemon to be useful";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.ipfs-cluster;
|
||||
description = "ipfs-cluster package";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "ipfs";
|
||||
|
@ -75,14 +81,14 @@ in {
|
|||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.ipfs-cluster ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
|
||||
systemd.tmpfiles.rules =
|
||||
[ "d '${cfg.dataDir}' - ${cfg.user} ${cfg.group} - -" ];
|
||||
|
||||
systemd.services.ipfs-cluster-init = {
|
||||
path = [ "/run/wrappers" pkgs.ipfs-cluster ];
|
||||
path = [ "/run/wrappers" cfg.package ];
|
||||
environment.IPFS_CLUSTER_PATH = cfg.dataDir;
|
||||
wantedBy = [ "default.target" ];
|
||||
|
||||
|
@ -90,7 +96,7 @@ in {
|
|||
# "" clears exec list (man systemd.service -> execStart)
|
||||
ExecStart = [
|
||||
""
|
||||
"${pkgs.ipfs-cluster}/bin/ipfs-cluster-service init --consensus ${cfg.consensus} ${initFlags}"
|
||||
"${cfg.package}/bin/ipfs-cluster-service init --consensus ${cfg.consensus} ${initFlags}"
|
||||
];
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
|
@ -111,7 +117,7 @@ in {
|
|||
|
||||
serviceConfig = {
|
||||
ExecStart =
|
||||
[ "" "${pkgs.ipfs-cluster}/bin/ipfs-cluster-service daemon" ];
|
||||
[ "" "${cfg.package}/bin/ipfs-cluster-service daemon" ];
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue