ipfs: adding mountDir options but disabling broken autoMount

This commit is contained in:
Eric Litak 2017-08-30 08:24:09 -07:00
parent 5554ea5583
commit 5050c56382

View File

@ -6,7 +6,7 @@ let
cfg = config.services.ipfs; cfg = config.services.ipfs;
ipfsFlags = toString ([ ipfsFlags = toString ([
(optionalString cfg.autoMount "--mount") #(optionalString cfg.autoMount "--mount")
(optionalString cfg.autoMigrate "--migrate") (optionalString cfg.autoMigrate "--migrate")
(optionalString cfg.enableGC "--enable-gc") (optionalString cfg.enableGC "--enable-gc")
(optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=false") (optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=false")
@ -39,10 +39,10 @@ let
preStart = '' preStart = ''
ipfs --local config Addresses.API ${cfg.apiAddress} ipfs --local config Addresses.API ${cfg.apiAddress}
ipfs --local config Addresses.Gateway ${cfg.gatewayAddress} ipfs --local config Addresses.Gateway ${cfg.gatewayAddress}
'' + optionalString cfg.autoMount '' '' + optionalString false/*cfg.autoMount*/ ''
ipfs --local config Mounts.FuseAllowOther --json true ipfs --local config Mounts.FuseAllowOther --json true
mkdir -p $(ipfs --local config Mounts.IPFS) ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
mkdir -p $(ipfs --local config Mounts.IPNS) ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}
'' + concatStringsSep "\n" (collect '' + concatStringsSep "\n" (collect
isString isString
(mapAttrsRecursive (mapAttrsRecursive
@ -104,10 +104,22 @@ in {
''; '';
}; };
autoMount = mkOption { #autoMount = mkOption {
type = types.bool; # type = types.bool;
default = false; # default = false;
description = "Whether IPFS should try to mount /ipfs and /ipns at startup."; # description = "Whether IPFS should try to mount /ipfs and /ipns at startup.";
#};
ipfsMountDir = mkOption {
type = types.str;
default = "/ipfs";
description = "Where to mount the IPFS namespace to";
};
ipnsMountDir = mkOption {
type = types.str;
default = "/ipns";
description = "Where to mount the IPNS namespace to";
}; };
gatewayAddress = mkOption { gatewayAddress = mkOption {
@ -203,6 +215,9 @@ in {
preStart = '' preStart = ''
install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.dataDir} install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.dataDir}
'' + optionalString false/*cfg.autoMount*/ ''
install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.ipfsMountDir}
install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.ipnsMountDir}
''; '';
script = '' script = ''
if [[ ! -f ${cfg.dataDir}/config ]]; then if [[ ! -f ${cfg.dataDir}/config ]]; then