lol

ipfs: autoMount working without root

+11 -8
+11 -8
nixos/modules/services/network-filesystems/ipfs.nix
··· 6 6 cfg = config.services.ipfs; 7 7 8 8 ipfsFlags = toString ([ 9 - #(optionalString cfg.autoMount "--mount") 9 + (optionalString cfg.autoMount "--mount") 10 10 (optionalString cfg.autoMigrate "--migrate") 11 11 (optionalString cfg.enableGC "--enable-gc") 12 12 (optionalString (cfg.serviceFdlimit != null) "--manage-fdlimit=false") ··· 40 40 ipfs repo fsck # workaround for BUG #4212 (https://github.com/ipfs/go-ipfs/issues/4214) 41 41 ipfs --local config Addresses.API ${cfg.apiAddress} 42 42 ipfs --local config Addresses.Gateway ${cfg.gatewayAddress} 43 - '' + optionalString false/*cfg.autoMount*/ '' 43 + '' + optionalString cfg.autoMount '' 44 44 ipfs --local config Mounts.FuseAllowOther --json true 45 45 ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir} 46 46 ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir} ··· 103 103 description = "Whether IPFS should try to migrate the file system automatically"; 104 104 }; 105 105 106 - #autoMount = mkOption { 107 - # type = types.bool; 108 - # default = false; 109 - # description = "Whether IPFS should try to mount /ipfs and /ipns at startup."; 110 - #}; 106 + autoMount = mkOption { 107 + type = types.bool; 108 + default = false; 109 + description = "Whether IPFS should try to mount /ipfs and /ipns at startup."; 110 + }; 111 111 112 112 ipfsMountDir = mkOption { 113 113 type = types.str; ··· 185 185 186 186 config = mkIf cfg.enable { 187 187 environment.systemPackages = [ wrapped ]; 188 + environment.etc."fuse.conf" = mkIf cfg.autoMount { text = '' 189 + user_allow_other 190 + ''; }; 188 191 189 192 users.extraUsers = mkIf (cfg.user == "ipfs") { 190 193 ipfs = { ··· 208 211 209 212 preStart = '' 210 213 install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.dataDir} 211 - '' + optionalString false/*cfg.autoMount*/ '' 214 + '' + optionalString cfg.autoMount '' 212 215 install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.ipfsMountDir} 213 216 install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.ipnsMountDir} 214 217 '';