Merge pull request #153098 from bb2020/udisks
nixos/udisks2: add mountOnMedia option
This commit is contained in:
commit
e1ffcb46cd
1 changed files with 19 additions and 5 deletions
|
@ -1,10 +1,9 @@
|
|||
# Udisks daemon.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.udisks2;
|
||||
settingsFormat = pkgs.formats.ini {
|
||||
listToValue = concatMapStringsSep "," (generators.mkValueStringDefault {});
|
||||
};
|
||||
|
@ -19,7 +18,17 @@ in
|
|||
|
||||
services.udisks2 = {
|
||||
|
||||
enable = mkEnableOption (lib.mdDoc "udisks2, a DBus service that allows applications to query and manipulate storage devices");
|
||||
enable = mkEnableOption (mdDoc "udisks2, a DBus service that allows applications to query and manipulate storage devices");
|
||||
|
||||
mountOnMedia = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = mdDoc ''
|
||||
When enabled, instructs udisks2 to mount removable drives under `/media/` directory, instead of the
|
||||
default, ACL-controlled `/run/media/$USER/`. Since `/media/` is not mounted as tmpfs by default, it
|
||||
requires cleanup to get rid of stale mountpoints; enabling this option will take care of this at boot.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption rec {
|
||||
type = types.attrsOf settingsFormat.type;
|
||||
|
@ -44,7 +53,7 @@ in
|
|||
};
|
||||
};
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
description = mdDoc ''
|
||||
Options passed to udisksd.
|
||||
See [here](http://manpages.ubuntu.com/manpages/latest/en/man5/udisks2.conf.5.html) and
|
||||
drive configuration in [here](http://manpages.ubuntu.com/manpages/latest/en/man8/udisks.8.html) for supported options.
|
||||
|
@ -73,10 +82,15 @@ in
|
|||
|
||||
services.dbus.packages = [ pkgs.udisks2 ];
|
||||
|
||||
systemd.tmpfiles.rules = [ "d /var/lib/udisks2 0755 root root -" ];
|
||||
systemd.tmpfiles.rules = [ "d /var/lib/udisks2 0755 root root -" ]
|
||||
++ optional cfg.mountOnMedia "D! /media 0755 root root -";
|
||||
|
||||
services.udev.packages = [ pkgs.udisks2 ];
|
||||
|
||||
services.udev.extraRules = optionalString cfg.mountOnMedia ''
|
||||
ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_FILESYSTEM_SHARED}="1"
|
||||
'';
|
||||
|
||||
systemd.packages = [ pkgs.udisks2 ];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue