1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-16 16:19:44 +01:00
home-manager/modules/services/udiskie.nix
Robert Helgesson e4c359d8b9
udiskie: add a few configuration options
The new options allow some control over automounting, notifications,
and the tray icon.

This commit also changes the defaults to automatically mount new
devices, udiskie was previously told not to automount. The change in
behavior is to closer match the default options.
2017-10-02 13:25:31 +02:00

84 lines
2.1 KiB
Nix

{ config, lib, pkgs, ... }:
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";
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";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.pythonPackages.udiskie}/bin/udiskie -2 ${commandArgs}";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}