aboutsummaryrefslogtreecommitdiff
path: root/modules/services/udiskie.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services/udiskie.nix')
-rw-r--r--modules/services/udiskie.nix59
1 files changed, 56 insertions, 3 deletions
diff --git a/modules/services/udiskie.nix b/modules/services/udiskie.nix
index a9451c325f0..e4d4f527915 100644
--- a/modules/services/udiskie.nix
+++ b/modules/services/udiskie.nix
@@ -2,25 +2,78 @@
with lib;
+let
+
+ cfg = config.services.udiskie;
+
+ commandArgs =
+ concatStringsSep " " (
+ map (opt: "-" + opt) [
+ (if cfg.automount then "a" else "A")
+ (if cfg.notify then "n" else "N")
+ ({ always = "t"; auto = "s"; never = "T"; }.${cfg.tray})
+ ]
+ );
+
+in
+
{
meta.maintainers = [ maintainers.rycee ];
options = {
services.udiskie = {
- enable = mkEnableOption "Udiskie mount daemon";
+ enable = mkEnableOption "udiskie mount daemon";
+
+ automount = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Whether to automatically mount new devices.";
+ };
+
+ notify = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Whether to show pop-up notifications.";
+ };
+
+ tray = mkOption {
+ type = types.enum [ "always" "auto" "never" ];
+ default = "auto";
+ description = ''
+ Whether to display tray icon.
+ </para><para>
+ The options are
+ <variablelist>
+ <varlistentry>
+ <term><literal>always</literal></term>
+ <listitem><para>Always show tray icon.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>auto</literal></term>
+ <listitem><para>
+ Show tray icon only when there is a device available.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>never</literal></term>
+ <listitem><para>Never show tray icon.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ '';
+ };
};
};
config = mkIf config.services.udiskie.enable {
systemd.user.services.udiskie = {
Unit = {
- Description = "Udiskie mount daemon";
+ Description = "udiskie mount daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
- ExecStart = "${pkgs.pythonPackages.udiskie}/bin/udiskie -2 -A -n -s";
+ ExecStart = "${pkgs.pythonPackages.udiskie}/bin/udiskie -2 ${commandArgs}";
};
Install = {