summary refs log tree commit diff
path: root/nixos/modules/services/network-filesystems/ipfs.nix
diff options
context:
space:
mode:
authorEric Litak <elitak@gmail.com>2017-09-16 09:03:37 -0700
committerEric Litak <elitak@gmail.com>2017-09-17 23:57:25 -0700
commit1a15c5d8c63c0169497699a8b8784e600af34458 (patch)
tree9fdb25617399ac244e31fb55d788d56f2e2ceedd /nixos/modules/services/network-filesystems/ipfs.nix
parent6324317c7634e1cdbbf053b0528e098048617d17 (diff)
downloadnixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar.gz
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar.bz2
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar.lz
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar.xz
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.tar.zst
nixpkgs-1a15c5d8c63c0169497699a8b8784e600af34458.zip
ipfs: autoMount working without root
Diffstat (limited to 'nixos/modules/services/network-filesystems/ipfs.nix')
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index 1f8ed156a8e..36e5efecf43 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -6,7 +6,7 @@ let
   cfg = config.services.ipfs;
 
   ipfsFlags = toString ([
-    #(optionalString  cfg.autoMount                   "--mount")
+    (optionalString  cfg.autoMount                   "--mount")
     (optionalString  cfg.autoMigrate                 "--migrate")
     (optionalString  cfg.enableGC                    "--enable-gc")
     (optionalString (cfg.serviceFdlimit != null)     "--manage-fdlimit=false")
@@ -40,7 +40,7 @@ let
       ipfs repo fsck # workaround for BUG #4212 (https://github.com/ipfs/go-ipfs/issues/4214)
       ipfs --local config Addresses.API ${cfg.apiAddress}
       ipfs --local config Addresses.Gateway ${cfg.gatewayAddress}
-    '' + optionalString false/*cfg.autoMount*/ ''
+    '' + optionalString cfg.autoMount ''
       ipfs --local config Mounts.FuseAllowOther --json true
       ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
       ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}
@@ -103,11 +103,11 @@ in {
         description = "Whether IPFS should try to migrate the file system automatically";
       };
 
-      #autoMount = mkOption {
-      #  type = types.bool;
-      #  default = false;
-      #  description = "Whether IPFS should try to mount /ipfs and /ipns at startup.";
-      #};
+      autoMount = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Whether IPFS should try to mount /ipfs and /ipns at startup.";
+      };
 
       ipfsMountDir = mkOption {
         type = types.str;
@@ -185,6 +185,9 @@ in {
 
   config = mkIf cfg.enable {
     environment.systemPackages = [ wrapped ];
+    environment.etc."fuse.conf" = mkIf cfg.autoMount { text = ''
+      user_allow_other
+    ''; };
 
     users.extraUsers = mkIf (cfg.user == "ipfs") {
       ipfs = {
@@ -208,7 +211,7 @@ in {
 
       preStart = ''
         install -m 0755 -o ${cfg.user} -g ${cfg.group} -d ${cfg.dataDir}
-      '' + optionalString false/*cfg.autoMount*/ ''
+      '' + optionalString 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}
       '';