1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-18 17:19:45 +01:00
home-manager/modules/services/udiskie.nix

91 lines
2.4 KiB
Nix
Raw Normal View History

2017-01-07 19:16:26 +01:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.udiskie;
2020-02-02 00:39:17 +01:00
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})
] ++ optional config.xsession.preferStatusNotifierItems "--appindicator");
in {
meta.maintainers = [ maintainers.rycee ];
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 = {
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 = {
2020-02-02 00:39:17 +01:00
Unit = {
Description = "udiskie mount daemon";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
2020-02-02 00:39:17 +01:00
PartOf = [ "graphical-session.target" ];
};
2017-01-07 19:16:26 +01:00
2020-02-24 23:07:58 +01:00
Service = { ExecStart = "${pkgs.udiskie}/bin/udiskie ${commandArgs}"; };
2017-01-07 19:16:26 +01:00
2020-02-02 00:39:17 +01:00
Install = { WantedBy = [ "graphical-session.target" ]; };
2017-01-07 19:16:26 +01:00
};
};
}