tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
ipfs: autoMount working without root
Eric Litak
8 years ago
1a15c5d8
6324317c
+11
-8
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
network-filesystems
ipfs.nix
+11
-8
nixos/modules/services/network-filesystems/ipfs.nix
reviewed
···
6
6
cfg = config.services.ipfs;
7
7
8
8
ipfsFlags = toString ([
9
9
-
#(optionalString cfg.autoMount "--mount")
9
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
43
-
'' + optionalString false/*cfg.autoMount*/ ''
43
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
106
-
#autoMount = mkOption {
107
107
-
# type = types.bool;
108
108
-
# default = false;
109
109
-
# description = "Whether IPFS should try to mount /ipfs and /ipns at startup.";
110
110
-
#};
106
106
+
autoMount = mkOption {
107
107
+
type = types.bool;
108
108
+
default = false;
109
109
+
description = "Whether IPFS should try to mount /ipfs and /ipns at startup.";
110
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
188
+
environment.etc."fuse.conf" = mkIf cfg.autoMount { text = ''
189
189
+
user_allow_other
190
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
211
-
'' + optionalString false/*cfg.autoMount*/ ''
214
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
'';