summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/gui/automatic-diskmount.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-05-04 16:57:21 +0200
committerjeschli <jeschli@gmail.com>2018-05-04 16:57:21 +0200
commit74cab14502ce3f482d96759eed4c7e648204e78e (patch)
tree1f82d99cc0dafdf87d33fcc3e3a9a865f95f3384 /makefu/2configs/gui/automatic-diskmount.nix
parent4f2bf83ff906b9ee0421dabba4ff7e9dab5b7802 (diff)
parentb81fe57e3e137a2449fb8cc5e627e484d84bb00e (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'makefu/2configs/gui/automatic-diskmount.nix')
-rw-r--r--makefu/2configs/gui/automatic-diskmount.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/makefu/2configs/gui/automatic-diskmount.nix b/makefu/2configs/gui/automatic-diskmount.nix
new file mode 100644
index 000000000..19933111a
--- /dev/null
+++ b/makefu/2configs/gui/automatic-diskmount.nix
@@ -0,0 +1,44 @@
+{ pkgs, ... }:
+with import <stockholm/lib>; #genid
+{ # auto-mounting via polkit
+ services.udisks2.enable = true;
+## automount all disks:
+# services.devmon.enable = true;
+# services.gnome3.gvfs.enable = true;
+ users.groups.storage = {
+ gid = genid "storage";
+ members = [ "makefu" ];
+ };
+ users.users.makefu.packages = with pkgs;[
+ gvfs pcmanfm lxmenu-data
+ ];
+ environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ];
+
+## allow users in group "storage" to mount disk
+# https://github.com/coldfix/udiskie/wiki/Permissions
+ security.polkit.extraConfig =
+ ''
+ polkit.addRule(function(action, subject) {
+ var YES = polkit.Result.YES;
+ var permission = {
+ "org.freedesktop.udisks.filesystem-mount": YES,
+ "org.freedesktop.udisks.luks-unlock": YES,
+ "org.freedesktop.udisks.drive-eject": YES,
+ "org.freedesktop.udisks.drive-detach": YES,
+ "org.freedesktop.udisks2.filesystem-mount": YES,
+ "org.freedesktop.udisks2.encrypted-unlock": YES,
+ "org.freedesktop.udisks2.eject-media": YES,
+ "org.freedesktop.udisks2.power-off-drive": YES,
+ "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
+ "org.freedesktop.udisks2.filesystem-unmount-others": YES,
+ "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
+ "org.freedesktop.udisks2.eject-media-other-seat": YES,
+ "org.freedesktop.udisks2.power-off-drive-other-seat": YES
+ };
+ if (subject.isInGroup("storage")) {
+ return permission[action.id];
+ }
+ });
+ '';
+
+}