1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-08 18:11:05 +01:00

Apply nixfmt on many files

This commit is contained in:
Robert Helgesson 2020-02-02 00:39:17 +01:00
parent 9799d3de2d
commit 45abf3d38a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
177 changed files with 2850 additions and 3565 deletions

View file

@ -22,19 +22,15 @@ with lib;
config = mkIf config.services.blueman-applet.enable {
systemd.user.services.blueman-applet = {
Unit = {
Description = "Blueman applet";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "Blueman applet";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${pkgs.blueman}/bin/blueman-applet";
};
Service = { ExecStart = "${pkgs.blueman}/bin/blueman-applet"; };
};
};
}

View file

@ -9,37 +9,24 @@ let
package = pkgs.cbatticon;
makeCommand = commandName: commandArg:
optional (commandArg != null) (
let
cmd = pkgs.writeShellScript commandName commandArg;
in
"--${commandName} ${cmd}"
);
optional (commandArg != null)
(let cmd = pkgs.writeShellScript commandName commandArg;
in "--${commandName} ${cmd}");
commandLine = concatStringsSep " " (
[ "${package}/bin/cbatticon" ]
commandLine = concatStringsSep " " ([ "${package}/bin/cbatticon" ]
++ makeCommand "command-critical-level" cfg.commandCriticalLevel
++ makeCommand "command-left-click" cfg.commandLeftClick
++ optional
(cfg.iconType != null)
"--icon-type ${cfg.iconType}"
++ optional
(cfg.lowLevelPercent != null)
"--low-level ${toString cfg.lowLevelPercent}"
++ optional
(cfg.criticalLevelPercent != null)
"--critical-level ${toString cfg.criticalLevelPercent}"
++ optional
(cfg.updateIntervalSeconds != null)
"--update-interval ${toString cfg.updateIntervalSeconds}"
++ optional
(cfg.hideNotification != null && cfg.hideNotification)
"--hide-notification"
);
++ optional (cfg.iconType != null) "--icon-type ${cfg.iconType}"
++ optional (cfg.lowLevelPercent != null)
"--low-level ${toString cfg.lowLevelPercent}"
++ optional (cfg.criticalLevelPercent != null)
"--critical-level ${toString cfg.criticalLevelPercent}"
++ optional (cfg.updateIntervalSeconds != null)
"--update-interval ${toString cfg.updateIntervalSeconds}"
++ optional (cfg.hideNotification != null && cfg.hideNotification)
"--hide-notification");
in
{
in {
meta.maintainers = [ maintainers.pmiddend ];
options = {
@ -66,7 +53,8 @@ in
};
iconType = mkOption {
type = types.nullOr (types.enum [ "standard" "notification" "symbolic" ]);
type =
types.nullOr (types.enum [ "standard" "notification" "symbolic" ]);
default = null;
example = "symbolic";
description = "Icon type to display in the system tray.";
@ -119,9 +107,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = commandLine;

View file

@ -7,44 +7,41 @@ let
cfg = config.services.compton;
configFile = pkgs.writeText "compton.conf"
(optionalString cfg.fade ''
# fading
fading = true;
fade-delta = ${toString cfg.fadeDelta};
fade-in-step = ${elemAt cfg.fadeSteps 0};
fade-out-step = ${elemAt cfg.fadeSteps 1};
fade-exclude = ${toJSON cfg.fadeExclude};
'' +
optionalString cfg.shadow ''
configFile = pkgs.writeText "compton.conf" (optionalString cfg.fade ''
# fading
fading = true;
fade-delta = ${toString cfg.fadeDelta};
fade-in-step = ${elemAt cfg.fadeSteps 0};
fade-out-step = ${elemAt cfg.fadeSteps 1};
fade-exclude = ${toJSON cfg.fadeExclude};
'' + optionalString cfg.shadow ''
# shadows
shadow = true;
shadow-offset-x = ${toString (elemAt cfg.shadowOffsets 0)};
shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)};
shadow-opacity = ${cfg.shadowOpacity};
shadow-exclude = ${toJSON cfg.shadowExclude};
no-dock-shadow = ${toJSON cfg.noDockShadow};
no-dnd-shadow = ${toJSON cfg.noDNDShadow};
'' +
optionalString cfg.blur ''
# shadows
shadow = true;
shadow-offset-x = ${toString (elemAt cfg.shadowOffsets 0)};
shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)};
shadow-opacity = ${cfg.shadowOpacity};
shadow-exclude = ${toJSON cfg.shadowExclude};
no-dock-shadow = ${toJSON cfg.noDockShadow};
no-dnd-shadow = ${toJSON cfg.noDNDShadow};
'' + optionalString cfg.blur ''
# blur
blur-background = true;
blur-background-exclude = ${toJSON cfg.blurExclude};
'' + ''
# blur
blur-background = true;
blur-background-exclude = ${toJSON cfg.blurExclude};
'' + ''
# opacity
active-opacity = ${cfg.activeOpacity};
inactive-opacity = ${cfg.inactiveOpacity};
menu-opacity = ${cfg.menuOpacity};
opacity-rule = ${toJSON cfg.opacityRule};
# opacity
active-opacity = ${cfg.activeOpacity};
inactive-opacity = ${cfg.inactiveOpacity};
menu-opacity = ${cfg.menuOpacity};
opacity-rule = ${toJSON cfg.opacityRule};
# other options
backend = ${toJSON cfg.backend};
vsync = ${toJSON cfg.vSync};
refresh-rate = ${toString cfg.refreshRate};
'' + cfg.extraOptions);
# other options
backend = ${toJSON cfg.backend};
vsync = ${toJSON cfg.vSync};
refresh-rate = ${toString cfg.refreshRate};
'' + cfg.extraOptions);
in {
@ -61,11 +58,8 @@ in {
blurExclude = mkOption {
type = types.listOf types.str;
default = [];
example = [
"class_g = 'slop'"
"class_i = 'polybar'"
];
default = [ ];
example = [ "class_g = 'slop'" "class_i = 'polybar'" ];
description = ''
List of windows to exclude background blur.
See the
@ -105,12 +99,8 @@ in {
fadeExclude = mkOption {
type = types.listOf types.str;
default = [];
example = [
"window_type *= 'menu'"
"name ~= 'Firefox$'"
"focused = 1"
];
default = [ ];
example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
description = ''
List of conditions of windows that should not be faded.
See the
@ -150,12 +140,8 @@ in {
shadowExclude = mkOption {
type = types.listOf types.str;
default = [];
example = [
"window_type *= 'menu'"
"name ~= 'Firefox$'"
"focused = 1"
];
default = [ ];
example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
description = ''
List of conditions of windows that should have no shadow.
See the
@ -212,11 +198,8 @@ in {
opacityRule = mkOption {
type = types.listOf types.str;
default = [];
example = [
"87:class_i ?= 'scratchpad'"
"91:class_i ?= 'xterm'"
];
default = [ ];
example = [ "87:class_i ?= 'scratchpad'" "91:class_i ?= 'xterm'" ];
description = ''
List of opacity rules.
See the
@ -256,7 +239,7 @@ in {
default = 0;
example = 60;
description = ''
Screen refresh rate (0 = automatically detect).
Screen refresh rate (0 = automatically detect).
'';
};
@ -293,16 +276,13 @@ in {
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
Restart = "always";
RestartSec = 3;
}
// optionalAttrs (cfg.backend == "glx") {
} // optionalAttrs (cfg.backend == "glx") {
# Temporarily fixes corrupt colours with Mesa 18.
Environment = [ "allow_rgb10_configs=false" ];
};

View file

@ -6,17 +6,19 @@ let
cfg = config.services.dunst;
eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
eitherStrBoolIntList = with types;
either str (either bool (either int (listOf str)));
toDunstIni = generators.toINI {
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "yes" else "no")
else if isString value then "\"${value}\""
else toString value;
in
"${key}=${value'}";
let
value' = if isBool value then
(if value then "yes" else "no")
else if isString value then
''"${value}"''
else
toString value;
in "${key}=${value'}";
};
themeType = types.submodule {
@ -48,9 +50,7 @@ let
size = "32x32";
};
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -65,7 +65,7 @@ in
settings = mkOption {
type = with types; attrsOf (attrsOf eitherStrBoolIntList);
default = {};
default = { };
description = "Configuration written to ~/.config/dunstrc";
example = literalExample ''
{
@ -87,86 +87,73 @@ in
};
};
config = mkIf cfg.enable (
mkMerge [
{
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
config = mkIf cfg.enable (mkMerge [
{
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
services.dunst.settings.global.icon_path =
let
useCustomTheme =
cfg.iconTheme.package != hicolorTheme.package
|| cfg.iconTheme.name != hicolorTheme.name
|| cfg.iconTheme.size != hicolorTheme.size;
services.dunst.settings.global.icon_path = let
useCustomTheme = cfg.iconTheme.package != hicolorTheme.package
|| cfg.iconTheme.name != hicolorTheme.name || cfg.iconTheme.size
!= hicolorTheme.size;
basePaths = [
"/run/current-system/sw"
config.home.profileDirectory
cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package;
basePaths = [
"/run/current-system/sw"
config.home.profileDirectory
cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package;
themes =
[
cfg.iconTheme
] ++ optional useCustomTheme (
hicolorTheme // { size = cfg.iconTheme.size; }
);
themes = [ cfg.iconTheme ] ++ optional useCustomTheme
(hicolorTheme // { size = cfg.iconTheme.size; });
categories = [
"actions"
"animations"
"apps"
"categories"
"devices"
"emblems"
"emotes"
"filesystem"
"intl"
"mimetypes"
"places"
"status"
"stock"
];
in
concatStringsSep ":" (
concatMap (theme:
concatMap (basePath:
map (category:
"${basePath}/share/icons/${theme.name}/${theme.size}/${category}"
) categories
) basePaths
) themes
);
categories = [
"actions"
"animations"
"apps"
"categories"
"devices"
"emblems"
"emotes"
"filesystem"
"intl"
"mimetypes"
"places"
"status"
"stock"
];
in concatStringsSep ":" (concatMap (theme:
concatMap (basePath:
map (category:
"${basePath}/share/icons/${theme.name}/${theme.size}/${category}")
categories) basePaths) themes);
systemd.user.services.dunst = {
Unit = {
Description = "Dunst notification daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.dunst}/bin/dunst";
};
systemd.user.services.dunst = {
Unit = {
Description = "Dunst notification daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
}
(mkIf (cfg.settings != {}) {
xdg.configFile."dunst/dunstrc" = {
text = toDunstIni cfg.settings;
onChange = ''
pkillVerbose=""
if [[ -v VERBOSE ]]; then
pkillVerbose="-e"
fi
$DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
unset pkillVerbose
'';
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.dunst}/bin/dunst";
};
})
]
);
};
}
(mkIf (cfg.settings != { }) {
xdg.configFile."dunst/dunstrc" = {
text = toDunstIni cfg.settings;
onChange = ''
pkillVerbose=""
if [[ -v VERBOSE ]]; then
pkillVerbose="-e"
fi
$DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
unset pkillVerbose
'';
};
})
]);
}

View file

@ -10,9 +10,8 @@ let
configText = builtins.toJSON ({ inherit (cfg) order; } // cfg.extraConfig);
configFile = pkgs.writeText "dwm-status.json" configText;
in
{
in {
options = {
services.dwm-status = {
enable = mkEnableOption "dwm-status user service";
@ -32,7 +31,7 @@ in
extraConfig = mkOption {
type = types.attrs;
default = {};
default = { };
example = literalExample ''
{
separator = "#";
@ -58,13 +57,9 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/dwm-status ${configFile}";
};
Service = { ExecStart = "${cfg.package}/bin/dwm-status ${configFile}"; };
};
};
}

View file

@ -8,26 +8,21 @@ let
emacsCfg = config.programs.emacs;
emacsBinPath = "${emacsCfg.finalPackage}/bin";
in
{
options.services.emacs = {
enable = mkEnableOption "the Emacs daemon";
};
in {
options.services.emacs = { enable = mkEnableOption "the Emacs daemon"; };
config = mkIf cfg.enable {
assertions = [
{
assertion = emacsCfg.enable;
message = "The Emacs service module requires"
+ " 'programs.emacs.enable = true'.";
}
];
assertions = [{
assertion = emacsCfg.enable;
message = "The Emacs service module requires"
+ " 'programs.emacs.enable = true'.";
}];
systemd.user.services.emacs = {
Unit = {
Description = "Emacs: the extensible, self-documenting text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
Documentation =
"info:emacs man:emacs(1) https://gnu.org/software/emacs/";
# Avoid killing the Emacs session, which may be full of
# unsaved buffers.
@ -35,14 +30,13 @@ in
};
Service = {
ExecStart = "${pkgs.runtimeShell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStart =
"${pkgs.runtimeShell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStop = "${emacsBinPath}/emacsclient --eval '(kill-emacs)'";
Restart = "on-failure";
};
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}

View file

@ -7,16 +7,10 @@ let
cfg = config.services.flameshot;
package = pkgs.flameshot;
in
{
in {
meta.maintainers = [ maintainers.hamhut1066 ];
options = {
services.flameshot = {
enable = mkEnableOption "Flameshot";
};
};
options = { services.flameshot = { enable = mkEnableOption "Flameshot"; }; };
config = mkIf cfg.enable {
home.packages = [ package ];
@ -33,9 +27,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -6,17 +6,19 @@ let
cfg = config.services.getmail;
accounts = filter (a: a.getmail.enable)
(attrValues config.accounts.email.accounts);
accounts =
filter (a: a.getmail.enable) (attrValues config.accounts.email.accounts);
# Note: The getmail service does not expect a path, but just the filename!
renderConfigFilepath = a: if a.primary then "getmailrc" else "getmail${a.name}";
configFiles = concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts;
in
{
renderConfigFilepath = a:
if a.primary then "getmailrc" else "getmail${a.name}";
configFiles =
concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts;
in {
options = {
services.getmail = {
enable = mkEnableOption "the getmail systemd service to automatically retrieve mail";
enable = mkEnableOption
"the getmail systemd service to automatically retrieve mail";
frequency = mkOption {
type = types.str;
@ -36,25 +38,17 @@ in
config = mkIf cfg.enable {
systemd.user.services.getmail = {
Unit = {
Description = "getmail email fetcher";
};
Service = {
ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}";
};
Unit = { Description = "getmail email fetcher"; };
Service = { ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}"; };
};
systemd.user.timers.getmail = {
Unit = {
Description = "getmail email fetcher";
};
Unit = { Description = "getmail email fetcher"; };
Timer = {
OnCalendar = "${cfg.frequency}";
Unit = "getmail.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};

View file

@ -6,9 +6,7 @@ let
cfg = config.services.gnome-keyring;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -16,8 +14,8 @@ in
enable = mkEnableOption "GNOME Keyring";
components = mkOption {
type = types.listOf (types.enum ["pkcs11" "secrets" "ssh"]);
default = [];
type = types.listOf (types.enum [ "pkcs11" "secrets" "ssh" ]);
default = [ ];
description = ''
The GNOME keyring components to start. If empty then the
default set of components will be started.
@ -34,22 +32,15 @@ in
};
Service = {
ExecStart =
let
args = concatStringsSep " " (
[ "--start" "--foreground" ]
++ optional (cfg.components != []) (
"--components=" + concatStringsSep "," cfg.components
)
);
in
"${pkgs.gnome3.gnome_keyring}/bin/gnome-keyring-daemon ${args}";
ExecStart = let
args = concatStringsSep " " ([ "--start" "--foreground" ]
++ optional (cfg.components != [ ])
("--components=" + concatStringsSep "," cfg.components));
in "${pkgs.gnome3.gnome_keyring}/bin/gnome-keyring-daemon ${args}";
Restart = "on-abort";
};
Install = {
WantedBy = [ "graphical-session-pre.target" ];
};
Install = { WantedBy = [ "graphical-session-pre.target" ]; };
};
};
}

View file

@ -6,12 +6,10 @@ let
cfg = config.services.grobi;
eitherStrBoolIntList =
with types; either str (either bool (either int (listOf str)));
eitherStrBoolIntList = with types;
either str (either bool (either int (listOf str)));
in
{
in {
meta.maintainers = [ maintainers.mbrgm ];
options = {
@ -20,7 +18,7 @@ in
executeAfter = mkOption {
type = with types; listOf str;
default = [];
default = [ ];
example = [ "setxkbmap dvorak" ];
description = ''
Commands to be run after an output configuration was
@ -32,7 +30,7 @@ in
rules = mkOption {
type = with types; listOf (attrsOf eitherStrBoolIntList);
default = [];
default = [ ];
example = literalExample ''
[
{
@ -88,9 +86,7 @@ in
Environment = "PATH=${pkgs.xorg.xrandr}/bin:${pkgs.bash}/bin";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
xdg.configFile."grobi.conf".text = builtins.toJSON {

View file

@ -6,23 +6,16 @@ let
cfg = config.services.hound;
configFile = pkgs.writeText "hound-config.json" (
builtins.toJSON {
max-concurrent-indexers = cfg.maxConcurrentIndexers;
dbpath = cfg.databasePath;
repos = cfg.repositories;
health-check-url = "/healthz";
}
);
configFile = pkgs.writeText "hound-config.json" (builtins.toJSON {
max-concurrent-indexers = cfg.maxConcurrentIndexers;
dbpath = cfg.databasePath;
repos = cfg.repositories;
health-check-url = "/healthz";
});
houndOptions = [
"--addr ${cfg.listenAddress}"
"--conf ${configFile}"
];
houndOptions = [ "--addr ${cfg.listenAddress}" "--conf ${configFile}" ];
in
{
in {
meta.maintainers = [ maintainers.adisbladis ];
options.services.hound = {
@ -37,7 +30,7 @@ in
databasePath = mkOption {
type = types.path;
default = "${config.xdg.dataHome}/hound";
defaultText = "\$XDG_DATA_HOME/hound";
defaultText = "$XDG_DATA_HOME/hound";
description = "The Hound database path.";
};
@ -49,7 +42,7 @@ in
repositories = mkOption {
type = types.attrsOf (types.uniq types.attrs);
default = {};
default = { };
example = literalExample ''
{
SomeGitRepo = {
@ -67,17 +60,14 @@ in
home.packages = [ pkgs.hound ];
systemd.user.services.hound = {
Unit = {
Description = "Hound source code search engine";
};
Unit = { Description = "Hound source code search engine"; };
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Service = {
Environment = "PATH=${makeBinPath [ pkgs.mercurial pkgs.git ]}";
ExecStart = "${pkgs.hound}/bin/houndd ${concatStringsSep " " houndOptions}";
ExecStart =
"${pkgs.hound}/bin/houndd ${concatStringsSep " " houndOptions}";
};
};
};

View file

@ -16,13 +16,16 @@ with lib;
onNotifyPost = mkOption {
type = with types; either str (attrsOf str);
default = "";
example = { mail = "\${pkgs.notmuch}/bin/notmuch new && \${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; };
example = {
mail =
"\${pkgs.notmuch}/bin/notmuch new && \${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
};
description = "Shell commands to run after onNotify event.";
};
boxes = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
example = [ "Inbox" "[Gmail]/MyLabel" ];
description = "IMAP folders to watch.";
};

View file

@ -6,102 +6,85 @@ let
cfg = config.services.imapnotify;
safeName = lib.replaceChars ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
safeName = lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
imapnotifyAccounts =
filter (a: a.imapnotify.enable)
(attrValues config.accounts.email.accounts);
filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts);
genAccountUnit = account:
let
name = safeName account.name;
in
{
name = "imapnotify-${name}";
value = {
Unit = {
Description = "imapnotify for ${name}";
};
let name = safeName account.name;
in {
name = "imapnotify-${name}";
value = {
Unit = { Description = "imapnotify for ${name}"; };
Service = {
ExecStart = "${pkgs.imapnotify}/bin/imapnotify -c ${genAccountConfig account}";
} // optionalAttrs account.notmuch.enable {
Environment = "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
};
Install = {
WantedBy = [ "default.target" ];
};
Service = {
ExecStart =
"${pkgs.imapnotify}/bin/imapnotify -c ${genAccountConfig account}";
} // optionalAttrs account.notmuch.enable {
Environment =
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
};
Install = { WantedBy = [ "default.target" ]; };
};
};
genAccountConfig = account:
pkgs.writeText "imapnotify-${safeName account.name}-config.js" (
let
port =
if account.imap.port != null then account.imap.port
else if account.imap.tls.enable then 993
else 143;
pkgs.writeText "imapnotify-${safeName account.name}-config.js" (let
port = if account.imap.port != null then
account.imap.port
else if account.imap.tls.enable then
993
else
143;
toJSON = builtins.toJSON;
in
''
var child_process = require('child_process');
toJSON = builtins.toJSON;
in ''
var child_process = require('child_process');
function getStdout(cmd) {
var stdout = child_process.execSync(cmd);
return stdout.toString().trim();
}
function getStdout(cmd) {
var stdout = child_process.execSync(cmd);
return stdout.toString().trim();
}
exports.host = ${toJSON account.imap.host}
exports.port = ${toJSON port};
exports.tls = ${toJSON account.imap.tls.enable};
exports.username = ${toJSON account.userName};
exports.password = getStdout("${toString account.passwordCommand}");
exports.onNotify = ${toJSON account.imapnotify.onNotify};
exports.onNotifyPost = ${toJSON account.imapnotify.onNotifyPost};
exports.boxes = ${toJSON account.imapnotify.boxes};
''
);
exports.host = ${toJSON account.imap.host}
exports.port = ${toJSON port};
exports.tls = ${toJSON account.imap.tls.enable};
exports.username = ${toJSON account.userName};
exports.password = getStdout("${toString account.passwordCommand}");
exports.onNotify = ${toJSON account.imapnotify.onNotify};
exports.onNotifyPost = ${toJSON account.imapnotify.onNotifyPost};
exports.boxes = ${toJSON account.imapnotify.boxes};
'');
in
{
in {
meta.maintainers = [ maintainers.nickhu ];
options = {
services.imapnotify = {
enable = mkEnableOption "imapnotify";
};
services.imapnotify = { enable = mkEnableOption "imapnotify"; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (
import ./imapnotify-accounts.nix
));
type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix));
};
};
config = mkIf cfg.enable {
assertions =
let
checkAccounts = pred: msg:
let
badAccounts = filter pred imapnotifyAccounts;
in
{
assertion = badAccounts == [];
message = "imapnotify: Missing ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in
[
(checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command")
(checkAccounts (a: a.userName == null) "username")
];
assertions = let
checkAccounts = pred: msg:
let badAccounts = filter pred imapnotifyAccounts;
in {
assertion = badAccounts == [ ];
message = "imapnotify: Missing ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in [
(checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command")
(checkAccounts (a: a.userName == null) "username")
];
systemd.user.services =
listToAttrs (map genAccountUnit imapnotifyAccounts);
systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts);
};
}

View file

@ -7,9 +7,7 @@ let
cfg = config.services.kdeconnect;
package = pkgs.kdeconnect;
in
{
in {
meta.maintainers = [ maintainers.adisbladis ];
options = {
@ -31,14 +29,13 @@ in
systemd.user.services.kdeconnect = {
Unit = {
Description = "Adds communication between your desktop and your smartphone";
Description =
"Adds communication between your desktop and your smartphone";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
@ -52,16 +49,16 @@ in
systemd.user.services.kdeconnect-indicator = {
Unit = {
Description = "kdeconnect-indicator";
After = [ "graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service" ];
After = [
"graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -13,19 +13,15 @@ with lib;
config = mkIf config.services.keepassx.enable {
systemd.user.services.keepassx = {
Unit = {
Description = "KeePassX password manager";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "KeePassX password manager";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${pkgs.keepassx}/bin/keepassx -min -lock";
};
Service = { ExecStart = "${pkgs.keepassx}/bin/keepassx -min -lock"; };
};
};
}

View file

@ -6,14 +6,10 @@ let
cfg = config.services.lorri;
in
{
in {
meta.maintainers = [ maintainers.gerschtli ];
options = {
services.lorri.enable = mkEnableOption "lorri build daemon";
};
options = { services.lorri.enable = mkEnableOption "lorri build daemon"; };
config = mkIf cfg.enable {
home.packages = [ pkgs.lorri ];
@ -33,25 +29,22 @@ in
ProtectSystem = "strict";
ProtectHome = "read-only";
Restart = "on-failure";
Environment =
let path = with pkgs; makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
in "PATH=${path}";
Environment = let
path = with pkgs;
makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
in "PATH=${path}";
};
};
sockets.lorri = {
Unit = {
Description = "Socket for lorri build daemon";
};
Unit = { Description = "Socket for lorri build daemon"; };
Socket = {
ListenStream = "%t/lorri/daemon.socket";
RuntimeDirectory = "lorri";
};
Install = {
WantedBy = [ "sockets.target" ];
};
Install = { WantedBy = [ "sockets.target" ]; };
};
};
};

View file

@ -6,14 +6,10 @@ let
cfg = config.services.mbsync;
mbsyncOptions =
[ "--all"
] ++ optional (cfg.verbose) "--verbose"
++ optional (cfg.configFile != null) "--config ${cfg.configFile}";
mbsyncOptions = [ "--all" ] ++ optional (cfg.verbose) "--verbose"
++ optional (cfg.configFile != null) "--config ${cfg.configFile}";
in
{
in {
meta.maintainers = [ maintainers.pjones ];
options.services.mbsync = {
@ -81,30 +77,28 @@ in
config = mkIf cfg.enable {
systemd.user.services.mbsync = {
Unit = {
Description = "mbsync mailbox synchronization";
};
Unit = { Description = "mbsync mailbox synchronization"; };
Service = {
Type = "oneshot";
ExecStart = "${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}";
} // (optionalAttrs (cfg.postExec != null) { ExecStartPost = cfg.postExec; })
// (optionalAttrs (cfg.preExec != null) { ExecStartPre = cfg.preExec; });
ExecStart =
"${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}";
} // (optionalAttrs (cfg.postExec != null) {
ExecStartPost = cfg.postExec;
}) // (optionalAttrs (cfg.preExec != null) {
ExecStartPre = cfg.preExec;
});
};
systemd.user.timers.mbsync = {
Unit = {
Description = "mbsync mailbox synchronization";
};
Unit = { Description = "mbsync mailbox synchronization"; };
Timer = {
OnCalendar = cfg.frequency;
Unit = "mbsync.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -9,11 +9,11 @@ let
toIni = generators.toINI {
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "True" else "False")
else toString value;
in
"${key} = ${value'}";
value' = if isBool value then
(if value then "True" else "False")
else
toString value;
in "${key} = ${value'}";
};
mpdris2Conf = {
@ -29,9 +29,7 @@ let
};
};
in
{
in {
meta.maintainers = [ maintainers.pjones ];
options.services.mpdris2 = {
@ -76,19 +74,15 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}
];
assertions = [{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}];
xdg.configFile."mpDris2/mpDris2.conf".text = toIni mpdris2Conf;
systemd.user.services.mpdris2 = {
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Unit = {
Description = "MPRIS 2 support for MPD";

View file

@ -150,23 +150,21 @@ in {
};
config = let
mapRemotes = gen: with attrsets; mapAttrs'
mapRemotes = gen:
with attrsets;
mapAttrs'
(name: remoteCfg: nameValuePair "muchsync-${name}" (gen name remoteCfg))
cfg.remotes;
in mkIf (cfg.remotes != { }) {
assertions = [
{
assertion = config.programs.notmuch.enable;
message = ''
The muchsync module requires 'programs.notmuch.enable = true'.
'';
}
];
assertions = [{
assertion = config.programs.notmuch.enable;
message = ''
The muchsync module requires 'programs.notmuch.enable = true'.
'';
}];
systemd.user.services = mapRemotes (name: remoteCfg: {
Unit = {
Description = "muchsync sync service (${name})";
};
Unit = { Description = "muchsync sync service (${name})"; };
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
@ -175,8 +173,7 @@ in {
''"NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"''
''"NMBGIT=${config.home.sessionVariables.NMBGIT}"''
];
ExecStart = concatStringsSep " " (
[ "${pkgs.muchsync}/bin/muchsync" ]
ExecStart = concatStringsSep " " ([ "${pkgs.muchsync}/bin/muchsync" ]
++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ]
++ optional (!remoteCfg.upload) "--noup"
@ -187,25 +184,20 @@ in {
# remote configuration
++ [ (escapeShellArg remoteCfg.remote.host) ]
++ optional (remoteCfg.remote.muchsyncPath != "")
"-r ${escapeShellArg remoteCfg.remote.muchsyncPath}"
"-r ${escapeShellArg remoteCfg.remote.muchsyncPath}"
++ optional remoteCfg.remote.checkForModifiedFiles "-F"
++ optional (!remoteCfg.remote.importNew) "--nonew"
);
++ optional (!remoteCfg.remote.importNew) "--nonew");
};
});
systemd.user.timers = mapRemotes (name: remoteCfg: {
Unit = {
Description = "muchsync periodic sync (${name})";
};
Unit = { Description = "muchsync periodic sync (${name})"; };
Timer = {
Unit = "muchsync-${name}.service";
OnCalendar = remoteCfg.frequency;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
});
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.services.network-manager-applet;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -25,17 +23,13 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = toString (
[
"${pkgs.networkmanagerapplet}/bin/nm-applet"
"--sm-disable"
] ++ optional config.xsession.preferStatusNotifierItems "--indicator"
);
ExecStart = toString
([ "${pkgs.networkmanagerapplet}/bin/nm-applet" "--sm-disable" ]
++ optional config.xsession.preferStatusNotifierItems
"--indicator");
};
};
};

View file

@ -4,9 +4,7 @@ with lib;
{
options = {
services.nextcloud-client = {
enable = mkEnableOption "Nextcloud Client";
};
services.nextcloud-client = { enable = mkEnableOption "Nextcloud Client"; };
};
config = mkIf config.services.nextcloud-client.enable {
@ -22,9 +20,7 @@ with lib;
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -4,9 +4,7 @@ with lib;
{
options = {
services.owncloud-client = {
enable = mkEnableOption "Owncloud Client";
};
services.owncloud-client = { enable = mkEnableOption "Owncloud Client"; };
};
config = mkIf config.services.owncloud-client.enable {
@ -22,9 +20,7 @@ with lib;
ExecStart = "${pkgs.owncloud-client}/bin/owncloud";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -7,15 +7,11 @@ let
cfg = config.services.parcellite;
package = pkgs.parcellite;
in
{
in {
meta.maintainers = [ maintainers.gleber ];
options = {
services.parcellite = {
enable = mkEnableOption "Parcellite";
};
services.parcellite = { enable = mkEnableOption "Parcellite"; };
};
config = mkIf cfg.enable {
@ -28,9 +24,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${package}/bin/parcellite";

View file

@ -7,9 +7,7 @@ let
serviceCfg = config.services.password-store-sync;
programCfg = config.programs.password-store;
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
options.services.password-store-sync = {
@ -35,28 +33,22 @@ in
};
config = mkIf serviceCfg.enable {
assertions = [
{
assertion = programCfg.enable;
message = "The 'services.password-store-sync' module requires"
+ " 'programs.password-store.enable = true'.";
}
];
assertions = [{
assertion = programCfg.enable;
message = "The 'services.password-store-sync' module requires"
+ " 'programs.password-store.enable = true'.";
}];
systemd.user.services.password-store-sync = {
Unit = {
Description = "Password store sync";
};
Unit = { Description = "Password store sync"; };
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
Environment =
let
makeEnvironmentPairs =
mapAttrsToList (key: value: "${key}=${builtins.toJSON value}");
in
makeEnvironmentPairs programCfg.settings;
Environment = let
makeEnvironmentPairs =
mapAttrsToList (key: value: "${key}=${builtins.toJSON value}");
in makeEnvironmentPairs programCfg.settings;
ExecStart = toString (pkgs.writeShellScript "password-store-sync" ''
${pkgs.pass}/bin/pass git pull --rebase && \
${pkgs.pass}/bin/pass git push
@ -65,9 +57,7 @@ in
};
systemd.user.timers.password-store-sync = {
Unit = {
Description = "Password store periodic sync";
};
Unit = { Description = "Password store periodic sync"; };
Timer = {
Unit = "password-store-sync.service";
@ -75,9 +65,7 @@ in
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -6,31 +6,25 @@ with lib;
meta.maintainers = [ maintainers.pltanton ];
options = {
services.pasystray = {
enable = mkEnableOption "PulseAudio system tray";
};
services.pasystray = { enable = mkEnableOption "PulseAudio system tray"; };
};
config = mkIf config.services.pasystray.enable {
systemd.user.services.pasystray = {
Unit = {
Description = "PulseAudio system tray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "PulseAudio system tray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment =
let
toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
in
[ "PATH=${toolPaths}" ];
ExecStart = "${pkgs.pasystray}/bin/pasystray";
};
Service = {
Environment =
let toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
in [ "PATH=${toolPaths}" ];
ExecStart = "${pkgs.pasystray}/bin/pasystray";
};
};
};
}

View file

@ -6,30 +6,28 @@ let
cfg = config.services.polybar;
eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
eitherStrBoolIntList = with types;
either str (either bool (either int (listOf str)));
toPolybarIni = generators.toINI {
mkKeyValue = key: value:
let
quoted = v:
if hasPrefix " " v || hasSuffix " " v
then ''"${v}"''
else v;
if hasPrefix " " v || hasSuffix " " v then ''"${v}"'' else v;
value' =
if isBool value then (if value then "true" else "false")
else if (isString value && key != "include-file") then quoted value
else toString value;
in
"${key}=${value'}";
value' = if isBool value then
(if value then "true" else "false")
else if (isString value && key != "include-file") then
quoted value
else
toString value;
in "${key}=${value'}";
};
configFile = pkgs.writeText "polybar.conf"
(toPolybarIni cfg.config + "\n" + cfg.extraConfig);
in
{
in {
options = {
services.polybar = {
enable = mkEnableOption "Polybar status bar";
@ -39,7 +37,7 @@ in
default = pkgs.polybar;
defaultText = literalExample "pkgs.polybar";
description = "Polybar package to install.";
example = literalExample ''
example = literalExample ''
pkgs.polybar.override {
i3GapsSupport = true;
alsaSupport = true;
@ -50,15 +48,14 @@ in
};
config = mkOption {
type = types.coercedTo
types.path
type = types.coercedTo types.path
(p: { "section/base" = { include-file = "${p}"; }; })
(types.attrsOf (types.attrsOf eitherStrBoolIntList));
description = ''
Polybar configuration. Can be either path to a file, or set of attributes
that will be used to create the final configuration.
'';
default = {};
default = { };
example = literalExample ''
{
"bar/top" = {
@ -118,25 +115,20 @@ in
Description = "Polybar status bar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = [
"${config.xdg.configFile."polybar/config".source}"
];
X-Restart-Triggers =
[ "${config.xdg.configFile."polybar/config".source}" ];
};
Service = {
Type = "forking";
Environment = "PATH=${cfg.package}/bin:/run/wrappers/bin";
ExecStart =
let
scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
in
"${scriptPkg}/bin/polybar-start";
let scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
in "${scriptPkg}/bin/polybar-start";
Restart = "on-failure";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};

View file

@ -6,18 +6,11 @@ let
cfg = config.services.random-background;
flags = lib.concatStringsSep " " (
[
"--bg-${cfg.display}"
"--no-fehbg"
"--randomize"
]
++ lib.optional (!cfg.enableXinerama) "--no-xinerama"
);
flags = lib.concatStringsSep " "
([ "--bg-${cfg.display}" "--no-fehbg" "--randomize" ]
++ lib.optional (!cfg.enableXinerama) "--no-xinerama");
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -73,41 +66,32 @@ in
};
};
config = mkIf cfg.enable (
mkMerge ([
{
systemd.user.services.random-background = {
Unit = {
Description = "Set random desktop background using feh";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
config = mkIf cfg.enable (mkMerge ([
{
systemd.user.services.random-background = {
Unit = {
Description = "Set random desktop background using feh";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
}
(mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = {
Description = "Set random desktop background using feh";
};
Timer = {
OnUnitActiveSec = cfg.interval;
};
Install = {
WantedBy = [ "timers.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle";
};
})
]));
Install = { WantedBy = [ "graphical-session.target" ]; };
};
}
(mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = { Description = "Set random desktop background using feh"; };
Timer = { OnUnitActiveSec = cfg.interval; };
Install = { WantedBy = [ "timers.target" ]; };
};
})
]));
}

View file

@ -8,9 +8,7 @@ let
cfg = config.services.redshift;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options.services.redshift = {
@ -113,7 +111,7 @@ in
extraOptions = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
example = [ "-v" "-m randr" ];
description = ''
Additional command-line arguments to pass to
@ -123,17 +121,13 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertion =
cfg.provider == "manual"
-> cfg.latitude != null && cfg.longitude != null;
message =
"Must provide services.redshift.latitude and"
+ " services.redshift.latitude when"
+ " services.redshift.provider is set to \"manual\".";
}
];
assertions = [{
assertion = cfg.provider == "manual" -> cfg.latitude != null
&& cfg.longitude != null;
message = "Must provide services.redshift.latitude and"
+ " services.redshift.latitude when"
+ " services.redshift.provider is set to \"manual\".";
}];
systemd.user.services.redshift = {
Unit = {
@ -142,27 +136,25 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart =
let
providerString =
if cfg.provider == "manual"
then "${cfg.latitude}:${cfg.longitude}"
else cfg.provider;
ExecStart = let
providerString = if cfg.provider == "manual" then
"${cfg.latitude}:${cfg.longitude}"
else
cfg.provider;
args = [
"-l ${providerString}"
"-t ${toString cfg.temperature.day}:${toString cfg.temperature.night}"
"-b ${toString cfg.brightness.day}:${toString cfg.brightness.night}"
] ++ cfg.extraOptions;
args = [
"-l ${providerString}"
"-t ${toString cfg.temperature.day}:${
toString cfg.temperature.night
}"
"-b ${toString cfg.brightness.day}:${toString cfg.brightness.night}"
] ++ cfg.extraOptions;
command = if cfg.tray then "redshift-gtk" else "redshift";
in
"${cfg.package}/bin/${command} ${concatStringsSep " " args}";
command = if cfg.tray then "redshift-gtk" else "redshift";
in "${cfg.package}/bin/${command} ${concatStringsSep " " args}";
RestartSec = 3;
Restart = "always";
};

View file

@ -6,9 +6,7 @@ let
cfg = config.services.rsibreak;
in
{
in {
options.services.rsibreak = {
enable = mkEnableOption "rsibreak";
@ -23,9 +21,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -29,7 +29,7 @@ in {
xautolockExtraOptions = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
Extra command-line arguments to pass to <command>xautolock</command>.
'';
@ -37,7 +37,7 @@ in {
xssLockExtraOptions = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
Extra command-line arguments to pass to <command>xss-lock</command>.
'';
@ -53,9 +53,7 @@ in {
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = concatStringsSep " " ([
@ -70,7 +68,9 @@ in {
# xss-lock will run specified screen locker when the session is locked via loginctl
# can't be started as a systemd service,
# see https://bitbucket.org/raymonad/xss-lock/issues/13/allow-operation-as-systemd-user-unit
xsession.initExtra = "${pkgs.xss-lock}/bin/xss-lock ${concatStringsSep " " cfg.xssLockExtraOptions} -- ${cfg.lockCmd} &";
xsession.initExtra = "${pkgs.xss-lock}/bin/xss-lock ${
concatStringsSep " " cfg.xssLockExtraOptions
} -- ${cfg.lockCmd} &";
};
}

View file

@ -7,18 +7,16 @@ let
cfg = config.services.spotifyd;
configFile = pkgs.writeText "spotifyd.conf" ''
${generators.toINI {} cfg.settings}
${generators.toINI { } cfg.settings}
'';
in
{
in {
options.services.spotifyd = {
enable = mkEnableOption "SpotifyD connect";
settings = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {};
default = { };
description = "Configuration for spotifyd";
example = literalExample ''
{
@ -44,7 +42,8 @@ in
Install.WantedBy = [ "default.target" ];
Service = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path ${configFile}";
ExecStart =
"${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path ${configFile}";
Restart = "always";
RestartSec = 12;
};

View file

@ -6,9 +6,7 @@ let
cfg = config.services.stalonetray;
in
{
in {
options = {
services.stalonetray = {
enable = mkEnableOption "Stalonetray system tray";
@ -22,19 +20,18 @@ in
};
config = mkOption {
type = with types;
attrsOf (nullOr (either str (either bool int)));
description = ''
Stalonetray configuration as a set of attributes.
'';
default = {};
example = {
geometry = "3x1-600+0";
decorations = null;
icon_size = 30;
sticky = true;
background = "#cccccc";
};
type = with types; attrsOf (nullOr (either str (either bool int)));
description = ''
Stalonetray configuration as a set of attributes.
'';
default = { };
example = {
geometry = "3x1-600+0";
decorations = null;
icon_size = 30;
sticky = true;
background = "#cccccc";
};
};
extraConfig = mkOption {
@ -42,11 +39,11 @@ in
description = "Additional configuration lines for stalonetrayrc.";
default = "";
example = ''
geometry 3x1-600+0
decorations none
icon_size 30
sticky true
background "#cccccc"
geometry 3x1-600+0
decorations none
icon_size 30
sticky true
background "#cccccc"
'';
};
};
@ -63,9 +60,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/stalonetray";
@ -74,17 +69,18 @@ in
};
}
(mkIf (cfg.config != {}) {
home.file.".stalonetrayrc".text =
let
valueToString = v:
if isBool v then (if v then "true" else "false")
else if (v==null) then "none"
else ''"${toString v}"'';
in
concatStrings (
mapAttrsToList (k: v: "${k} ${valueToString v}\n") cfg.config
);
(mkIf (cfg.config != { }) {
home.file.".stalonetrayrc".text = let
valueToString = v:
if isBool v then
(if v then "true" else "false")
else if (v == null) then
"none"
else
''"${toString v}"'';
in concatStrings (mapAttrsToList (k: v: ''
${k} ${valueToString v}
'') cfg.config);
})
(mkIf (cfg.extraConfig != "") {

View file

@ -6,9 +6,7 @@ let
cfg = config.services.status-notifier-watcher;
in
{
in {
meta.maintainers = [ maintainers.pltanton ];
options = {
@ -17,30 +15,30 @@ in
package = mkOption {
default = pkgs.haskellPackages.status-notifier-item;
defaultText = literalExample "pkgs.haskellPackages.status-notifier-item";
defaultText =
literalExample "pkgs.haskellPackages.status-notifier-item";
type = types.package;
example = literalExample "pkgs.haskellPackages.status-notifier-item";
description = "The package to use for the status notifier watcher binary.";
description =
"The package to use for the status notifier watcher binary.";
};
};
};
config = mkIf cfg.enable {
systemd.user.services.status-notifier-watcher = {
Unit = {
Description = "SNI watcher";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
Before = [ "taffybar.service" ];
};
Unit = {
Description = "SNI watcher";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
Before = [ "taffybar.service" ];
};
Service = {
ExecStart = "${cfg.package}/bin/status-notifier-watcher";
};
Service = { ExecStart = "${cfg.package}/bin/status-notifier-watcher"; };
Install = {
WantedBy = [ "graphical-session.target" "taffybar.service" ];
};
Install = {
WantedBy = [ "graphical-session.target" "taffybar.service" ];
};
};
};
}

View file

@ -22,21 +22,21 @@ with lib;
systemd.user.services = {
syncthing = {
Unit = {
Description = "Syncthing - Open Source Continuous File Synchronization";
Description =
"Syncthing - Open Source Continuous File Synchronization";
Documentation = "man:syncthing(1)";
After = [ "network.target" ];
};
Service = {
ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
ExecStart =
"${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
};
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
};
};
})
@ -46,10 +46,12 @@ with lib;
qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
After = [ "graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service" ];
After = [
"graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ];
};
@ -58,9 +60,7 @@ with lib;
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
})

View file

@ -6,9 +6,7 @@ let
cfg = config.services.taffybar;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -38,9 +36,7 @@ in
Restart = "on-failure";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
xsession.importedVariables = [ "GDK_PIXBUF_MODULE_FILE" ];

View file

@ -6,20 +6,14 @@ with lib;
meta.maintainers = [ maintainers.rycee ];
options = {
services.tahoe-lafs = {
enable = mkEnableOption "Tahoe-LAFS";
};
services.tahoe-lafs = { enable = mkEnableOption "Tahoe-LAFS"; };
};
config = mkIf config.services.tahoe-lafs.enable {
systemd.user.services.tahoe-lafs = {
Unit = {
Description = "Tahoe-LAFS";
};
Unit = { Description = "Tahoe-LAFS"; };
Service = {
ExecStart = "${pkgs.tahoelafs}/bin/tahoe run -C %h/.tahoe";
};
Service = { ExecStart = "${pkgs.tahoelafs}/bin/tahoe run -C %h/.tahoe"; };
};
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.services.taskwarrior-sync;
in
{
in {
meta.maintainers = with maintainers; [ minijackson pacien ];
options.services.taskwarrior-sync = {
@ -32,9 +30,7 @@ in
config = mkIf cfg.enable {
systemd.user.services.taskwarrior-sync = {
Unit = {
Description = "Taskwarrior sync";
};
Unit = { Description = "Taskwarrior sync"; };
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
@ -43,16 +39,12 @@ in
};
systemd.user.timers.taskwarrior-sync = {
Unit = {
Description = "Taskwarrior periodic sync";
};
Unit = { Description = "Taskwarrior periodic sync"; };
Timer = {
Unit = "taskwarrior-sync.service";
OnCalendar = cfg.frequency;
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -6,19 +6,17 @@ 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})
]
++ optional config.xsession.preferStatusNotifierItems "--appindicator"
);
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
{
in {
meta.maintainers = [ maintainers.rycee ];
imports = [
@ -77,19 +75,17 @@ in
config = mkIf config.services.udiskie.enable {
systemd.user.services.udiskie = {
Unit = {
Description = "udiskie mount daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "udiskie mount daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.udiskie}/bin/udiskie -2 ${commandArgs}";
};
Service = {
ExecStart = "${pkgs.udiskie}/bin/udiskie -2 ${commandArgs}";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -55,9 +55,7 @@ in {
Restart = "always";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -7,10 +7,8 @@ let
cfg = config.services.unison;
pairOf = t:
let
list = types.addCheck (types.listOf t) (l: length l == 2);
in
list // { description = list.description + " of length 2"; };
let list = types.addCheck (types.listOf t) (l: length l == 2);
in list // { description = list.description + " of length 2"; };
pairOptions = {
options = {
@ -64,17 +62,14 @@ let
serialiseArg = key: val: "-${key}=${escapeShellArg val}";
serialiseArgs = args:
concatStringsSep " " (mapAttrsToList serialiseArg args);
serialiseArgs = args: concatStringsSep " " (mapAttrsToList serialiseArg args);
makeDefs = gen:
mapAttrs'
(name: pairCfg: nameValuePair "unison-pair-${name}" (gen name pairCfg))
cfg.pairs;
(name: pairCfg: nameValuePair "unison-pair-${name}" (gen name pairCfg))
cfg.pairs;
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
options.services.unison = {
@ -120,9 +115,7 @@ in
'';
};
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
});
};
}

View file

@ -9,12 +9,9 @@ let
getLuaPath = lib: dir: "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}";
makeSearchPath = lib.concatMapStrings (path:
" --search ${getLuaPath path "share"}"
+ " --search ${getLuaPath path "lib"}"
);
+ " --search ${getLuaPath path "lib"}");
in
{
in {
options = {
xsession.windowManager.awesome = {
enable = mkEnableOption "Awesome window manager.";
@ -27,31 +24,29 @@ in
};
luaModules = mkOption {
default = [];
type = types.listOf types.package;
description = ''
List of lua packages available for being
used in the Awesome configuration.
'';
example = literalExample "[ luaPackages.oocairo ]";
default = [ ];
type = types.listOf types.package;
description = ''
List of lua packages available for being
used in the Awesome configuration.
'';
example = literalExample "[ luaPackages.oocairo ]";
};
noArgb = mkOption {
default = false;
type = types.bool;
description = ''
Disable client transparency support, which can be greatly
detrimental to performance in some setups
'';
default = false;
type = types.bool;
description = ''
Disable client transparency support, which can be greatly
detrimental to performance in some setups
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ awesome ];
xsession.windowManager.command =
"${awesome}/bin/awesome "
+ optionalString cfg.noArgb "--no-argb "
+ makeSearchPath cfg.luaModules;
xsession.windowManager.command = "${awesome}/bin/awesome "
+ optionalString cfg.noArgb "--no-argb " + makeSearchPath cfg.luaModules;
};
}

View file

@ -13,59 +13,62 @@ let
formatConfig = n: v:
let
formatList = x:
if isList x
then throw "can not convert 2-dimensional lists to bspwm format"
else formatValue x;
if isList x then
throw "can not convert 2-dimensional lists to bspwm format"
else
formatValue x;
formatValue = v:
if isBool v then (if v then "true" else "false")
else if isList v then concatMapStringsSep ", " formatList v
else if isString v then "${lib.strings.escapeShellArg v}"
else toString v;
in
"bspc config ${n} ${formatValue v}";
if isBool v then
(if v then "true" else "false")
else if isList v then
concatMapStringsSep ", " formatList v
else if isString v then
"${lib.strings.escapeShellArg v}"
else
toString v;
in "bspc config ${n} ${formatValue v}";
formatMonitors = n: v: "bspc monitor ${n} -d ${concatStringsSep " " v}";
formatRules = target: directiveOptions:
let
formatDirective = n: v:
if isBool v then (if v then "${camelToSnake n}=on" else "${camelToSnake n}=off")
else if (n == "desktop" || n == "node") then "${camelToSnake n}='${v}'"
else "${camelToSnake n}=${lib.strings.escapeShellArg v}";
if isBool v then
(if v then "${camelToSnake n}=on" else "${camelToSnake n}=off")
else if (n == "desktop" || n == "node") then
"${camelToSnake n}='${v}'"
else
"${camelToSnake n}=${lib.strings.escapeShellArg v}";
directives = filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n)) directiveOptions;
directivesStr = builtins.concatStringsSep " " (mapAttrsToList formatDirective directives);
in
"bspc rule -a ${target} ${directivesStr}";
directives =
filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n))
directiveOptions;
directivesStr = builtins.concatStringsSep " "
(mapAttrsToList formatDirective directives);
in "bspc rule -a ${target} ${directivesStr}";
formatStartupPrograms = map (s: "${s} &");
in
{
options = import ./options.nix { inherit pkgs; inherit lib; };
in {
options = import ./options.nix {
inherit pkgs;
inherit lib;
};
config = mkIf cfg.enable {
home.packages = [ bspwm ];
xsession.windowManager.command =
let
configFile = pkgs.writeShellScript "bspwmrc" (
concatStringsSep "\n" (
(mapAttrsToList formatMonitors cfg.monitors)
++ (mapAttrsToList formatConfig cfg.settings)
++ (mapAttrsToList formatRules cfg.rules)
++ [ ''
# java gui fixes
export _JAVA_AWT_WM_NONREPARENTING=1
bspc rule -a sun-awt-X11-XDialogPeer state=floating
'' ]
++ [ cfg.extraConfig ]
++ (formatStartupPrograms cfg.startupPrograms)
)
);
configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}";
in
"${cfg.package}/bin/bspwm ${configCmdOpt}";
xsession.windowManager.command = let
configFile = pkgs.writeShellScript "bspwmrc" (concatStringsSep "\n"
((mapAttrsToList formatMonitors cfg.monitors)
++ (mapAttrsToList formatConfig cfg.settings)
++ (mapAttrsToList formatRules cfg.rules) ++ [''
# java gui fixes
export _JAVA_AWT_WM_NONREPARENTING=1
bspc rule -a sun-awt-X11-XDialogPeer state=floating
''] ++ [ cfg.extraConfig ]
++ (formatStartupPrograms cfg.startupPrograms)));
configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}";
in "${cfg.package}/bin/bspwm ${configCmdOpt}";
};
}

View file

@ -28,7 +28,8 @@ let
};
state = mkOption {
type = types.nullOr (types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]);
type = types.nullOr
(types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]);
default = null;
description = "The state in which a new window should spawn.";
example = "floating";
@ -61,7 +62,7 @@ let
hidden = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''Whether the node should occupy any space.'';
description = "Whether the node should occupy any space.";
example = true;
};
@ -141,9 +142,7 @@ let
};
};
in
{
in {
xsession.windowManager.bspwm = {
enable = mkEnableOption "bspwm window manager.";
@ -156,11 +155,10 @@ in
};
settings = mkOption {
type = with types; let
primitive = either bool (either int (either float str));
in
attrsOf (either primitive (listOf primitive));
default = {};
type = with types;
let primitive = either bool (either int (either float str));
in attrsOf (either primitive (listOf primitive));
default = { };
description = "bspwm configuration";
example = {
"border_width" = 2;
@ -180,16 +178,14 @@ in
monitors = mkOption {
type = types.attrsOf (types.listOf types.str);
default = {};
default = { };
description = "bspc monitor configurations";
example = {
"HDMI-0" = [ "web" "terminal" "III" "IV" ];
};
example = { "HDMI-0" = [ "web" "terminal" "III" "IV" ]; };
};
rules = mkOption {
type = types.attrsOf rule;
default = {};
default = { };
description = "bspc rules";
example = literalExample ''
{
@ -210,12 +206,9 @@ in
startupPrograms = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = "Programs to be executed during startup.";
example = [
"numlockx on"
"tilda"
];
example = [ "numlockx on" "tilda" ];
};
};
}

View file

@ -9,15 +9,13 @@ let
xmonad = pkgs.xmonad-with-packages.override {
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
packages = self:
cfg.extraPackages self
++ optionals cfg.enableContribAndExtras [
self.xmonad-contrib self.xmonad-extras
cfg.extraPackages self ++ optionals cfg.enableContribAndExtras [
self.xmonad-contrib
self.xmonad-extras
];
};
in
{
in {
options = {
xsession.windowManager.xmonad = {
enable = mkEnableOption "xmonad window manager";
@ -35,7 +33,7 @@ in
};
extraPackages = mkOption {
default = self: [];
default = self: [ ];
defaultText = "self: []";
example = literalExample ''
haskellPackages: [

View file

@ -6,9 +6,7 @@ let
cfg = config.services.xcape;
in
{
in {
meta.maintainers = [ maintainers.nickhu ];
options = {
@ -27,8 +25,11 @@ in
mapExpression = mkOption {
type = types.attrsOf types.str;
default = {};
example = { Shift_L = "Escape"; Control_L = "Control_L|O"; };
default = { };
example = {
Shift_L = "Escape";
Control_L = "Control_L|O";
};
description = ''
The value has the grammar <literal>Key[|OtherKey]</literal>.
</para>
@ -63,14 +64,13 @@ in
Type = "forking";
ExecStart = "${pkgs.xcape}/bin/xcape"
+ optionalString (cfg.timeout != null) " -t ${toString cfg.timeout}"
+ optionalString (cfg.mapExpression != {})
" -e '${builtins.concatStringsSep ";"
(attrsets.mapAttrsToList (n: v: "${n}=${v}") cfg.mapExpression)}'";
+ optionalString (cfg.mapExpression != { }) " -e '${
builtins.concatStringsSep ";"
(attrsets.mapAttrsToList (n: v: "${n}=${v}") cfg.mapExpression)
}'";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.services.xembed-sni-proxy;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -35,9 +33,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -6,9 +6,7 @@ let
cfg = config.services.xscreensaver;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -17,7 +15,7 @@ in
settings = mkOption {
type = with types; attrsOf (either bool (either int str));
default = {};
default = { };
example = {
mode = "blank";
lock = false;
@ -38,19 +36,17 @@ in
mapAttrs' (n: nameValuePair "xscreensaver.${n}") cfg.settings;
systemd.user.services.xscreensaver = {
Unit = {
Description = "XScreenSaver";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Unit = {
Description = "XScreenSaver";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.xscreensaver}/bin/xscreensaver -no-splash";
};
Service = {
ExecStart = "${pkgs.xscreensaver}/bin/xscreensaver -no-splash";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -61,7 +61,7 @@ let
'';
type = types.nullOr types.str;
default = null;
example = ''echo resuming ...'';
example = "echo resuming ...";
};
sendSignals = mkOption {
@ -74,7 +74,8 @@ let
};
suspendSubtreePattern = mkOption {
description = "Also suspend descendant processes that match this regex.";
description =
"Also suspend descendant processes that match this regex.";
type = types.nullOr types.str;
default = null;
};
@ -105,9 +106,7 @@ let
};
};
in
{
in {
meta.maintainers = [ maintainers.offline ];
options = {
@ -117,13 +116,13 @@ in
defaults = mkOption {
description = "XSuspender defaults.";
type = xsuspenderOptions;
default = {};
default = { };
};
rules = mkOption {
description = "Attribute set of XSuspender rules.";
type = types.attrsOf xsuspenderOptions;
default = {};
default = { };
example = {
Chromium = {
suspendDelay = 10;
@ -147,9 +146,9 @@ in
};
config = mkIf cfg.enable {
services.xsuspender.iniContent =
let
mkSection = values: filterAttrs (_: v: v != null) {
services.xsuspender.iniContent = let
mkSection = values:
filterAttrs (_: v: v != null) {
match_wm_class_contains = values.matchWmClassContains;
match_wm_class_group_contains = values.matchWmClassGroupContains;
match_wm_name_contains = values.matchWmNameContains;
@ -164,25 +163,22 @@ in
auto_suspend_on_battery = values.autoSuspendOnBattery;
downclock_on_battery = values.downclockOnBattery;
};
in
{
Default = mkSection cfg.defaults;
}
// mapAttrs (_: mkSection) cfg.rules;
in {
Default = mkSection cfg.defaults;
} // mapAttrs (_: mkSection) cfg.rules;
# To make the xsuspender tool available.
home.packages = [ pkgs.xsuspender ];
xdg.configFile."xsuspender.conf".text = generators.toINI {} cfg.iniContent;
xdg.configFile."xsuspender.conf".text = generators.toINI { } cfg.iniContent;
systemd.user.services.xsuspender = {
Unit = {
Description = "XSuspender";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = [
"${config.xdg.configFile."xsuspender.conf".source}"
];
X-Restart-Triggers =
[ "${config.xdg.configFile."xsuspender.conf".source}" ];
};
Service = {
@ -190,9 +186,7 @@ in
Environment = mkIf cfg.debug [ "G_MESSAGE_DEBUG=all" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}