2017-01-07 19:16:26 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2017-10-02 13:25:31 +02:00
|
|
|
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})
|
|
|
|
]
|
2018-07-24 12:59:11 +02:00
|
|
|
++ optional config.xsession.preferStatusNotifierItems "--appindicator"
|
2017-10-02 13:25:31 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
{
|
2017-09-26 23:40:31 +02:00
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
2018-07-24 12:59:11 +02:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule [ "services" "udiskie" "sni" ] ''
|
|
|
|
Support for Status Notifier Items is now configured globally through the
|
|
|
|
|
|
|
|
xsession.preferStatusNotifierItems
|
|
|
|
|
|
|
|
option. Please change to use that instead.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
options = {
|
|
|
|
services.udiskie = {
|
2017-10-02 13:25:31 +02:00
|
|
|
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>
|
|
|
|
'';
|
|
|
|
};
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf config.services.udiskie.enable {
|
|
|
|
systemd.user.services.udiskie = {
|
|
|
|
Unit = {
|
2017-10-02 13:25:31 +02:00
|
|
|
Description = "udiskie mount daemon";
|
2017-06-26 18:34:09 +02:00
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
2018-05-30 07:24:26 +02:00
|
|
|
ExecStart = "${pkgs.udiskie}/bin/udiskie -2 ${commandArgs}";
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Install = {
|
2017-01-09 22:45:42 +01:00
|
|
|
WantedBy = [ "graphical-session.target" ];
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|