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

treewide: remove with lib (#6871)

Remove from services.
This commit is contained in:
Austin Horstman 2025-04-21 09:00:59 -07:00 committed by GitHub
parent 6695b1d477
commit 82ee14ff60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 1848 additions and 1891 deletions

View file

@ -4,20 +4,15 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.autorandr; cfg = config.services.autorandr;
in in
{ {
meta.maintainers = [ lib.maintainers.GaetanLepage ];
meta.maintainers = [ maintainers.GaetanLepage ];
options = { options = {
services.autorandr = { services.autorandr = {
enable = mkEnableOption "" // { enable = lib.mkEnableOption "" // {
description = '' description = ''
Whether to enable the Autorandr systemd service. Whether to enable the Autorandr systemd service.
This module is complementary to {option}`programs.autorandr` This module is complementary to {option}`programs.autorandr`
@ -25,15 +20,15 @@ in
''; '';
}; };
ignoreLid = mkOption { ignoreLid = lib.mkOption {
default = false; default = false;
type = types.bool; type = lib.types.bool;
description = "Treat outputs as connected even if their lids are closed."; description = "Treat outputs as connected even if their lids are closed.";
}; };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.autorandr" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.autorandr" pkgs lib.platforms.linux)
]; ];
@ -47,7 +42,7 @@ in
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.autorandr}/bin/autorandr --change ${optionalString cfg.ignoreLid "--ignore-lid"}"; ExecStart = "${pkgs.autorandr}/bin/autorandr --change ${lib.optionalString cfg.ignoreLid "--ignore-lid"}";
}; };
Install.WantedBy = [ "graphical-session.target" ]; Install.WantedBy = [ "graphical-session.target" ];

View file

@ -4,23 +4,20 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.avizo; cfg = config.services.avizo;
settingsFormat = pkgs.formats.ini { }; settingsFormat = pkgs.formats.ini { };
in in
{ {
meta.maintainers = [ hm.maintainers.pltanton ]; meta.maintainers = [ lib.hm.maintainers.pltanton ];
options.services.avizo = { options.services.avizo = {
enable = mkEnableOption "avizo, a simple notification daemon"; enable = lib.mkEnableOption "avizo, a simple notification daemon";
settings = mkOption { settings = lib.mkOption {
type = (pkgs.formats.ini { }).type; type = (pkgs.formats.ini { }).type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
default = { default = {
time = 1.0; time = 1.0;
@ -36,11 +33,11 @@ in
''; '';
}; };
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.avizo; default = pkgs.avizo;
defaultText = literalExpression "pkgs.avizo"; defaultText = lib.literalExpression "pkgs.avizo";
example = literalExpression '' example = lib.literalExpression ''
pkgs.avizo.overrideAttrs (final: prev: { pkgs.avizo.overrideAttrs (final: prev: {
patchPhase = "cp ''${./images}/*.png data/images/"; patchPhase = "cp ''${./images}/*.png data/images/";
}) })
@ -49,10 +46,12 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.avizo" pkgs platforms.linux) ]; assertions = [
(lib.hm.assertions.assertPlatform "services.avizo" pkgs lib.platforms.linux)
];
xdg.configFile."avizo/config.ini" = mkIf (cfg.settings != { }) { xdg.configFile."avizo/config.ini" = lib.mkIf (cfg.settings != { }) {
source = settingsFormat.generate "avizo-config.ini" cfg.settings; source = settingsFormat.generate "avizo-config.ini" cfg.settings;
}; };

View file

@ -4,17 +4,22 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
mkEnableOption
mkOption
optional
types
;
cfg = config.services.barrier; cfg = config.services.barrier;
in in
{ {
meta.maintainers = with maintainers; [ kritnich ]; meta.maintainers = with lib.maintainers; [ kritnich ];
imports = [ imports = [
(mkRemovedOptionModule [ "services" "barrier" "client" "tray" ] '' (lib.mkRemovedOptionModule [ "services" "barrier" "client" "tray" ] ''
The tray option is non-functional and has been removed. The tray option is non-functional and has been removed.
'') '')
]; ];
@ -51,7 +56,7 @@ in
extraFlags = mkOption { extraFlags = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ "-f" ]; default = [ "-f" ];
defaultText = literalExpression ''[ "-f" ]''; defaultText = lib.literalExpression ''[ "-f" ]'';
description = '' description = ''
Additional flags to pass to {command}`barrierc`. Additional flags to pass to {command}`barrierc`.
See {command}`barrierc --help`. See {command}`barrierc --help`.
@ -61,7 +66,7 @@ in
}; };
}; };
config = mkIf cfg.client.enable { config = lib.mkIf cfg.client.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.barrier" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.barrier" pkgs lib.platforms.linux)
]; ];
@ -85,5 +90,4 @@ in
); );
}; };
}; };
} }

View file

@ -4,45 +4,40 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.betterlockscreen; cfg = config.services.betterlockscreen;
in in
{ {
meta.maintainers = with maintainers; [ sebtm ]; meta.maintainers = with lib.maintainers; [ sebtm ];
options = { options = {
services.betterlockscreen = { services.betterlockscreen = {
enable = mkEnableOption "betterlockscreen, a screen-locker module"; enable = lib.mkEnableOption "betterlockscreen, a screen-locker module";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.betterlockscreen; default = pkgs.betterlockscreen;
defaultText = literalExpression "pkgs.betterlockscreen"; defaultText = lib.literalExpression "pkgs.betterlockscreen";
description = "Package providing {command}`betterlockscreen`."; description = "Package providing {command}`betterlockscreen`.";
}; };
arguments = mkOption { arguments = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
description = "List of arguments appended to `./betterlockscreen --lock [args]`"; description = "List of arguments appended to `./betterlockscreen --lock [args]`";
}; };
inactiveInterval = mkOption { inactiveInterval = lib.mkOption {
type = types.int; type = lib.types.int;
default = 10; default = 10;
description = '' description = ''
Value used for {option}`services.screen-locker.inactiveInterval`. Value used for {option}`services.screen-locker.inactiveInterval`.
''; '';
}; };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.betterlockscreen" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.betterlockscreen" pkgs lib.platforms.linux)
]; ];
@ -52,7 +47,7 @@ in
services.screen-locker = { services.screen-locker = {
enable = true; enable = true;
inactiveInterval = cfg.inactiveInterval; inactiveInterval = cfg.inactiveInterval;
lockCmd = "${cfg.package}/bin/betterlockscreen --lock ${concatStringsSep " " cfg.arguments}"; lockCmd = "${cfg.package}/bin/betterlockscreen --lock ${lib.concatStringsSep " " cfg.arguments}";
}; };
}; };
} }

View file

@ -4,13 +4,10 @@
pkgs, pkgs,
... ...
}: }:
with lib;
{ {
options = { options = {
services.blueman-applet = { services.blueman-applet = {
enable = mkEnableOption "" // { enable = lib.mkEnableOption "" // {
description = '' description = ''
Whether to enable the Blueman applet. Whether to enable the Blueman applet.
@ -25,9 +22,9 @@ with lib;
}; };
}; };
config = mkIf config.services.blueman-applet.enable { config = lib.mkIf config.services.blueman-applet.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.blueman-applet" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.blueman-applet" pkgs lib.platforms.linux)
]; ];
systemd.user.services.blueman-applet = { systemd.user.services.blueman-applet = {

View file

@ -4,22 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
serviceConfig = config.services.borgmatic; serviceConfig = config.services.borgmatic;
programConfig = config.programs.borgmatic; programConfig = config.programs.borgmatic;
in in
{ {
meta.maintainers = [ maintainers.DamienCassou ]; meta.maintainers = [ lib.maintainers.DamienCassou ];
options = { options = {
services.borgmatic = { services.borgmatic = {
enable = mkEnableOption "Borgmatic service"; enable = lib.mkEnableOption "Borgmatic service";
frequency = mkOption { frequency = lib.mkOption {
type = types.str; type = lib.types.str;
default = "hourly"; default = "hourly";
description = '' description = ''
How often to run borgmatic when How often to run borgmatic when
@ -33,7 +30,7 @@ in
}; };
}; };
config = mkIf serviceConfig.enable { config = lib.mkIf serviceConfig.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.borgmatic" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.borgmatic" pkgs lib.platforms.linux)
]; ];

View file

@ -4,26 +4,24 @@
lib, lib,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption optional types;
cfg = config.services.cachix-agent; cfg = config.services.cachix-agent;
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options.services.cachix-agent = { options.services.cachix-agent = {
enable = mkEnableOption "Cachix Deploy Agent: <https://docs.cachix.org/deploy/>"; enable = lib.mkEnableOption "Cachix Deploy Agent: <https://docs.cachix.org/deploy/>";
name = mkOption { name = mkOption {
type = types.str; type = types.str;
description = "The unique agent name."; description = "The unique agent name.";
}; };
verbose = mkEnableOption "verbose output"; verbose = lib.mkEnableOption "verbose output";
profile = mkOption { profile = mkOption {
type = types.str; type = types.str;
@ -39,12 +37,12 @@ in
description = "Cachix URI to use."; description = "Cachix URI to use.";
}; };
package = mkPackageOption pkgs "cachix" { }; package = lib.mkPackageOption pkgs "cachix" { };
credentialsFile = mkOption { credentialsFile = mkOption {
type = types.path; type = types.path;
default = "${config.xdg.configHome}/cachix-agent.token"; default = "${config.xdg.configHome}/cachix-agent.token";
defaultText = literalExpression ''"''${config.xdg.configHome}/cachix-agent.token"''; defaultText = lib.literalExpression ''"''${config.xdg.configHome}/cachix-agent.token"'';
description = '' description = ''
Required file that needs to contain Required file that needs to contain
`CACHIX_AGENT_TOKEN=...`. `CACHIX_AGENT_TOKEN=...`.
@ -52,7 +50,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.cachix-agent" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.cachix-agent" pkgs lib.platforms.linux)
]; ];
@ -71,7 +69,7 @@ in
# We don't want to kill children processes as those are deployments. # We don't want to kill children processes as those are deployments.
KillMode = "process"; KillMode = "process";
Restart = "on-failure"; Restart = "on-failure";
ExecStart = escapeShellArgs ( ExecStart = lib.escapeShellArgs (
[ "${cfg.package}/bin/cachix" ] [ "${cfg.package}/bin/cachix" ]
++ optional cfg.verbose "--verbose" ++ optional cfg.verbose "--verbose"
++ optional (cfg.host != null) "--host ${cfg.host}" ++ optional (cfg.host != null) "--host ${cfg.host}"

View file

@ -4,24 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.caffeine; cfg = config.services.caffeine;
in in
{ {
meta.maintainers = [ maintainers.uvnikita ]; meta.maintainers = [ lib.maintainers.uvnikita ];
options = { options = {
services.caffeine = { services.caffeine = {
enable = mkEnableOption "Caffeine service"; enable = lib.mkEnableOption "Caffeine service";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.caffeine" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.caffeine" pkgs lib.platforms.linux)
]; ];

View file

@ -4,10 +4,8 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption optional types;
cfg = config.services.cbatticon; cfg = config.services.cbatticon;
@ -22,7 +20,7 @@ let
"--${commandName} ${cmd}" "--${commandName} ${cmd}"
); );
commandLine = concatStringsSep " " ( commandLine = lib.concatStringsSep " " (
[ "${package}/bin/cbatticon" ] [ "${package}/bin/cbatticon" ]
++ makeCommand "command-critical-level" cfg.commandCriticalLevel ++ makeCommand "command-critical-level" cfg.commandCriticalLevel
++ makeCommand "command-left-click" cfg.commandLeftClick ++ makeCommand "command-left-click" cfg.commandLeftClick
@ -40,11 +38,11 @@ let
in in
{ {
meta.maintainers = [ maintainers.pmiddend ]; meta.maintainers = [ lib.maintainers.pmiddend ];
options = { options = {
services.cbatticon = { services.cbatticon = {
enable = mkEnableOption "cbatticon"; enable = lib.mkEnableOption "cbatticon";
commandCriticalLevel = mkOption { commandCriticalLevel = mkOption {
type = types.nullOr types.lines; type = types.nullOr types.lines;
@ -124,7 +122,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.cbatticon" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.cbatticon" pkgs lib.platforms.linux)
]; ];

View file

@ -4,22 +4,21 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.clipman; cfg = config.services.clipman;
in in
{ {
meta.maintainers = [ maintainers.jwygoda ]; meta.maintainers = [ lib.maintainers.jwygoda ];
options.services.clipman = { options.services.clipman = {
enable = mkEnableOption "clipman, a simple clipboard manager for Wayland"; enable = lib.mkEnableOption "clipman, a simple clipboard manager for Wayland";
package = mkPackageOption pkgs "clipman" { }; package = lib.mkPackageOption pkgs "clipman" { };
systemdTarget = mkOption { systemdTarget = lib.mkOption {
type = types.str; type = lib.types.str;
default = config.wayland.systemd.target; default = config.wayland.systemd.target;
defaultText = literalExpression "config.wayland.systemd.target"; defaultText = lib.literalExpression "config.wayland.systemd.target";
example = "sway-session.target"; example = "sway-session.target";
description = '' description = ''
The systemd target that will automatically start the clipman service. The systemd target that will automatically start the clipman service.
@ -31,7 +30,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.clipman" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.clipman" pkgs lib.platforms.linux)
]; ];

View file

@ -4,19 +4,16 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.clipmenu; cfg = config.services.clipmenu;
in in
{ {
meta.maintainers = [ maintainers.DamienCassou ]; meta.maintainers = [ lib.maintainers.DamienCassou ];
options.services.clipmenu = { options.services.clipmenu = {
enable = mkEnableOption "clipmenu, the clipboard management daemon"; enable = lib.mkEnableOption "clipmenu, the clipboard management daemon";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -36,14 +33,14 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.clipmenu" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.clipmenu" pkgs lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
home.sessionVariables = mkIf (cfg.launcher != null) { CM_LAUNCHER = cfg.launcher; }; home.sessionVariables = lib.mkIf (cfg.launcher != null) { CM_LAUNCHER = cfg.launcher; };
systemd.user.services.clipmenu = { systemd.user.services.clipmenu = {
Unit = { Unit = {
@ -55,7 +52,7 @@ in
ExecStart = "${cfg.package}/bin/clipmenud"; ExecStart = "${cfg.package}/bin/clipmenud";
Environment = [ Environment = [
"PATH=${ "PATH=${
makeBinPath ( lib.makeBinPath (
with pkgs; with pkgs;
[ [
coreutils coreutils

View file

@ -10,18 +10,17 @@ let
cfg = config.services.conky; cfg = config.services.conky;
in in
with lib;
{ {
meta.maintainers = [ hm.maintainers.kaleo ]; meta.maintainers = [ lib.hm.maintainers.kaleo ];
options = { options = {
services.conky = { services.conky = {
enable = mkEnableOption "Conky, a light-weight system monitor"; enable = lib.mkEnableOption "Conky, a light-weight system monitor";
package = mkPackageOption pkgs "conky" { }; package = lib.mkPackageOption pkgs "conky" { };
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = '' description = ''
Configuration used by the Conky daemon. Check Configuration used by the Conky daemon. Check
@ -33,8 +32,8 @@ with lib;
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.conky" pkgs platforms.linux) ]; assertions = [ (lib.hm.assertions.assertPlatform "services.conky" pkgs lib.platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
@ -49,7 +48,7 @@ with lib;
RestartSec = "3"; RestartSec = "3";
ExecStart = toString ( ExecStart = toString (
[ "${cfg.package}/bin/conky" ] [ "${cfg.package}/bin/conky" ]
++ optional (cfg.extraConfig != "") "--config ${pkgs.writeText "conky.conf" cfg.extraConfig}" ++ lib.optional (cfg.extraConfig != "") "--config ${pkgs.writeText "conky.conf" cfg.extraConfig}"
); );
}; };

View file

@ -4,17 +4,16 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkIf types;
cfg = config.services.darkman; cfg = config.services.darkman;
yamlFormat = pkgs.formats.yaml { }; yamlFormat = pkgs.formats.yaml { };
scriptsOptionType = scriptsOptionType =
kind: kind:
mkOption { lib.mkOption {
type = types.attrsOf ( type = types.attrsOf (
types.oneOf [ types.oneOf [
types.path types.path
@ -22,7 +21,7 @@ let
] ]
); );
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
gtk-theme = ''' gtk-theme = '''
''${pkgs.dconf}/bin/dconf write \ ''${pkgs.dconf}/bin/dconf write \
@ -43,33 +42,33 @@ let
generateScripts = generateScripts =
folder: folder:
mapAttrs' ( lib.mapAttrs' (
k: v: { k: v: {
name = "${folder}/${k}"; name = "${folder}/${k}";
value = { value = {
source = source =
if builtins.isPath v || isDerivation v then if builtins.isPath v || lib.isDerivation v then
v v
else else
pkgs.writeShellScript (hm.strings.storeFileName k) v; pkgs.writeShellScript (lib.hm.strings.storeFileName k) v;
}; };
} }
); );
in in
{ {
meta.maintainers = [ maintainers.xlambein ]; meta.maintainers = [ lib.maintainers.xlambein ];
options.services.darkman = { options.services.darkman = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
darkman, a tool that automatically switches dark-mode on and off based on darkman, a tool that automatically switches dark-mode on and off based on
the time of the day''; the time of the day'';
package = mkPackageOption pkgs "darkman" { nullable = true; }; package = lib.mkPackageOption pkgs "darkman" { nullable = true; };
settings = mkOption { settings = lib.mkOption {
type = types.submodule { freeformType = yamlFormat.type; }; type = types.submodule { freeformType = yamlFormat.type; };
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
lat = 52.3; lat = 52.3;
lng = 4.8; lng = 4.8;
@ -89,7 +88,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.darkman" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.darkman" pkgs lib.platforms.linux)
]; ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
@ -100,7 +99,7 @@ in
}; };
}; };
xdg.dataFile = mkMerge [ xdg.dataFile = lib.mkMerge [
(mkIf (cfg.darkModeScripts != { }) (generateScripts "dark-mode.d" cfg.darkModeScripts)) (mkIf (cfg.darkModeScripts != { }) (generateScripts "dark-mode.d" cfg.darkModeScripts))
(mkIf (cfg.lightModeScripts != { }) (generateScripts "light-mode.d" cfg.lightModeScripts)) (mkIf (cfg.lightModeScripts != { }) (generateScripts "light-mode.d" cfg.lightModeScripts))
]; ];
@ -119,13 +118,13 @@ in
Service = { Service = {
Type = "dbus"; Type = "dbus";
BusName = "nl.whynothugo.darkman"; BusName = "nl.whynothugo.darkman";
ExecStart = "${getExe cfg.package} run"; ExecStart = "${lib.getExe cfg.package} run";
Restart = "on-failure"; Restart = "on-failure";
TimeoutStopSec = 15; TimeoutStopSec = 15;
Slice = "background.slice"; Slice = "background.slice";
}; };
Install.WantedBy = mkDefault [ "graphical-session.target" ]; Install.WantedBy = lib.mkDefault [ "graphical-session.target" ];
}; };
}; };
} }

View file

@ -4,22 +4,20 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.devilspie2; cfg = config.services.devilspie2;
in in
{ {
meta.maintainers = [ maintainers.dawidsowa ]; meta.maintainers = [ lib.maintainers.dawidsowa ];
options = { options = {
services.devilspie2 = { services.devilspie2 = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
Devilspie2, a window matching utility, allowing the user to Devilspie2, a window matching utility, allowing the user to
perform scripted actions on windows as they are created''; perform scripted actions on windows as they are created'';
config = mkOption { config = lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = '' description = ''
Content of file placed in the devilspie2 config directory. Content of file placed in the devilspie2 config directory.
@ -33,7 +31,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.devilspie2" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.devilspie2" pkgs lib.platforms.linux)
]; ];

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.dropbox; cfg = config.services.dropbox;
@ -16,23 +13,23 @@ let
in in
{ {
meta.maintainers = [ maintainers.eyjhb ]; meta.maintainers = [ lib.maintainers.eyjhb ];
options = { options = {
services.dropbox = { services.dropbox = {
enable = mkEnableOption "Dropbox daemon"; enable = lib.mkEnableOption "Dropbox daemon";
path = mkOption { path = lib.mkOption {
type = types.path; type = lib.types.path;
default = "${config.home.homeDirectory}/Dropbox"; default = "${config.home.homeDirectory}/Dropbox";
defaultText = literalExpression ''"''${config.home.homeDirectory}/Dropbox"''; defaultText = lib.literalExpression ''"''${config.home.homeDirectory}/Dropbox"'';
apply = toString; # Prevent copies to Nix store. apply = toString; # Prevent copies to Nix store.
description = "Where to put the Dropbox directory."; description = "Where to put the Dropbox directory.";
}; };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.dropbox" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.dropbox" pkgs lib.platforms.linux)
]; ];
@ -76,9 +73,9 @@ in
${homeBaseDir}/.dropbox ${config.home.homeDirectory}/.dropbox ${homeBaseDir}/.dropbox ${config.home.homeDirectory}/.dropbox
fi fi
if [[ ! -d ${escapeShellArg cfg.path} ]]; then if [[ ! -d ${lib.escapeShellArg cfg.path} ]]; then
run ${pkgs.coreutils}/bin/ln $VERBOSE_ARG -s \ run ${pkgs.coreutils}/bin/ln $VERBOSE_ARG -s \
${homeBaseDir}/Dropbox ${escapeShellArg cfg.path} ${homeBaseDir}/Dropbox ${lib.escapeShellArg cfg.path}
fi fi
# get the dropbox bins if needed # get the dropbox bins if needed

View file

@ -4,23 +4,26 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
literalExpression
mkOption
optional
types
;
cfg = config.services.dunst; 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 { toDunstIni = lib.generators.toINI {
mkKeyValue = mkKeyValue =
key: value: key: value:
let let
value' = value' =
if isBool value then if lib.isBool value then
(lib.hm.booleans.yesNo value) (lib.hm.booleans.yesNo value)
else if isString value then else if lib.isString value then
''"${value}"'' ''"${value}"''
else else
toString value; toString value;
@ -59,11 +62,11 @@ let
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.dunst = { services.dunst = {
enable = mkEnableOption "the dunst notification daemon"; enable = lib.mkEnableOption "the dunst notification daemon";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -133,96 +136,100 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = lib.mkIf cfg.enable (
{ lib.mkMerge [
assertions = [ {
(hm.assertions.assertPlatform "services.dunst" pkgs platforms.linux) assertions = [
]; (lib.hm.assertions.assertPlatform "services.dunst" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service"; "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
services.dunst.settings.global.icon_path = services.dunst.settings.global.icon_path =
let let
useCustomTheme = useCustomTheme =
cfg.iconTheme.package != hicolorTheme.package cfg.iconTheme.package != hicolorTheme.package
|| cfg.iconTheme.name != hicolorTheme.name || cfg.iconTheme.name != hicolorTheme.name
|| cfg.iconTheme.size != hicolorTheme.size; || cfg.iconTheme.size != hicolorTheme.size;
basePaths = [ basePaths = [
"/run/current-system/sw" "/run/current-system/sw"
config.home.profileDirectory config.home.profileDirectory
cfg.iconTheme.package cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package; ] ++ optional useCustomTheme hicolorTheme.package;
themes = [ themes = [
cfg.iconTheme cfg.iconTheme
] ++ optional useCustomTheme (hicolorTheme // { size = cfg.iconTheme.size; }); ] ++ optional useCustomTheme (hicolorTheme // { size = cfg.iconTheme.size; });
categories = [ categories = [
"actions" "actions"
"animations" "animations"
"apps" "apps"
"categories" "categories"
"devices" "devices"
"emblems" "emblems"
"emotes" "emotes"
"filesystem" "filesystem"
"intl" "intl"
"legacy" "legacy"
"mimetypes" "mimetypes"
"places" "places"
"status" "status"
"stock" "stock"
]; ];
mkPath = mkPath =
{ {
basePath, basePath,
theme, theme,
category, category,
}: }:
"${basePath}/share/icons/${theme.name}/${theme.size}/${category}"; "${basePath}/share/icons/${theme.name}/${theme.size}/${category}";
in in
concatMapStringsSep ":" mkPath (cartesianProduct { lib.concatMapStringsSep ":" mkPath (
basePath = basePaths; lib.cartesianProduct {
theme = themes; basePath = basePaths;
category = categories; theme = themes;
}); category = categories;
}
systemd.user.services.dunst = {
Unit = {
Description = "Dunst notification daemon";
After = [ config.wayland.systemd.target ];
PartOf = [ config.wayland.systemd.target ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = escapeShellArgs (
[ "${cfg.package}/bin/dunst" ]
++
# Using `-config` breaks dunst's drop-ins, so only use it when an alternative path is set
optionals (cfg.configFile != null) [
"-config"
cfg.configFile
]
); );
Environment = optionalString (cfg.waylandDisplay != "") "WAYLAND_DISPLAY=${cfg.waylandDisplay}";
};
};
}
(mkIf (cfg.settings != { }) { systemd.user.services.dunst = {
xdg.configFile."dunst/dunstrc" = { Unit = {
text = toDunstIni cfg.settings; Description = "Dunst notification daemon";
onChange = '' After = [ config.wayland.systemd.target ];
${pkgs.procps}/bin/pkill -u "$USER" ''${VERBOSE+-e} dunst || true PartOf = [ config.wayland.systemd.target ];
''; };
};
}) Service = {
]); Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = lib.escapeShellArgs (
[ "${cfg.package}/bin/dunst" ]
++
# Using `-config` breaks dunst's drop-ins, so only use it when an alternative path is set
lib.optionals (cfg.configFile != null) [
"-config"
cfg.configFile
]
);
Environment = lib.optionalString (cfg.waylandDisplay != "") "WAYLAND_DISPLAY=${cfg.waylandDisplay}";
};
};
}
(lib.mkIf (cfg.settings != { }) {
xdg.configFile."dunst/dunstrc" = {
text = toDunstIni cfg.settings;
onChange = ''
${pkgs.procps}/bin/pkill -u "$USER" ''${VERBOSE+-e} dunst || true
'';
};
})
]
);
} }

View file

@ -4,10 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.dwm-status; cfg = config.services.dwm-status;
jsonFormat = pkgs.formats.json { }; jsonFormat = pkgs.formats.json { };
@ -31,12 +30,12 @@ in
{ {
options = { options = {
services.dwm-status = { services.dwm-status = {
enable = mkEnableOption "dwm-status user service"; enable = lib.mkEnableOption "dwm-status user service";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.dwm-status; default = pkgs.dwm-status;
defaultText = literalExpression "pkgs.dwm-status"; defaultText = lib.literalExpression "pkgs.dwm-status";
example = "pkgs.dwm-status.override { enableAlsaUtils = false; }"; example = "pkgs.dwm-status.override { enableAlsaUtils = false; }";
description = "Which dwm-status package to use."; description = "Which dwm-status package to use.";
}; };
@ -49,7 +48,7 @@ in
extraConfig = mkOption { extraConfig = mkOption {
type = jsonFormat.type; type = jsonFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
separator = "#"; separator = "#";
@ -67,7 +66,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.dwm-status" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.dwm-status" pkgs lib.platforms.linux)
]; ];

View file

@ -4,27 +4,31 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
mkIf
mkOption
optional
optionalAttrs
types
;
cfg = config.services.emacs; cfg = config.services.emacs;
emacsCfg = config.programs.emacs; emacsCfg = config.programs.emacs;
emacsBinPath = "${cfg.package}/bin"; emacsBinPath = "${cfg.package}/bin";
emacsVersion = getVersion cfg.package; emacsVersion = lib.getVersion cfg.package;
clientWMClass = if versionAtLeast emacsVersion "28" then "Emacsd" else "Emacs"; clientWMClass = if lib.versionAtLeast emacsVersion "28" then "Emacsd" else "Emacs";
# Workaround for https://debbugs.gnu.org/47511 # Workaround for https://debbugs.gnu.org/47511
needsSocketWorkaround = versionOlder emacsVersion "28" && cfg.socketActivation.enable; needsSocketWorkaround = lib.versionOlder emacsVersion "28" && cfg.socketActivation.enable;
# Adapted from upstream emacs.desktop # Adapted from upstream emacs.desktop
clientDesktopItem = pkgs.writeTextDir "share/applications/emacsclient.desktop" ( clientDesktopItem = pkgs.writeTextDir "share/applications/emacsclient.desktop" (
generators.toINI { } { lib.generators.toINI { } {
"Desktop Entry" = { "Desktop Entry" = {
Type = "Application"; Type = "Application";
Exec = "${emacsBinPath}/emacsclient ${concatStringsSep " " cfg.client.arguments} %F"; Exec = "${emacsBinPath}/emacsclient ${lib.concatStringsSep " " cfg.client.arguments} %F";
Terminal = false; Terminal = false;
Name = "Emacs Client"; Name = "Emacs Client";
Icon = "emacs"; Icon = "emacs";
@ -44,15 +48,15 @@ let
socketPath = "${socketDir}/server"; socketPath = "${socketDir}/server";
in in
{ {
meta.maintainers = [ maintainers.tadfisher ]; meta.maintainers = [ lib.maintainers.tadfisher ];
options.services.emacs = { options.services.emacs = {
enable = mkEnableOption "the Emacs daemon"; enable = lib.mkEnableOption "the Emacs daemon";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = if emacsCfg.enable then emacsCfg.finalPackage else pkgs.emacs; default = if emacsCfg.enable then emacsCfg.finalPackage else pkgs.emacs;
defaultText = literalExpression '' defaultText = lib.literalExpression ''
if config.programs.emacs.enable then config.programs.emacs.finalPackage if config.programs.emacs.enable then config.programs.emacs.finalPackage
else pkgs.emacs else pkgs.emacs
''; '';
@ -72,7 +76,7 @@ in
}; };
client = { client = {
enable = mkEnableOption "generation of Emacs client desktop file"; enable = lib.mkEnableOption "generation of Emacs client desktop file";
arguments = mkOption { arguments = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ "-c" ]; default = [ "-c" ];
@ -86,13 +90,13 @@ in
# socket path, though allowing for such is not easy to do as systemd socket # socket path, though allowing for such is not easy to do as systemd socket
# units don't perform variable expansion for 'ListenStream'. # units don't perform variable expansion for 'ListenStream'.
socketActivation = { socketActivation = {
enable = mkEnableOption "systemd socket activation for the Emacs service"; enable = lib.mkEnableOption "systemd socket activation for the Emacs service";
}; };
startWithUserSession = mkOption { startWithUserSession = mkOption {
type = with types; either bool (enum [ "graphical" ]); type = with types; either bool (enum [ "graphical" ]);
default = !cfg.socketActivation.enable; default = !cfg.socketActivation.enable;
defaultText = literalExpression "!config.services.emacs.socketActivation.enable"; defaultText = lib.literalExpression "!config.services.emacs.socketActivation.enable";
example = "graphical"; example = "graphical";
description = '' description = ''
Whether to launch Emacs service with the systemd user session. If it is Whether to launch Emacs service with the systemd user session. If it is
@ -114,122 +118,124 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
(mkIf pkgs.stdenv.isLinux { lib.mkMerge [
systemd.user.services.emacs = (mkIf pkgs.stdenv.isLinux {
{ systemd.user.services.emacs =
Unit = {
{ Unit =
Description = "Emacs text editor"; {
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/"; Description = "Emacs text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
After = optional (cfg.startWithUserSession == "graphical") "graphical-session.target"; After = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
PartOf = optional (cfg.startWithUserSession == "graphical") "graphical-session.target"; PartOf = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
# Avoid killing the Emacs session, which may be full of # Avoid killing the Emacs session, which may be full of
# unsaved buffers. # unsaved buffers.
X-RestartIfChanged = false; X-RestartIfChanged = false;
} }
// optionalAttrs needsSocketWorkaround { // optionalAttrs needsSocketWorkaround {
# Emacs deletes its socket when shutting down, which systemd doesn't # Emacs deletes its socket when shutting down, which systemd doesn't
# handle, resulting in a server without a socket. # handle, resulting in a server without a socket.
# See https://github.com/nix-community/home-manager/issues/2018 # See https://github.com/nix-community/home-manager/issues/2018
RefuseManualStart = true; RefuseManualStart = true;
};
Service =
{
Type = "notify";
# We wrap ExecStart in a login shell so Emacs starts with the user's
# environment, most importantly $PATH and $NIX_PROFILES. It may be
# worth investigating a more targeted approach for user services to
# import the user environment.
ExecStart = ''${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${
# In case the user sets 'server-directory' or 'server-name' in
# their Emacs config, we want to specify the socket path explicitly
# so launching 'emacs.service' manually doesn't break emacsclient
# when using socket activation.
lib.optionalString cfg.socketActivation.enable "=${lib.escapeShellArg socketPath}"
} ${lib.escapeShellArgs cfg.extraOptions}"'';
# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.
SuccessExitStatus = 15;
Restart = "on-failure";
}
// optionalAttrs needsSocketWorkaround {
# Use read-only directory permissions to prevent emacs from
# deleting systemd's socket file before exiting.
ExecStartPost = "${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}";
ExecStopPost = "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}";
};
}
// optionalAttrs (cfg.startWithUserSession != false) {
Install = {
WantedBy = [
(if cfg.startWithUserSession == true then "default.target" else "graphical-session.target")
];
}; };
};
Service = home = {
{ packages = optional cfg.client.enable (lib.hiPrio clientDesktopItem);
Type = "notify";
# We wrap ExecStart in a login shell so Emacs starts with the user's sessionVariables = mkIf cfg.defaultEditor {
# environment, most importantly $PATH and $NIX_PROFILES. It may be EDITOR = lib.getBin (
# worth investigating a more targeted approach for user services to pkgs.writeShellScript "editor" ''exec ${lib.getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"''
# import the user environment. );
ExecStart = ''${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${ };
# In case the user sets 'server-directory' or 'server-name' in };
# their Emacs config, we want to specify the socket path explicitly })
# so launching 'emacs.service' manually doesn't break emacsclient
# when using socket activation.
optionalString cfg.socketActivation.enable "=${escapeShellArg socketPath}"
} ${escapeShellArgs cfg.extraOptions}"'';
# Emacs will exit with status 15 after having received SIGTERM, which (mkIf (cfg.socketActivation.enable && pkgs.stdenv.isLinux) {
# is the default "KillSignal" value systemd uses to stop services. systemd.user.sockets.emacs = {
SuccessExitStatus = 15; Unit = {
Description = "Emacs text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
};
Socket = {
ListenStream = socketPath;
FileDescriptorName = "server";
SocketMode = "0600";
DirectoryMode = "0700";
# This prevents the service from immediately starting again
# after being stopped, due to the function
# `server-force-stop' present in `kill-emacs-hook', which
# calls `server-running-p', which opens the socket file.
FlushPending = true;
};
Restart = "on-failure";
}
// optionalAttrs needsSocketWorkaround {
# Use read-only directory permissions to prevent emacs from
# deleting systemd's socket file before exiting.
ExecStartPost = "${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}";
ExecStopPost = "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}";
};
}
// optionalAttrs (cfg.startWithUserSession != false) {
Install = { Install = {
WantedBy = [ WantedBy = [ "sockets.target" ];
(if cfg.startWithUserSession == true then "default.target" else "graphical-session.target") # Adding this Requires= dependency ensures that systemd
]; # manages the socket file, in the case where the service is
# started when the socket is stopped.
# The socket unit is implicitly ordered before the service.
RequiredBy = [ "emacs.service" ];
}; };
}; };
})
home = { (mkIf pkgs.stdenv.isDarwin {
packages = optional cfg.client.enable (hiPrio clientDesktopItem); launchd.agents.emacs = {
enable = true;
sessionVariables = mkIf cfg.defaultEditor { config = {
EDITOR = getBin ( ProgramArguments = [
pkgs.writeShellScript "editor" ''exec ${getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"'' "${cfg.package}/bin/emacs"
); "--fg-daemon"
}; ] ++ cfg.extraOptions;
}; RunAtLoad = true;
}) KeepAlive = {
Crashed = true;
(mkIf (cfg.socketActivation.enable && pkgs.stdenv.isLinux) { SuccessfulExit = false;
systemd.user.sockets.emacs = { };
Unit = {
Description = "Emacs text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
};
Socket = {
ListenStream = socketPath;
FileDescriptorName = "server";
SocketMode = "0600";
DirectoryMode = "0700";
# This prevents the service from immediately starting again
# after being stopped, due to the function
# `server-force-stop' present in `kill-emacs-hook', which
# calls `server-running-p', which opens the socket file.
FlushPending = true;
};
Install = {
WantedBy = [ "sockets.target" ];
# Adding this Requires= dependency ensures that systemd
# manages the socket file, in the case where the service is
# started when the socket is stopped.
# The socket unit is implicitly ordered before the service.
RequiredBy = [ "emacs.service" ];
};
};
})
(mkIf pkgs.stdenv.isDarwin {
launchd.agents.emacs = {
enable = true;
config = {
ProgramArguments = [
"${cfg.package}/bin/emacs"
"--fg-daemon"
] ++ cfg.extraOptions;
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
}; };
}; };
}; })
}) ]
]); );
} }

View file

@ -4,22 +4,20 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.etesync-dav; cfg = config.services.etesync-dav;
toEnvironmentCfg = toEnvironmentCfg =
vars: (concatStringsSep " " (mapAttrsToList (k: v: "${k}=${escapeShellArg v}") vars)); vars: (lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${lib.escapeShellArg v}") vars));
in in
{ {
meta.maintainers = [ maintainers.valodim ]; meta.maintainers = [ lib.maintainers.valodim ];
options.services.etesync-dav = { options.services.etesync-dav = {
enable = mkEnableOption "etesync-dav"; enable = lib.mkEnableOption "etesync-dav";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -42,7 +40,7 @@ in
] ]
); );
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
ETESYNC_LISTEN_ADDRESS = "localhost"; ETESYNC_LISTEN_ADDRESS = "localhost";
ETESYNC_LISTEN_PORT = 37358; ETESYNC_LISTEN_PORT = 37358;
@ -54,7 +52,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.etesync-dav" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.etesync-dav" pkgs lib.platforms.linux)
]; ];

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.flameshot; cfg = config.services.flameshot;
@ -17,19 +14,19 @@ let
in in
{ {
meta.maintainers = [ maintainers.hamhut1066 ]; meta.maintainers = [ lib.maintainers.hamhut1066 ];
options.services.flameshot = { options.services.flameshot = {
enable = mkEnableOption "Flameshot"; enable = lib.mkEnableOption "Flameshot";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.flameshot; default = pkgs.flameshot;
defaultText = literalExpression "pkgs.flameshot"; defaultText = lib.literalExpression "pkgs.flameshot";
description = "Package providing {command}`flameshot`."; description = "Package providing {command}`flameshot`.";
}; };
settings = mkOption { settings = lib.mkOption {
inherit (iniFormat) type; inherit (iniFormat) type;
default = { }; default = { };
example = { example = {
@ -46,14 +43,14 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.flameshot" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.flameshot" pkgs lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile = mkIf (cfg.settings != { }) { xdg.configFile = lib.mkIf (cfg.settings != { }) {
"flameshot/flameshot.ini".source = iniFile; "flameshot/flameshot.ini".source = iniFile;
}; };
@ -66,7 +63,7 @@ in
"tray.target" "tray.target"
]; ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = mkIf (cfg.settings != { }) [ "${iniFile}" ]; X-Restart-Triggers = lib.mkIf (cfg.settings != { }) [ "${iniFile}" ];
}; };
Install = { Install = {

View file

@ -4,20 +4,18 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.fluidsynth; cfg = config.services.fluidsynth;
in in
{ {
meta.maintainers = [ maintainers.valodim ]; meta.maintainers = [ lib.maintainers.valodim ];
options = { options = {
services.fluidsynth = { services.fluidsynth = {
enable = mkEnableOption "fluidsynth midi synthesizer"; enable = lib.mkEnableOption "fluidsynth midi synthesizer";
soundFont = mkOption { soundFont = mkOption {
type = types.path; type = types.path;
@ -52,7 +50,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.fluidsynth" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.fluidsynth" pkgs lib.platforms.linux)
]; ];

View file

@ -4,13 +4,12 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.fnott; cfg = config.services.fnott;
concatStringsSep' = sep: list: concatStringsSep sep (remove "" list); concatStringsSep' = sep: list: lib.concatStringsSep sep (lib.remove "" list);
iniFormat = pkgs.formats.ini { }; iniFormat = pkgs.formats.ini { };
in in
@ -19,14 +18,14 @@ in
options = { options = {
services.fnott = { services.fnott = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
fnott, a lightweight Wayland notification daemon for wlroots-based compositors fnott, a lightweight Wayland notification daemon for wlroots-based compositors
''; '';
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.fnott; default = pkgs.fnott;
defaultText = literalExpression "pkgs.fnott"; defaultText = lib.literalExpression "pkgs.fnott";
description = "Package providing {command}`fnott`."; description = "Package providing {command}`fnott`.";
}; };
@ -67,7 +66,7 @@ in
{manpage}`fnott.ini(5)` for a list of available options and <https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini> {manpage}`fnott.ini(5)` for a list of available options and <https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini>
for an example configuration. for an example configuration.
''; '';
example = literalExpression '' example = lib.literalExpression ''
{ {
main = { main = {
notification-margin = 5; notification-margin = 5;
@ -84,8 +83,10 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.fnott" pkgs platforms.linux) ]; assertions = [
(lib.hm.assertions.assertPlatform "services.fnott" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
@ -103,8 +104,8 @@ in
BusName = "org.freedesktop.Notifications"; BusName = "org.freedesktop.Notifications";
ExecStart = concatStringsSep' " " [ ExecStart = concatStringsSep' " " [
"${cfg.package}/bin/fnott" "${cfg.package}/bin/fnott"
"-c ${escapeShellArg cfg.configFile}" "-c ${lib.escapeShellArg cfg.configFile}"
(escapeShellArgs cfg.extraFlags) (lib.escapeShellArgs cfg.extraFlags)
]; ];
}; };
}; };

View file

@ -4,10 +4,8 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) literalExpression mkOption types;
cfg = config.services.fusuma; cfg = config.services.fusuma;
@ -60,14 +58,15 @@ let
}; };
makeBinPath = makeBinPath =
packages: foldl (a: b: if a == "" then b else "${a}:${b}") "" (map (pkg: "${pkg}/bin") packages); packages:
lib.foldl (a: b: if a == "" then b else "${a}:${b}") "" (map (pkg: "${pkg}/bin") packages);
in in
{ {
meta.maintainers = [ hm.maintainers.iosmanthus ]; meta.maintainers = [ lib.hm.maintainers.iosmanthus ];
options.services.fusuma = { options.services.fusuma = {
enable = mkEnableOption "the fusuma systemd service to automatically enable touchpad gesture"; enable = lib.mkEnableOption "the fusuma systemd service to automatically enable touchpad gesture";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -118,7 +117,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.fusuma" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.fusuma" pkgs lib.platforms.linux)
]; ];

View file

@ -4,26 +4,23 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.getmail; cfg = config.services.getmail;
accounts = filter (a: a.getmail.enable) (attrValues config.accounts.email.accounts); accounts = lib.filter (a: a.getmail.enable) (lib.attrValues config.accounts.email.accounts);
# Note: The getmail service does not expect a path, but just the filename! # Note: The getmail service does not expect a path, but just the filename!
renderConfigFilepath = a: if a.primary then "getmailrc" else "getmail${a.name}"; renderConfigFilepath = a: if a.primary then "getmailrc" else "getmail${a.name}";
configFiles = concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts; configFiles = lib.concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts;
in in
{ {
options = { options = {
services.getmail = { services.getmail = {
enable = mkEnableOption "the getmail systemd service to automatically retrieve mail"; enable = lib.mkEnableOption "the getmail systemd service to automatically retrieve mail";
frequency = mkOption { frequency = lib.mkOption {
type = types.str; type = lib.types.str;
default = "*:0/5"; default = "*:0/5";
example = "hourly"; example = "hourly";
description = '' description = ''
@ -38,7 +35,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.getmail" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.getmail" pkgs lib.platforms.linux)
]; ];

View file

@ -4,10 +4,14 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
literalExpression
maintainers
mkIf
mkOption
types
;
cfg = config.services.git-sync; cfg = config.services.git-sync;
@ -28,9 +32,9 @@ let
++ repo.extraPackages ++ repo.extraPackages
) )
}" }"
"GIT_SYNC_DIRECTORY=${strings.escapeShellArg repo.path}" "GIT_SYNC_DIRECTORY=${lib.strings.escapeShellArg repo.path}"
"GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync" "GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync"
"GIT_SYNC_REPOSITORY=${strings.escapeShellArg repo.uri}" "GIT_SYNC_REPOSITORY=${lib.strings.escapeShellArg repo.uri}"
"GIT_SYNC_INTERVAL=${toString repo.interval}" "GIT_SYNC_INTERVAL=${toString repo.interval}"
]; ];
ExecStart = "${cfg.package}/bin/git-sync-on-inotify"; ExecStart = "${cfg.package}/bin/git-sync-on-inotify";
@ -50,7 +54,7 @@ let
}; };
mkService = if pkgs.stdenv.isLinux then mkUnit else mkAgent; mkService = if pkgs.stdenv.isLinux then mkUnit else mkAgent;
services = mapAttrs' (name: repo: { services = lib.mapAttrs' (name: repo: {
name = "git-sync-${name}"; name = "git-sync-${name}";
value = mkService name repo; value = mkService name repo;
}) cfg.repositories; }) cfg.repositories;
@ -115,7 +119,7 @@ in
options = { options = {
services.git-sync = { services.git-sync = {
enable = mkEnableOption "git-sync services"; enable = lib.mkEnableOption "git-sync services";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -144,9 +148,11 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
(mkIf pkgs.stdenv.isLinux { systemd.user.services = services; }) lib.mkMerge [
(mkIf pkgs.stdenv.isDarwin { launchd.agents = services; }) (mkIf pkgs.stdenv.isLinux { systemd.user.services = services; })
]); (mkIf pkgs.stdenv.isDarwin { launchd.agents = services; })
]
);
} }

View file

@ -4,24 +4,21 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.gnome-keyring; cfg = config.services.gnome-keyring;
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.gnome-keyring = { services.gnome-keyring = {
enable = mkEnableOption "GNOME Keyring"; enable = lib.mkEnableOption "GNOME Keyring";
components = mkOption { components = lib.mkOption {
type = types.listOf ( type = lib.types.listOf (
types.enum [ lib.types.enum [
"pkcs11" "pkcs11"
"secrets" "secrets"
"ssh" "ssh"
@ -36,7 +33,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs lib.platforms.linux)
{ {
@ -58,12 +55,12 @@ in
Service = { Service = {
ExecStart = ExecStart =
let let
args = concatStringsSep " " ( args = lib.concatStringsSep " " (
[ [
"--start" "--start"
"--foreground" "--foreground"
] ]
++ optional (cfg.components != [ ]) ("--components=" + concatStringsSep "," cfg.components) ++ lib.optional (cfg.components != [ ]) ("--components=" + lib.concatStringsSep "," cfg.components)
); );
in in
"${pkgs.gnome-keyring}/bin/gnome-keyring-daemon ${args}"; "${pkgs.gnome-keyring}/bin/gnome-keyring-daemon ${args}";

View file

@ -5,10 +5,14 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
mkIf
mkOption
optional
optionalString
types
;
cfg = config.services.gpg-agent; cfg = config.services.gpg-agent;
gpgPkg = config.programs.gpg.package; gpgPkg = config.programs.gpg.package;
@ -55,7 +59,7 @@ let
gpgconf = gpgconf =
dir: dir:
let let
hash = substring 0 24 (hexStringToBase32 (builtins.hashString "sha1" homedir)); hash = lib.substring 0 24 (hexStringToBase32 (builtins.hashString "sha1" homedir));
subdir = if homedir == options.programs.gpg.homedir.default then "${dir}" else "d.${hash}/${dir}"; subdir = if homedir == options.programs.gpg.homedir.default then "${dir}" else "d.${hash}/${dir}";
in in
if pkgs.stdenv.isDarwin then if pkgs.stdenv.isDarwin then
@ -68,7 +72,7 @@ let
hexStringToBase32 = hexStringToBase32 =
let let
mod = a: b: a - a / b * b; mod = a: b: a - a / b * b;
pow2 = elemAt [ pow2 = lib.elemAt [
1 1
2 2
4 4
@ -80,10 +84,10 @@ let
256 256
]; ];
base32Alphabet = stringToCharacters "ybndrfg8ejkmcpqxot1uwisza345h769"; base32Alphabet = lib.stringToCharacters "ybndrfg8ejkmcpqxot1uwisza345h769";
hexToIntTable = listToAttrs ( hexToIntTable = lib.listToAttrs (
genList (x: { lib.genList (x: {
name = toLower (toHexString x); name = lib.toLower (lib.toHexString x);
value = x; value = x;
}) 16 }) 16
); );
@ -107,7 +111,7 @@ let
in in
if bufBits >= 5 then if bufBits >= 5 then
{ {
ret = ret + elemAt base32Alphabet (buf' / pow2 extraBits); ret = ret + lib.elemAt base32Alphabet (buf' / pow2 extraBits);
buf = mod buf' (pow2 extraBits); buf = mod buf' (pow2 extraBits);
bufBits = bufBits' - 5; bufBits = bufBits' - 5;
} }
@ -118,7 +122,7 @@ let
bufBits = bufBits'; bufBits = bufBits';
}; };
in in
hexString: (foldl' go initState (stringToCharacters hexString)).ret; hexString: (lib.foldl' go initState (lib.stringToCharacters hexString)).ret;
# Systemd socket unit generator. # Systemd socket unit generator.
mkSocket = mkSocket =
@ -156,10 +160,10 @@ let
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
imports = [ imports = [
(mkRemovedOptionModule [ (lib.mkRemovedOptionModule [
"services" "services"
"gpg-agent" "gpg-agent"
"pinentryFlavor" "pinentryFlavor"
@ -168,7 +172,7 @@ in
options = { options = {
services.gpg-agent = { services.gpg-agent = {
enable = mkEnableOption "GnuPG private key agent"; enable = lib.mkEnableOption "GnuPG private key agent";
defaultCacheTtl = mkOption { defaultCacheTtl = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
@ -294,7 +298,7 @@ in
}; };
pinentryPackage = mkOption { pinentryPackage = mkOption {
type = types.nullOr types.package; type = types.nullOr types.package;
example = literalExpression "pkgs.pinentry-gnome3"; example = lib.literalExpression "pkgs.pinentry-gnome3";
default = null; default = null;
description = '' description = ''
Which pinentry interface to use. If not `null`, it sets Which pinentry interface to use. If not `null`, it sets
@ -317,109 +321,111 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
{ lib.mkMerge [
home.file."${homedir}/gpg-agent.conf".text = concatStringsSep "\n" ( {
optional (cfg.enableSshSupport) "enable-ssh-support" home.file."${homedir}/gpg-agent.conf".text = lib.concatStringsSep "\n" (
++ optional cfg.grabKeyboardAndMouse "grab" optional (cfg.enableSshSupport) "enable-ssh-support"
++ optional (!cfg.enableScDaemon) "disable-scdaemon" ++ optional cfg.grabKeyboardAndMouse "grab"
++ optional (cfg.noAllowExternalCache) "no-allow-external-cache" ++ optional (!cfg.enableScDaemon) "disable-scdaemon"
++ optional (cfg.defaultCacheTtl != null) "default-cache-ttl ${toString cfg.defaultCacheTtl}" ++ optional (cfg.noAllowExternalCache) "no-allow-external-cache"
++ optional ( ++ optional (cfg.defaultCacheTtl != null) "default-cache-ttl ${toString cfg.defaultCacheTtl}"
cfg.defaultCacheTtlSsh != null ++ optional (
) "default-cache-ttl-ssh ${toString cfg.defaultCacheTtlSsh}" cfg.defaultCacheTtlSsh != null
++ optional (cfg.maxCacheTtl != null) "max-cache-ttl ${toString cfg.maxCacheTtl}" ) "default-cache-ttl-ssh ${toString cfg.defaultCacheTtlSsh}"
++ optional (cfg.maxCacheTtlSsh != null) "max-cache-ttl-ssh ${toString cfg.maxCacheTtlSsh}" ++ optional (cfg.maxCacheTtl != null) "max-cache-ttl ${toString cfg.maxCacheTtl}"
++ optional (cfg.pinentryPackage != null) "pinentry-program ${lib.getExe cfg.pinentryPackage}" ++ optional (cfg.maxCacheTtlSsh != null) "max-cache-ttl-ssh ${toString cfg.maxCacheTtlSsh}"
++ [ cfg.extraConfig ] ++ optional (cfg.pinentryPackage != null) "pinentry-program ${lib.getExe cfg.pinentryPackage}"
); ++ [ cfg.extraConfig ]
);
home.sessionVariablesExtra = optionalString cfg.enableSshSupport '' home.sessionVariablesExtra = optionalString cfg.enableSshSupport ''
if [ -z "$SSH_AUTH_SOCK" ]; then if [ -z "$SSH_AUTH_SOCK" ]; then
export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)" export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)"
fi fi
''; '';
programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr; programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr;
programs.zsh.initContent = mkIf cfg.enableZshIntegration gpgZshInitStr; programs.zsh.initContent = mkIf cfg.enableZshIntegration gpgZshInitStr;
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration gpgFishInitStr; programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration gpgFishInitStr;
programs.nushell.extraEnv = mkIf cfg.enableNushellIntegration gpgNushellInitStr; programs.nushell.extraEnv = mkIf cfg.enableNushellIntegration gpgNushellInitStr;
} }
(mkIf (cfg.sshKeys != null) { (mkIf (cfg.sshKeys != null) {
# Trailing newlines are important # Trailing newlines are important
home.file."${homedir}/sshcontrol".text = concatMapStrings (s: '' home.file."${homedir}/sshcontrol".text = lib.concatMapStrings (s: ''
${s} ${s}
'') cfg.sshKeys; '') cfg.sshKeys;
})
(mkMerge [
(mkIf pkgs.stdenv.isLinux {
systemd.user.services.gpg-agent = {
Unit = {
Description = "GnuPG cryptographic agent and passphrase cache";
Documentation = "man:gpg-agent(1)";
Requires = "gpg-agent.socket";
After = "gpg-agent.socket";
# This is a socket-activated service:
RefuseManualStart = true;
};
Service = {
ExecStart = "${gpgPkg}/bin/gpg-agent --supervised" + optionalString cfg.verbose " --verbose";
ExecReload = "${gpgPkg}/bin/gpgconf --reload gpg-agent";
Environment = [ "GNUPGHOME=${homedir}" ];
};
};
systemd.user.sockets.gpg-agent = mkSocket {
desc = "GnuPG cryptographic agent and passphrase cache";
docs = "man:gpg-agent(1)";
stream = "S.gpg-agent";
fdName = "std";
};
systemd.user.sockets.gpg-agent-ssh = mkIf cfg.enableSshSupport (mkSocket ({
desc = "GnuPG cryptographic agent (ssh-agent emulation)";
docs = "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)";
stream = "S.gpg-agent.ssh";
fdName = "ssh";
}));
systemd.user.sockets.gpg-agent-extra = mkIf cfg.enableExtraSocket (mkSocket {
desc = "GnuPG cryptographic agent and passphrase cache (restricted)";
docs = "man:gpg-agent(1) man:ssh(1)";
stream = "S.gpg-agent.extra";
fdName = "extra";
});
}) })
(mkIf pkgs.stdenv.isDarwin { (lib.mkMerge [
launchd.agents.gpg-agent = { (mkIf pkgs.stdenv.isLinux {
enable = true; systemd.user.services.gpg-agent = {
config = { Unit = {
ProgramArguments = [ Description = "GnuPG cryptographic agent and passphrase cache";
"${gpgPkg}/bin/gpg-agent" Documentation = "man:gpg-agent(1)";
"--supervised" Requires = "gpg-agent.socket";
] ++ optional cfg.verbose "--verbose"; After = "gpg-agent.socket";
EnvironmentVariables = { # This is a socket-activated service:
GNUPGHOME = homedir; RefuseManualStart = true;
}; };
KeepAlive = {
Crashed = true; Service = {
SuccessfulExit = false; ExecStart = "${gpgPkg}/bin/gpg-agent --supervised" + optionalString cfg.verbose " --verbose";
}; ExecReload = "${gpgPkg}/bin/gpgconf --reload gpg-agent";
ProcessType = "Background"; Environment = [ "GNUPGHOME=${homedir}" ];
RunAtLoad = cfg.enableSshSupport;
Sockets = {
Agent = mkAgentSock "S.gpg-agent";
Ssh = mkIf cfg.enableSshSupport (mkAgentSock "S.gpg-agent.ssh");
Extra = mkIf cfg.enableExtraSocket (mkAgentSock "S.gpg-agent.extra");
}; };
}; };
};
}) systemd.user.sockets.gpg-agent = mkSocket {
]) desc = "GnuPG cryptographic agent and passphrase cache";
]); docs = "man:gpg-agent(1)";
stream = "S.gpg-agent";
fdName = "std";
};
systemd.user.sockets.gpg-agent-ssh = mkIf cfg.enableSshSupport (mkSocket {
desc = "GnuPG cryptographic agent (ssh-agent emulation)";
docs = "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)";
stream = "S.gpg-agent.ssh";
fdName = "ssh";
});
systemd.user.sockets.gpg-agent-extra = mkIf cfg.enableExtraSocket (mkSocket {
desc = "GnuPG cryptographic agent and passphrase cache (restricted)";
docs = "man:gpg-agent(1) man:ssh(1)";
stream = "S.gpg-agent.extra";
fdName = "extra";
});
})
(mkIf pkgs.stdenv.isDarwin {
launchd.agents.gpg-agent = {
enable = true;
config = {
ProgramArguments = [
"${gpgPkg}/bin/gpg-agent"
"--supervised"
] ++ optional cfg.verbose "--verbose";
EnvironmentVariables = {
GNUPGHOME = homedir;
};
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
RunAtLoad = cfg.enableSshSupport;
Sockets = {
Agent = mkAgentSock "S.gpg-agent";
Ssh = mkIf cfg.enableSshSupport (mkAgentSock "S.gpg-agent.ssh");
Extra = mkIf cfg.enableExtraSocket (mkAgentSock "S.gpg-agent.extra");
};
};
};
})
])
]
);
} }

View file

@ -4,10 +4,8 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption mkIf types;
cfg = config.services.grobi; cfg = config.services.grobi;
@ -15,11 +13,11 @@ let
in in
{ {
meta.maintainers = [ maintainers.mbrgm ]; meta.maintainers = [ lib.maintainers.mbrgm ];
options = { options = {
services.grobi = { services.grobi = {
enable = mkEnableOption "the grobi display setup daemon"; enable = lib.mkEnableOption "the grobi display setup daemon";
executeAfter = mkOption { executeAfter = mkOption {
type = with types; listOf str; type = with types; listOf str;
@ -36,7 +34,7 @@ in
rules = mkOption { rules = mkOption {
type = with types; listOf (attrsOf eitherStrBoolIntList); type = with types; listOf (attrsOf eitherStrBoolIntList);
default = [ ]; default = [ ];
example = literalExpression '' example = lib.literalExpression ''
[ [
{ {
name = "Home"; name = "Home";

View file

@ -4,16 +4,14 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.gromit-mpx; cfg = config.services.gromit-mpx;
# Select the appropriate hot key: # Select the appropriate hot key:
hotkey = hotkey =
if isInt cfg.hotKey then if lib.isInt cfg.hotKey then
"--keycode ${toString cfg.hotKey}" "--keycode ${toString cfg.hotKey}"
else if cfg.hotKey != null then else if cfg.hotKey != null then
"--key ${cfg.hotKey}" "--key ${cfg.hotKey}"
@ -22,7 +20,7 @@ let
# Select the appropriate undo key: # Select the appropriate undo key:
undokey = undokey =
if isInt cfg.undoKey then if lib.isInt cfg.undoKey then
"--undo-keycode ${toString cfg.undoKey}" "--undo-keycode ${toString cfg.undoKey}"
else if cfg.undoKey != null then else if cfg.undoKey != null then
"--undo-key ${cfg.undoKey}" "--undo-key ${cfg.undoKey}"
@ -30,7 +28,7 @@ let
"--undo-key none"; "--undo-key none";
# The command line to send to gromit-mpx: # The command line to send to gromit-mpx:
commandArgs = concatStringsSep " " [ commandArgs = lib.concatStringsSep " " [
hotkey hotkey
undokey undokey
]; ];
@ -39,7 +37,7 @@ let
# state. That will break our config so we set it manually which, # state. That will break our config so we set it manually which,
# thanks to the read-only Nix store, prevents Gromit from writing to # thanks to the read-only Nix store, prevents Gromit from writing to
# it. # it.
keyFile = generators.toINI { } { keyFile = lib.generators.toINI { } {
General.ShowIntroOnStartup = false; General.ShowIntroOnStartup = false;
Drawing.Opacity = cfg.opacity; Drawing.Opacity = cfg.opacity;
}; };
@ -60,19 +58,19 @@ let
# Create a string of tool attributes: # Create a string of tool attributes:
toolAttrs = toolAttrs =
tool: tool:
concatStringsSep " " ( lib.concatStringsSep " " (
[ "size=${toString tool.size}" ] [ "size=${toString tool.size}" ]
++ optional (tool.type != "eraser") ''color="${tool.color}"'' ++ lib.optional (tool.type != "eraser") ''color="${tool.color}"''
++ optional (tool.arrowSize != null) "arrowsize=${toString tool.arrowSize}" ++ lib.optional (tool.arrowSize != null) "arrowsize=${toString tool.arrowSize}"
); );
# Optional tool modifier string: # Optional tool modifier string:
toolMod = toolMod =
tool: if tool.modifiers != [ ] then "[" + concatStringsSep ", " tool.modifiers + "]" else ""; tool: if tool.modifiers != [ ] then "[" + lib.concatStringsSep ", " tool.modifiers + "]" else "";
# A single tool configuration: # A single tool configuration:
toolToCfg = n: tool: '' toolToCfg = n: tool: ''
"tool-${toString n}" = ${toUpper tool.type} (${toolAttrs tool}); "tool-${toString n}" = ${lib.toUpper tool.type} (${toolAttrs tool});
"${tool.device}"${toolMod tool} = "tool-${toString n}"; "${tool.device}"${toolMod tool} = "tool-${toString n}";
''; '';
@ -136,10 +134,10 @@ let
in in
{ {
meta.maintainers = [ maintainers.pjones ]; meta.maintainers = [ lib.maintainers.pjones ];
options.services.gromit-mpx = { options.services.gromit-mpx = {
enable = mkEnableOption "Gromit-MPX annotation tool"; enable = lib.mkEnableOption "Gromit-MPX annotation tool";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -224,13 +222,13 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.gromit-mpx" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.gromit-mpx" pkgs lib.platforms.linux)
]; ];
xdg.configFile."gromit-mpx.ini".text = keyFile; xdg.configFile."gromit-mpx.ini".text = keyFile;
xdg.configFile."gromit-mpx.cfg".text = concatStringsSep "\n" (imap1 toolToCfg cfg.tools); xdg.configFile."gromit-mpx.cfg".text = lib.concatStringsSep "\n" (lib.imap1 toolToCfg cfg.tools);
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];

View file

@ -4,10 +4,8 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.hound; cfg = config.services.hound;
@ -27,10 +25,10 @@ let
in in
{ {
meta.maintainers = [ maintainers.adisbladis ]; meta.maintainers = [ lib.maintainers.adisbladis ];
options.services.hound = { options.services.hound = {
enable = mkEnableOption "hound"; enable = lib.mkEnableOption "hound";
maxConcurrentIndexers = mkOption { maxConcurrentIndexers = mkOption {
type = types.ints.positive; type = types.ints.positive;
@ -54,7 +52,7 @@ in
repositories = mkOption { repositories = mkOption {
type = types.attrsOf jsonFormat.type; type = types.attrsOf jsonFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
SomeGitRepo = { SomeGitRepo = {
url = "https://www.github.com/YourOrganization/RepoOne.git"; url = "https://www.github.com/YourOrganization/RepoOne.git";
@ -67,7 +65,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.hound" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.hound" pkgs lib.platforms.linux)
]; ];
@ -86,13 +84,13 @@ in
Service = { Service = {
Environment = [ Environment = [
"PATH=${ "PATH=${
makeBinPath [ lib.makeBinPath [
pkgs.mercurial pkgs.mercurial
pkgs.git pkgs.git
] ]
}" }"
]; ];
ExecStart = "${pkgs.hound}/bin/houndd ${concatStringsSep " " houndOptions}"; ExecStart = "${pkgs.hound}/bin/houndd ${lib.concatStringsSep " " houndOptions}";
}; };
}; };
}; };

View file

@ -4,10 +4,13 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
mkOption
types
listToAttrs
optionalAttrs
;
cfg = config.services.imapnotify; cfg = config.services.imapnotify;
@ -15,7 +18,9 @@ let
configName = account: "imapnotify-${safeName account.name}-config.json"; configName = account: "imapnotify-${safeName account.name}-config.json";
imapnotifyAccounts = filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts); imapnotifyAccounts = lib.filter (a: a.imapnotify.enable) (
lib.attrValues config.accounts.email.accounts
);
genAccountUnit = genAccountUnit =
account: account:
@ -32,7 +37,7 @@ let
Service = { Service = {
# Use the nix store path for config to ensure service restarts when it changes # Use the nix store path for config to ensure service restarts when it changes
ExecStart = ExecStart =
"${getExe cfg.package} -conf '${genAccountConfig account}'" "${lib.getExe cfg.package} -conf '${genAccountConfig account}'"
+ " ${lib.optionalString (account.imapnotify.extraArgs != [ ]) ( + " ${lib.optionalString (account.imapnotify.extraArgs != [ ]) (
toString account.imapnotify.extraArgs toString account.imapnotify.extraArgs
)}"; )}";
@ -41,7 +46,7 @@ let
Type = "simple"; Type = "simple";
Environment = Environment =
[ "PATH=${cfg.path}" ] [ "PATH=${cfg.path}" ]
++ optional account.notmuch.enable "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; ++ lib.optional account.notmuch.enable "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config";
}; };
Install = { Install = {
@ -63,7 +68,7 @@ let
{ {
# Use the nix store path for config to ensure service restarts when it changes # Use the nix store path for config to ensure service restarts when it changes
ProgramArguments = [ ProgramArguments = [
"${getExe cfg.package}" "${lib.getExe cfg.package}"
"-conf" "-conf"
"${genAccountConfig account}" "${genAccountConfig account}"
]; ];
@ -115,17 +120,17 @@ let
in in
{ {
meta.maintainers = [ maintainers.nickhu ]; meta.maintainers = [ lib.maintainers.nickhu ];
options = { options = {
services.imapnotify = { services.imapnotify = {
enable = mkEnableOption "imapnotify"; enable = lib.mkEnableOption "imapnotify";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.goimapnotify; default = pkgs.goimapnotify;
defaultText = literalExpression "pkgs.goimapnotify"; defaultText = lib.literalExpression "pkgs.goimapnotify";
example = literalExpression "pkgs.imapnotify"; example = lib.literalExpression "pkgs.imapnotify";
description = "The imapnotify package to use"; description = "The imapnotify package to use";
}; };
@ -146,18 +151,18 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = assertions =
let let
checkAccounts = checkAccounts =
pred: msg: pred: msg:
let let
badAccounts = filter pred imapnotifyAccounts; badAccounts = lib.filter pred imapnotifyAccounts;
in in
{ {
assertion = badAccounts == [ ]; assertion = badAccounts == [ ];
message = message =
"imapnotify: Missing ${msg} for accounts: " + concatMapStringsSep ", " (a: a.name) badAccounts; "imapnotify: Missing ${msg} for accounts: " + lib.concatMapStringsSep ", " (a: a.name) badAccounts;
}; };
in in
[ [

View file

@ -4,10 +4,15 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
concatStringsSep
literalExpression
mkIf
mkOption
optionalString
types
;
cfg = config.services.kanshi; cfg = config.services.kanshi;
@ -42,12 +47,12 @@ let
else if x ? include then else if x ? include then
''include "${x.include}"'' ''include "${x.include}"''
else else
throw "Unknown tags ${attrNames x}"; throw "Unknown tags ${lib.attrNames x}";
directivesStr = concatStringsSep "\n" (map tagToStr cfg.settings); directivesStr = concatStringsSep "\n" (map tagToStr cfg.settings);
oldDirectivesStr = '' oldDirectivesStr = ''
${concatStringsSep "\n" (mapAttrsToList (n: v: profileStr (v // { name = n; })) cfg.profiles)} ${concatStringsSep "\n" (lib.mapAttrsToList (n: v: profileStr (v // { name = n; })) cfg.profiles)}
${cfg.extraConfig} ${cfg.extraConfig}
''; '';
@ -194,7 +199,7 @@ let
}; };
exec = mkOption { exec = mkOption {
type = with types; coercedTo str singleton (listOf str); type = with types; coercedTo str lib.singleton (listOf str);
default = [ ]; default = [ ];
example = "[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]"; example = "[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]";
description = '' description = ''
@ -216,10 +221,10 @@ let
in in
{ {
meta.maintainers = [ hm.maintainers.nurelin ]; meta.maintainers = [ lib.hm.maintainers.nurelin ];
options.services.kanshi = { options.services.kanshi = {
enable = mkEnableOption "kanshi, a Wayland daemon that automatically configures outputs"; enable = lib.mkEnableOption "kanshi, a Wayland daemon that automatically configures outputs";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -314,67 +319,70 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
{ lib.mkMerge [
assertions = [ {
(lib.hm.assertions.assertPlatform "services.kanshi" pkgs lib.platforms.linux) assertions = [
{ (lib.hm.assertions.assertPlatform "services.kanshi" pkgs lib.platforms.linux)
assertion = (cfg.profiles == { } && cfg.extraConfig == "") || (length cfg.settings) == 0; {
message = "Cannot mix kanshi.settings with kanshi.profiles or kanshi.extraConfig"; assertion = (cfg.profiles == { } && cfg.extraConfig == "") || (lib.length cfg.settings) == 0;
} message = "Cannot mix kanshi.settings with kanshi.profiles or kanshi.extraConfig";
{ }
assertion = {
let assertion =
profiles = filter (x: x ? profile) cfg.settings; let
in profiles = lib.filter (x: x ? profile) cfg.settings;
length (filter (x: any (a: a ? alias && a.alias != null) x.profile.outputs) profiles) == 0; in
message = "Output kanshi.*.output.alias can only be defined on global scope"; lib.length (lib.filter (x: lib.any (a: a ? alias && a.alias != null) x.profile.outputs) profiles)
} == 0;
]; message = "Output kanshi.*.output.alias can only be defined on global scope";
} }
];
}
(mkIf (cfg.profiles != { }) { (mkIf (cfg.profiles != { }) {
warnings = [ warnings = [
"kanshi.profiles option is deprecated. Use kanshi.settings instead." "kanshi.profiles option is deprecated. Use kanshi.settings instead."
]; ];
}) })
(mkIf (cfg.extraConfig != "") { (mkIf (cfg.extraConfig != "") {
warnings = [ warnings = [
"kanshi.extraConfig option is deprecated. Use kanshi.settings instead." "kanshi.extraConfig option is deprecated. Use kanshi.settings instead."
]; ];
}) })
{ {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile."kanshi/config" = xdg.configFile."kanshi/config" =
let let
generatedConfigStr = generatedConfigStr =
if cfg.profiles == { } && cfg.extraConfig == "" then directivesStr else oldDirectivesStr; if cfg.profiles == { } && cfg.extraConfig == "" then directivesStr else oldDirectivesStr;
in in
mkIf (generatedConfigStr != "") { text = generatedConfigStr; }; mkIf (generatedConfigStr != "") { text = generatedConfigStr; };
systemd.user.services.kanshi = { systemd.user.services.kanshi = {
Unit = { Unit = {
Description = "Dynamic output configuration"; Description = "Dynamic output configuration";
Documentation = "man:kanshi(1)"; Documentation = "man:kanshi(1)";
ConditionEnvironment = "WAYLAND_DISPLAY"; ConditionEnvironment = "WAYLAND_DISPLAY";
PartOf = cfg.systemdTarget; PartOf = cfg.systemdTarget;
Requires = cfg.systemdTarget; Requires = cfg.systemdTarget;
After = cfg.systemdTarget; After = cfg.systemdTarget;
};
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/kanshi";
Restart = "always";
};
Install = {
WantedBy = [ cfg.systemdTarget ];
};
}; };
}
Service = { ]
Type = "simple"; );
ExecStart = "${cfg.package}/bin/kanshi";
Restart = "always";
};
Install = {
WantedBy = [ cfg.systemdTarget ];
};
};
}
]);
} }

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.kbfs; cfg = config.services.kbfs;
@ -15,10 +12,10 @@ in
{ {
options = { options = {
services.kbfs = { services.kbfs = {
enable = mkEnableOption "Keybase File System"; enable = lib.mkEnableOption "Keybase File System";
mountPoint = mkOption { mountPoint = lib.mkOption {
type = types.str; type = lib.types.str;
default = "keybase"; default = "keybase";
description = '' description = ''
Mount point for the Keybase filesystem, relative to Mount point for the Keybase filesystem, relative to
@ -26,8 +23,8 @@ in
''; '';
}; };
extraFlags = mkOption { extraFlags = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
example = [ example = [
"-label kbfs" "-label kbfs"
@ -40,7 +37,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.kbfs" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.kbfs" pkgs lib.platforms.linux)
]; ];

View file

@ -4,41 +4,38 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.kdeconnect; cfg = config.services.kdeconnect;
in in
{ {
meta.maintainers = [ maintainers.adisbladis ]; meta.maintainers = [ lib.maintainers.adisbladis ];
options = { options = {
services.kdeconnect = { services.kdeconnect = {
enable = mkEnableOption "KDE connect"; enable = lib.mkEnableOption "KDE connect";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.kdePackages.kdeconnect-kde; default = pkgs.kdePackages.kdeconnect-kde;
example = literalExpression "pkgs.plasma5Packages.kdeconnect-kde"; example = lib.literalExpression "pkgs.plasma5Packages.kdeconnect-kde";
description = "The KDE connect package to use"; description = "The KDE connect package to use";
}; };
indicator = mkOption { indicator = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = "Whether to enable kdeconnect-indicator service."; description = "Whether to enable kdeconnect-indicator service.";
}; };
}; };
}; };
config = mkMerge [ config = lib.mkMerge [
(mkIf cfg.enable { (lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.kdeconnect" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.kdeconnect" pkgs lib.platforms.linux)
]; ];
systemd.user.services.kdeconnect = { systemd.user.services.kdeconnect = {
@ -55,7 +52,7 @@ in
Service = { Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ]; Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart = ExecStart =
if strings.versionAtLeast (versions.majorMinor cfg.package.version) "24.05" then if lib.strings.versionAtLeast (lib.versions.majorMinor cfg.package.version) "24.05" then
"${cfg.package}/bin/kdeconnectd" "${cfg.package}/bin/kdeconnectd"
else else
"${cfg.package}/libexec/kdeconnectd"; "${cfg.package}/libexec/kdeconnectd";
@ -64,9 +61,9 @@ in
}; };
}) })
(mkIf cfg.indicator { (lib.mkIf cfg.indicator {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.kdeconnect" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.kdeconnect" pkgs lib.platforms.linux)
]; ];
systemd.user.services.kdeconnect-indicator = { systemd.user.services.kdeconnect-indicator = {

View file

@ -4,18 +4,15 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.keybase; cfg = config.services.keybase;
in in
{ {
options.services.keybase.enable = mkEnableOption "Keybase"; options.services.keybase.enable = lib.mkEnableOption "Keybase";
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.keybase" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.keybase" pkgs lib.platforms.linux)
]; ];

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.keynav; cfg = config.services.keynav;
@ -14,10 +11,10 @@ let
in in
{ {
options.services.keynav = { options.services.keynav = {
enable = mkEnableOption "keynav"; enable = lib.mkEnableOption "keynav";
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.keynav" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.keynav" pkgs lib.platforms.linux)
]; ];

View file

@ -4,23 +4,20 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.lieer; cfg = config.services.lieer;
syncAccounts = filter (a: a.lieer.enable && a.lieer.sync.enable) ( syncAccounts = lib.filter (a: a.lieer.enable && a.lieer.sync.enable) (
attrValues config.accounts.email.accounts lib.attrValues config.accounts.email.accounts
); );
escapeUnitName = escapeUnitName =
name: name:
let let
good = upperChars ++ lowerChars ++ stringToCharacters "0123456789-_"; good = lib.upperChars ++ lib.lowerChars ++ lib.stringToCharacters "0123456789-_";
subst = c: if any (x: x == c) good then c else "-"; subst = c: if lib.any (x: x == c) good then c else "-";
in in
stringAsChars subst name; lib.stringAsChars subst name;
serviceUnit = account: { serviceUnit = account: {
name = escapeUnitName "lieer-${account.name}"; name = escapeUnitName "lieer-${account.name}";
@ -59,17 +56,17 @@ let
in in
{ {
meta.maintainers = [ maintainers.tadfisher ]; meta.maintainers = [ lib.maintainers.tadfisher ];
options.services.lieer.enable = mkEnableOption "lieer Gmail synchronization service"; options.services.lieer.enable = lib.mkEnableOption "lieer Gmail synchronization service";
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.lieer" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.lieer" pkgs lib.platforms.linux)
]; ];
programs.lieer.enable = true; programs.lieer.enable = true;
systemd.user.services = listToAttrs (map serviceUnit syncAccounts); systemd.user.services = lib.listToAttrs (map serviceUnit syncAccounts);
systemd.user.timers = listToAttrs (map timerUnit syncAccounts); systemd.user.timers = lib.listToAttrs (map timerUnit syncAccounts);
}; };
} }

View file

@ -4,21 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.linux-wallpaperengine; cfg = config.services.linux-wallpaperengine;
in in
{ {
meta.maintainers = [ hm.maintainers.ckgxrg ]; meta.maintainers = [ lib.hm.maintainers.ckgxrg ];
options.services.linux-wallpaperengine = { options.services.linux-wallpaperengine = {
enable = mkEnableOption "linux-wallpaperengine, an implementation of Wallpaper Engine functionality"; enable = lib.mkEnableOption "linux-wallpaperengine, an implementation of Wallpaper Engine functionality";
package = mkPackageOption pkgs "linux-wallpaperengine" { }; package = lib.mkPackageOption pkgs "linux-wallpaperengine" { };
assetsPath = mkOption { assetsPath = mkOption {
type = types.path; type = types.path;
@ -103,7 +101,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.linux-wallpaperengine" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.linux-wallpaperengine" pkgs lib.platforms.linux)
]; ];
@ -112,10 +110,10 @@ in
systemd.user.services."linux-wallpaperengine" = systemd.user.services."linux-wallpaperengine" =
let let
args = lists.forEach cfg.wallpapers ( args = lib.lists.forEach cfg.wallpapers (
each: each:
concatStringsSep " " ( lib.concatStringsSep " " (
cli.toGNUCommandLine { } { lib.cli.toGNUCommandLine { } {
screen-root = each.monitor; screen-root = each.monitor;
inherit (each) scaling fps; inherit (each) scaling fps;
silent = each.audio.silent; silent = each.audio.silent;
@ -136,10 +134,10 @@ in
}; };
Service = { Service = {
ExecStart = ExecStart =
getExe cfg.package lib.getExe cfg.package
+ " --assets-dir ${cfg.assetsPath} " + " --assets-dir ${cfg.assetsPath} "
+ "--clamping ${cfg.clamping} " + "--clamping ${cfg.clamping} "
+ (strings.concatStringsSep " " args); + (lib.strings.concatStringsSep " " args);
Restart = "on-failure"; Restart = "on-failure";
}; };
Install = { Install = {

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.lorri; cfg = config.services.lorri;
@ -14,27 +11,27 @@ let
in in
{ {
meta.maintainers = [ meta.maintainers = [
maintainers.gerschtli lib.maintainers.gerschtli
maintainers.nyarly lib.maintainers.nyarly
]; ];
options.services.lorri = { options.services.lorri = {
enable = mkEnableOption "lorri build daemon"; enable = lib.mkEnableOption "lorri build daemon";
enableNotifications = mkEnableOption "lorri build notifications"; enableNotifications = lib.mkEnableOption "lorri build notifications";
package = lib.mkPackageOption pkgs "lorri" { }; package = lib.mkPackageOption pkgs "lorri" { };
nixPackage = mkOption { nixPackage = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.nix; default = pkgs.nix;
defaultText = literalExpression "pkgs.nix"; defaultText = lib.literalExpression "pkgs.nix";
example = literalExpression "pkgs.nixVersions.unstable"; example = lib.literalExpression "pkgs.nixVersions.unstable";
description = "Which nix package to use."; description = "Which nix package to use.";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.lorri" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.lorri" pkgs lib.platforms.linux)
]; ];
@ -95,7 +92,7 @@ in
}; };
}; };
services.lorri-notify = mkIf cfg.enableNotifications { services.lorri-notify = lib.mkIf cfg.enableNotifications {
Unit = { Unit = {
Description = "lorri build notifications"; Description = "lorri build notifications";
After = "lorri.service"; After = "lorri.service";
@ -123,7 +120,7 @@ in
Restart = "on-failure"; Restart = "on-failure";
Environment = Environment =
let let
path = makeSearchPath "bin" ( path = lib.makeSearchPath "bin" (
with pkgs; with pkgs;
[ [
bash bash

View file

@ -4,29 +4,27 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.mako; cfg = config.services.mako;
in in
{ {
meta.maintainers = [ maintainers.onny ]; meta.maintainers = [ lib.maintainers.onny ];
imports = [ (mkRenamedOptionModule [ "programs" "mako" ] [ "services" "mako" ]) ]; imports = [ (lib.mkRenamedOptionModule [ "programs" "mako" ] [ "services" "mako" ]) ];
options = { options = {
services.mako = { services.mako = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
Mako, lightweight notification daemon for Wayland Mako, lightweight notification daemon for Wayland
''; '';
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.mako; default = pkgs.mako;
defaultText = literalExpression "pkgs.mako"; defaultText = lib.literalExpression "pkgs.mako";
description = "The mako package to use."; description = "The mako package to use.";
}; };
@ -314,7 +312,7 @@ in
extraConfig = mkOption { extraConfig = mkOption {
default = ""; default = "";
type = types.lines; type = types.lines;
example = literalExpression '' example = lib.literalExpression ''
[urgency=low] [urgency=low]
border-color=#b8bb26 border-color=#b8bb26
''; '';
@ -330,8 +328,10 @@ in
optionalInteger = name: val: lib.optionalString (val != null) "${name}=${toString val}"; optionalInteger = name: val: lib.optionalString (val != null) "${name}=${toString val}";
optionalString = name: val: lib.optionalString (val != null) "${name}=${val}"; optionalString = name: val: lib.optionalString (val != null) "${name}=${val}";
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.mako" pkgs platforms.linux) ]; assertions = [
(lib.hm.assertions.assertPlatform "services.mako" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];

View file

@ -4,30 +4,28 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.mbsync; cfg = config.services.mbsync;
mbsyncOptions = mbsyncOptions =
[ "--all" ] [ "--all" ]
++ optional (cfg.verbose) "--verbose" ++ lib.optional (cfg.verbose) "--verbose"
++ optional (cfg.configFile != null) "--config ${cfg.configFile}"; ++ lib.optional (cfg.configFile != null) "--config ${cfg.configFile}";
in in
{ {
meta.maintainers = [ maintainers.pjones ]; meta.maintainers = [ lib.maintainers.pjones ];
options.services.mbsync = { options.services.mbsync = {
enable = mkEnableOption "mbsync"; enable = lib.mkEnableOption "mbsync";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.isync; default = pkgs.isync;
defaultText = literalExpression "pkgs.isync"; defaultText = lib.literalExpression "pkgs.isync";
example = literalExpression "pkgs.isync"; example = lib.literalExpression "pkgs.isync";
description = "The package to use for the mbsync binary."; description = "The package to use for the mbsync binary.";
}; };
@ -80,7 +78,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.mbsync" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.mbsync" pkgs lib.platforms.linux)
]; ];
@ -93,12 +91,12 @@ in
Service = Service =
{ {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}"; ExecStart = "${cfg.package}/bin/mbsync ${lib.concatStringsSep " " mbsyncOptions}";
} }
// (optionalAttrs (cfg.postExec != null) { // (lib.optionalAttrs (cfg.postExec != null) {
ExecStartPost = cfg.postExec; ExecStartPost = cfg.postExec;
}) })
// (optionalAttrs (cfg.preExec != null) { // (lib.optionalAttrs (cfg.preExec != null) {
ExecStartPre = cfg.preExec; ExecStartPre = cfg.preExec;
}); });
}; };

View file

@ -5,10 +5,13 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
generators
mkIf
mkOption
types
;
cfg = config.services.mopidy; cfg = config.services.mopidy;
@ -18,13 +21,17 @@ let
toMopidyConf = generators.toINI { toMopidyConf = generators.toINI {
mkKeyValue = generators.mkKeyValueDefault { mkKeyValue = generators.mkKeyValueDefault {
mkValueString = mkValueString =
v: if isList v then "\n " + concatStringsSep "\n " v else generators.mkValueStringDefault { } v; v:
if lib.isList v then
"\n " + lib.concatStringsSep "\n " v
else
generators.mkValueStringDefault { } v;
} " = "; } " = ";
}; };
mopidyEnv = pkgs.buildEnv { mopidyEnv = pkgs.buildEnv {
name = "mopidy-with-extensions-${pkgs.mopidy.version}"; name = "mopidy-with-extensions-${pkgs.mopidy.version}";
paths = closePropagation cfg.extensionPackages; paths = lib.closePropagation cfg.extensionPackages;
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ]; pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
nativeBuildInputs = [ pkgs.makeWrapper ]; nativeBuildInputs = [ pkgs.makeWrapper ];
ignoreCollisions = true; ignoreCollisions = true;
@ -60,7 +67,7 @@ let
settingsFormat = mopidyConfFormat { }; settingsFormat = mopidyConfFormat { };
configFilePaths = concatStringsSep ":" ( configFilePaths = lib.concatStringsSep ":" (
[ "${config.xdg.configHome}/mopidy/mopidy.conf" ] ++ cfg.extraConfigFiles [ "${config.xdg.configHome}/mopidy/mopidy.conf" ] ++ cfg.extraConfigFiles
); );
@ -68,15 +75,15 @@ let
in in
{ {
meta.maintainers = [ hm.maintainers.foo-dogsquared ]; meta.maintainers = [ lib.hm.maintainers.foo-dogsquared ];
options.services.mopidy = { options.services.mopidy = {
enable = mkEnableOption "Mopidy music player daemon"; enable = lib.mkEnableOption "Mopidy music player daemon";
extensionPackages = mkOption { extensionPackages = mkOption {
type = with types; listOf package; type = with types; listOf package;
default = [ ]; default = [ ];
example = literalExpression "with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]"; example = lib.literalExpression "with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]";
description = '' description = ''
Mopidy extensions that should be loaded by the service. Mopidy extensions that should be loaded by the service.
''; '';
@ -85,7 +92,7 @@ in
settings = mkOption { settings = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
file = { file = {
media_dirs = [ media_dirs = [
@ -131,7 +138,9 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.mopidy" pkgs platforms.linux) ]; assertions = [
(lib.hm.assertions.assertPlatform "services.mopidy" pkgs lib.platforms.linux)
];
xdg.configFile."mopidy/mopidy.conf".source = xdg.configFile."mopidy/mopidy.conf".source =
settingsFormat.generate "mopidy-${config.home.username}" cfg.settings; settingsFormat.generate "mopidy-${config.home.username}" cfg.settings;

View file

@ -4,24 +4,21 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.mpd-discord-rpc; cfg = config.services.mpd-discord-rpc;
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
configFile = tomlFormat.generate "config.toml" cfg.settings; configFile = tomlFormat.generate "config.toml" cfg.settings;
in in
{ {
meta.maintainers = [ maintainers.kranzes ]; meta.maintainers = [ lib.maintainers.kranzes ];
options.services.mpd-discord-rpc = { options.services.mpd-discord-rpc = {
enable = mkEnableOption "the mpd-discord-rpc service"; enable = lib.mkEnableOption "the mpd-discord-rpc service";
settings = mkOption { settings = lib.mkOption {
type = tomlFormat.type; type = tomlFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
hosts = [ "localhost:6600" ]; hosts = [ "localhost:6600" ];
format = { format = {
@ -36,17 +33,17 @@ in
''; '';
}; };
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.mpd-discord-rpc; default = pkgs.mpd-discord-rpc;
defaultText = literalExpression "pkgs.mpd-discord-rpc"; defaultText = lib.literalExpression "pkgs.mpd-discord-rpc";
description = "mpd-discord-rpc package to use."; description = "mpd-discord-rpc package to use.";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.mpd-discord-rpc" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.mpd-discord-rpc" pkgs lib.platforms.linux)
]; ];
xdg.configFile."discord-rpc/config.toml".source = configFile; xdg.configFile."discord-rpc/config.toml".source = configFile;

View file

@ -4,18 +4,16 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkEnableOption mkOption types;
cfg = config.services.mpdris2; cfg = config.services.mpdris2;
toIni = generators.toINI { toIni = lib.generators.toINI {
mkKeyValue = mkKeyValue =
key: value: key: value:
let let
value' = if isBool value then (if value then "True" else "False") else toString value; value' = if lib.isBool value then (if value then "True" else "False") else toString value;
in in
"${key} = ${value'}"; "${key} = ${value'}";
}; };
@ -27,7 +25,7 @@ let
port = cfg.mpd.port; port = cfg.mpd.port;
music_dir = cfg.mpd.musicDirectory; music_dir = cfg.mpd.musicDirectory;
} }
// optionalAttrs (cfg.mpd.password != null) { // lib.optionalAttrs (cfg.mpd.password != null) {
password = cfg.mpd.password; password = cfg.mpd.password;
}; };
@ -39,7 +37,7 @@ let
in in
{ {
meta.maintainers = [ maintainers.pjones ]; meta.maintainers = [ lib.maintainers.pjones ];
options.services.mpdris2 = { options.services.mpdris2 = {
enable = mkEnableOption "mpDris2 the MPD to MPRIS2 bridge"; enable = mkEnableOption "mpDris2 the MPD to MPRIS2 bridge";
@ -49,7 +47,7 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.mpdris2; default = pkgs.mpdris2;
defaultText = literalExpression "pkgs.mpdris2"; defaultText = lib.literalExpression "pkgs.mpdris2";
description = "The mpDris2 package to use."; description = "The mpDris2 package to use.";
}; };
@ -90,7 +88,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.mpdris2" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.mpdris2" pkgs lib.platforms.linux)
]; ];

View file

@ -4,20 +4,17 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.mpris-proxy; cfg = config.services.mpris-proxy;
in in
{ {
meta.maintainers = [ maintainers.thibautmarty ]; meta.maintainers = [ lib.maintainers.thibautmarty ];
options.services.mpris-proxy.enable = mkEnableOption "a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players"; options.services.mpris-proxy.enable = lib.mkEnableOption "a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.mpris-proxy" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.mpris-proxy" pkgs lib.platforms.linux)
]; ];

View file

@ -4,13 +4,17 @@
pkgs, pkgs,
... ...
}: }:
with lib;
# Documentation was partially copied from the muchsync manual. # Documentation was partially copied from the muchsync manual.
# See http://www.muchsync.org/muchsync.html # See http://www.muchsync.org/muchsync.html
let let
inherit (lib)
escapeShellArg
mkOption
optional
types
;
cfg = config.services.muchsync; cfg = config.services.muchsync;
syncOptions = { syncOptions = {
options = { options = {
@ -132,13 +136,13 @@ let
in in
{ {
meta.maintainers = with maintainers; [ euxane ]; meta.maintainers = with lib.maintainers; [ euxane ];
options.services.muchsync = { options.services.muchsync = {
remotes = mkOption { remotes = mkOption {
type = with types; attrsOf (submodule syncOptions); type = with types; attrsOf (submodule syncOptions);
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
server = { server = {
frequency = "*:0/10"; frequency = "*:0/10";
@ -156,12 +160,13 @@ in
let let
mapRemotes = mapRemotes =
gen: gen:
with attrsets; lib.attrsets.mapAttrs' (
mapAttrs' (name: remoteCfg: nameValuePair "muchsync-${name}" (gen name remoteCfg)) cfg.remotes; name: remoteCfg: lib.attrsets.nameValuePair "muchsync-${name}" (gen name remoteCfg)
) cfg.remotes;
in in
mkIf (cfg.remotes != { }) { lib.mkIf (cfg.remotes != { }) {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.muchsync" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.muchsync" pkgs lib.platforms.linux)
{ {
assertion = config.programs.notmuch.enable; assertion = config.programs.notmuch.enable;
@ -184,7 +189,7 @@ in
''"NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"'' ''"NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"''
''"NMBGIT=${config.home.sessionVariables.NMBGIT}"'' ''"NMBGIT=${config.home.sessionVariables.NMBGIT}"''
]; ];
ExecStart = concatStringsSep " " ( ExecStart = lib.concatStringsSep " " (
[ "${pkgs.muchsync}/bin/muchsync" ] [ "${pkgs.muchsync}/bin/muchsync" ]
++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ] ++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ]
++ optional (!remoteCfg.upload) "--noup" ++ optional (!remoteCfg.upload) "--noup"

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.network-manager-applet; cfg = config.services.network-manager-applet;
@ -14,17 +11,17 @@ let
in in
{ {
meta.maintainers = [ meta.maintainers = [
maintainers.rycee lib.maintainers.rycee
maintainers.midirhee12 lib.maintainers.midirhee12
]; ];
options = { options = {
services.network-manager-applet = { services.network-manager-applet = {
enable = mkEnableOption "the Network Manager applet (nm-applet)"; enable = lib.mkEnableOption "the Network Manager applet (nm-applet)";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.network-manager-applet" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.network-manager-applet" pkgs lib.platforms.linux)
]; ];
@ -50,7 +47,7 @@ in
Service = { Service = {
ExecStart = toString ( ExecStart = toString (
[ "${pkgs.networkmanagerapplet}/bin/nm-applet" ] [ "${pkgs.networkmanagerapplet}/bin/nm-applet" ]
++ optional config.xsession.preferStatusNotifierItems "--indicator" ++ lib.optional config.xsession.preferStatusNotifierItems "--indicator"
); );
}; };
}; };

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.nextcloud-client; cfg = config.services.nextcloud-client;
@ -15,24 +12,24 @@ in
{ {
options = { options = {
services.nextcloud-client = { services.nextcloud-client = {
enable = mkEnableOption "Nextcloud Client"; enable = lib.mkEnableOption "Nextcloud Client";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.nextcloud-client; default = pkgs.nextcloud-client;
defaultText = literalExpression "pkgs.nextcloud-client"; defaultText = lib.literalExpression "pkgs.nextcloud-client";
description = "The package to use for the nextcloud client binary."; description = "The package to use for the nextcloud client binary.";
}; };
startInBackground = mkOption { startInBackground = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = "Whether to start the Nextcloud client in the background."; description = "Whether to start the Nextcloud client in the background.";
}; };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs lib.platforms.linux)
]; ];
@ -46,7 +43,8 @@ in
Service = { Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ]; Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart = "${cfg.package}/bin/nextcloud" + (optionalString cfg.startInBackground " --background"); ExecStart =
"${cfg.package}/bin/nextcloud" + (lib.optionalString cfg.startInBackground " --background");
}; };
Install = { Install = {

View file

@ -4,10 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.nix.gc; cfg = config.nix.gc;
darwinIntervals = [ darwinIntervals = [
"hourly" "hourly"
@ -73,7 +72,7 @@ let
if config.nix.enable && config.nix.package != null then config.nix.package else pkgs.nix; if config.nix.enable && config.nix.package != null then config.nix.package else pkgs.nix;
in in
{ {
meta.maintainers = [ maintainers.shivaraj-bh ]; meta.maintainers = [ lib.maintainers.shivaraj-bh ];
options = { options = {
nix.gc = { nix.gc = {
@ -137,54 +136,56 @@ in
}; };
}; };
config = lib.mkIf cfg.automatic (mkMerge [ config = lib.mkIf cfg.automatic (
(mkIf pkgs.stdenv.isLinux { lib.mkMerge [
systemd.user.services.nix-gc = { (lib.mkIf pkgs.stdenv.isLinux {
Unit = { systemd.user.services.nix-gc = {
Description = "Nix Garbage Collector"; Unit = {
Description = "Nix Garbage Collector";
};
Service = {
Type = "oneshot";
ExecStart = toString (
pkgs.writeShellScript "nix-gc" "exec ${nixPackage}/bin/nix-collect-garbage ${
lib.optionalString (cfg.options != null) cfg.options
}"
);
};
}; };
Service = { systemd.user.timers.nix-gc = {
Type = "oneshot"; Unit = {
ExecStart = toString ( Description = "Nix Garbage Collector";
pkgs.writeShellScript "nix-gc" "exec ${nixPackage}/bin/nix-collect-garbage ${ };
lib.optionalString (cfg.options != null) cfg.options Timer = {
}" OnCalendar = "${cfg.frequency}";
); RandomizedDelaySec = cfg.randomizedDelaySec;
Persistent = cfg.persistent;
Unit = "nix-gc.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
}; };
}; })
systemd.user.timers.nix-gc = {
Unit = {
Description = "Nix Garbage Collector";
};
Timer = {
OnCalendar = "${cfg.frequency}";
RandomizedDelaySec = cfg.randomizedDelaySec;
Persistent = cfg.persistent;
Unit = "nix-gc.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
})
(mkIf pkgs.stdenv.isDarwin { (lib.mkIf pkgs.stdenv.isDarwin {
assertions = [ assertions = [
{ {
assertion = elem cfg.frequency darwinIntervals; assertion = lib.elem cfg.frequency darwinIntervals;
message = "On Darwin nix.gc.frequency must be one of: ${toString darwinIntervals}."; message = "On Darwin nix.gc.frequency must be one of: ${toString darwinIntervals}.";
} }
]; ];
launchd.agents.nix-gc = { launchd.agents.nix-gc = {
enable = true; enable = true;
config = { config = {
ProgramArguments = [ ProgramArguments = [
"${nixPackage}/bin/nix-collect-garbage" "${nixPackage}/bin/nix-collect-garbage"
] ++ lib.optional (cfg.options != null) cfg.options; ] ++ lib.optional (cfg.options != null) cfg.options;
StartCalendarInterval = mkCalendarInterval cfg.frequency; StartCalendarInterval = mkCalendarInterval cfg.frequency;
};
}; };
}; })
}) ]
]); );
} }

View file

@ -4,25 +4,22 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.notify-osd; cfg = config.services.notify-osd;
in in
{ {
meta.maintainers = [ maintainers.imalison ]; meta.maintainers = [ lib.maintainers.imalison ];
options = { options = {
services.notify-osd = { services.notify-osd = {
enable = mkEnableOption "notify-osd"; enable = lib.mkEnableOption "notify-osd";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.notify-osd; default = pkgs.notify-osd;
defaultText = literalExpression "pkgs.notify-osd"; defaultText = lib.literalExpression "pkgs.notify-osd";
description = '' description = ''
Package containing the {command}`notify-osd` program. Package containing the {command}`notify-osd` program.
''; '';
@ -30,7 +27,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.notify-osd" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.notify-osd" pkgs lib.platforms.linux)
]; ];

View file

@ -4,10 +4,8 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkIf mkOption types;
cfg = config.services.ollama; cfg = config.services.ollama;
@ -19,13 +17,13 @@ let
in in
{ {
meta.maintainers = [ maintainers.terlar ]; meta.maintainers = [ lib.maintainers.terlar ];
options = { options = {
services.ollama = { services.ollama = {
enable = mkEnableOption "ollama server for local large language models"; enable = lib.mkEnableOption "ollama server for local large language models";
package = mkPackageOption pkgs "ollama" { }; package = lib.mkPackageOption pkgs "ollama" { };
host = mkOption { host = mkOption {
type = types.str; type = types.str;
@ -96,8 +94,8 @@ in
}; };
Service = { Service = {
ExecStart = "${getExe ollamaPackage} serve"; ExecStart = "${lib.getExe ollamaPackage} serve";
Environment = (mapAttrsToList (n: v: "${n}=${v}") cfg.environmentVariables) ++ [ Environment = (lib.mapAttrsToList (n: v: "${n}=${v}") cfg.environmentVariables) ++ [
"OLLAMA_HOST=${cfg.host}:${toString cfg.port}" "OLLAMA_HOST=${cfg.host}:${toString cfg.port}"
]; ];
}; };
@ -111,7 +109,7 @@ in
enable = true; enable = true;
config = { config = {
ProgramArguments = [ ProgramArguments = [
"${getExe ollamaPackage}" "${lib.getExe ollamaPackage}"
"serve" "serve"
]; ];
EnvironmentVariables = cfg.environmentVariables // { EnvironmentVariables = cfg.environmentVariables // {

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.opensnitch-ui; cfg = config.services.opensnitch-ui;
@ -14,15 +11,15 @@ let
in in
{ {
meta.maintainers = [ maintainers.onny ]; meta.maintainers = [ lib.maintainers.onny ];
options = { options = {
services.opensnitch-ui = { services.opensnitch-ui = {
enable = mkEnableOption "Opensnitch client"; enable = lib.mkEnableOption "Opensnitch client";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.opensnitch-ui" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.opensnitch-ui" pkgs lib.platforms.linux)
]; ];

View file

@ -4,20 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkIf mkOption types;
cfg = config.services.osmscout-server; cfg = config.services.osmscout-server;
in in
{ {
meta.maintainers = [ maintainers.Thra11 ]; meta.maintainers = [ lib.maintainers.Thra11 ];
options = { options = {
services.osmscout-server = { services.osmscout-server = {
enable = mkEnableOption "OSM Scout Server"; enable = lib.mkEnableOption "OSM Scout Server";
package = mkPackageOption pkgs "osmscout-server" { }; package = lib.mkPackageOption pkgs "osmscout-server" { };
network = { network = {
startWhenNeeded = mkOption { startWhenNeeded = mkOption {

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.owncloud-client; cfg = config.services.owncloud-client;
@ -15,15 +12,15 @@ in
{ {
options = { options = {
services.owncloud-client = { services.owncloud-client = {
enable = mkEnableOption "Owncloud Client"; enable = lib.mkEnableOption "Owncloud Client";
package = mkPackageOption pkgs "owncloud-client" { }; package = lib.mkPackageOption pkgs "owncloud-client" { };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.owncloud-client" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.owncloud-client" pkgs lib.platforms.linux)
]; ];
systemd.user.services.owncloud-client = { systemd.user.services.owncloud-client = {

View file

@ -4,33 +4,30 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.pantalaimon; cfg = config.services.pantalaimon;
iniFmt = pkgs.formats.ini { }; iniFmt = pkgs.formats.ini { };
in in
{ {
meta.maintainers = [ maintainers.jojosch ]; meta.maintainers = [ lib.maintainers.jojosch ];
options = { options = {
services.pantalaimon = { services.pantalaimon = {
enable = mkEnableOption "Pantalaimon, an E2EE aware proxy daemon for matrix clients"; enable = lib.mkEnableOption "Pantalaimon, an E2EE aware proxy daemon for matrix clients";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.pantalaimon; default = pkgs.pantalaimon;
defaultText = literalExpression "pkgs.pantalaimon"; defaultText = lib.literalExpression "pkgs.pantalaimon";
description = "Package providing the {command}`pantalaimon` executable to use."; description = "Package providing the {command}`pantalaimon` executable to use.";
}; };
settings = mkOption { settings = lib.mkOption {
type = iniFmt.type; type = iniFmt.type;
default = { }; default = { };
defaultText = literalExpression "{ }"; defaultText = lib.literalExpression "{ }";
example = literalExpression '' example = lib.literalExpression ''
{ {
Default = { Default = {
LogLevel = "Debug"; LogLevel = "Debug";
@ -55,7 +52,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.pantalaimon" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.pantalaimon" pkgs lib.platforms.linux)
]; ];

View file

@ -4,22 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.parcellite; cfg = config.services.parcellite;
in in
{ {
meta.maintainers = [ maintainers.gleber ]; meta.maintainers = [ lib.maintainers.gleber ];
options.services.parcellite = { options.services.parcellite = {
enable = mkEnableOption "Parcellite"; enable = lib.mkEnableOption "Parcellite";
extraOptions = mkOption { extraOptions = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
example = [ "--no-icon" ]; example = [ "--no-icon" ];
description = '' description = ''
@ -27,16 +24,16 @@ in
''; '';
}; };
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.parcellite; default = pkgs.parcellite;
defaultText = literalExpression "pkgs.parcellite"; defaultText = lib.literalExpression "pkgs.parcellite";
example = literalExpression "pkgs.clipit"; example = lib.literalExpression "pkgs.clipit";
description = "Parcellite derivation to use."; description = "Parcellite derivation to use.";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.parcellite" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.parcellite" pkgs lib.platforms.linux)
]; ];
@ -59,7 +56,7 @@ in
}; };
Service = { Service = {
ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${escapeShellArgs cfg.extraOptions}"; ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${lib.escapeShellArgs cfg.extraOptions}";
Restart = "on-abort"; Restart = "on-abort";
}; };
}; };

View file

@ -4,24 +4,23 @@
lib, lib,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.pass-secret-service; cfg = config.services.pass-secret-service;
busName = "org.freedesktop.secrets"; busName = "org.freedesktop.secrets";
in in
{ {
meta.maintainers = with maintainers; [ meta.maintainers = with lib.maintainers; [
cab404 cab404
cyntheticfox cyntheticfox
]; ];
options.services.pass-secret-service = { options.services.pass-secret-service = {
enable = mkEnableOption "Pass libsecret service"; enable = lib.mkEnableOption "Pass libsecret service";
package = mkPackageOption pkgs "pass-secret-service" { }; package = lib.mkPackageOption pkgs "pass-secret-service" { };
storePath = mkOption { storePath = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
@ -37,9 +36,9 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.pass-secret-service" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.pass-secret-service" pkgs lib.platforms.linux)
{ {
assertion = !config.services.gnome-keyring.enable; assertion = !config.services.gnome-keyring.enable;
message = '' message = ''
@ -64,7 +63,7 @@ in
Service = { Service = {
Type = "dbus"; Type = "dbus";
ExecStart = "${binPath} ${optionalString (cfg.storePath != null) "--path ${cfg.storePath}"}"; ExecStart = "${binPath} ${lib.optionalString (cfg.storePath != null) "--path ${cfg.storePath}"}";
BusName = busName; BusName = busName;
Environment = [ "GNUPGHOME=${config.programs.gpg.homedir}" ]; Environment = [ "GNUPGHOME=${config.programs.gpg.homedir}" ];
}; };

View file

@ -4,22 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.pasystray; cfg = config.services.pasystray;
in in
{ {
meta.maintainers = [ hm.maintainers.pltanton ]; meta.maintainers = [ lib.hm.maintainers.pltanton ];
options = { options = {
services.pasystray = { services.pasystray = {
enable = mkEnableOption "PulseAudio system tray"; enable = lib.mkEnableOption "PulseAudio system tray";
extraOptions = mkOption { extraOptions = lib.mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
description = '' description = ''
Extra command-line arguments to pass to {command}`pasystray`. Extra command-line arguments to pass to {command}`pasystray`.
@ -28,9 +25,9 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.pasystray" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.pasystray" pkgs lib.platforms.linux)
]; ];
systemd.user.services.pasystray = { systemd.user.services.pasystray = {
@ -51,13 +48,13 @@ in
Service = { Service = {
Environment = Environment =
let let
toolPaths = makeBinPath [ toolPaths = lib.makeBinPath [
pkgs.paprefs pkgs.paprefs
pkgs.pavucontrol pkgs.pavucontrol
]; ];
in in
[ "PATH=${toolPaths}" ]; [ "PATH=${toolPaths}" ];
ExecStart = escapeShellArgs ([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions); ExecStart = lib.escapeShellArgs ([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions);
}; };
}; };
}; };

View file

@ -4,21 +4,19 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.pbgopy; cfg = config.services.pbgopy;
package = pkgs.pbgopy; package = pkgs.pbgopy;
commandLine = concatStringsSep " " ( commandLine = lib.concatStringsSep " " (
[ [
"${package}/bin/pbgopy serve" "${package}/bin/pbgopy serve"
"--port ${toString cfg.port}" "--port ${toString cfg.port}"
"--ttl ${cfg.cache.ttl}" "--ttl ${cfg.cache.ttl}"
] ]
++ optional (cfg.httpAuth != null) "--basic-auth ${escapeShellArg cfg.httpAuth}" ++ lib.optional (cfg.httpAuth != null) "--basic-auth ${lib.escapeShellArg cfg.httpAuth}"
); );
in in
@ -26,7 +24,7 @@ in
meta.maintainers = [ ]; meta.maintainers = [ ];
options.services.pbgopy = { options.services.pbgopy = {
enable = mkEnableOption "pbgopy"; enable = lib.mkEnableOption "pbgopy";
port = mkOption { port = mkOption {
type = types.port; type = types.port;
@ -57,7 +55,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.pbgopy" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.pbgopy" pkgs lib.platforms.linux)
]; ];

View file

@ -10,10 +10,8 @@ let
inherit (builtins) inherit (builtins)
elemAt elemAt
isAttrs isAttrs
isBool
length length
mapAttrs mapAttrs
toJSON
; ;
inherit (lib) inherit (lib)
boolToString boolToString
@ -28,9 +26,7 @@ let
mkDefault mkDefault
mkIf mkIf
mkOption mkOption
optional
types types
warn
getExe getExe
; ;

View file

@ -4,34 +4,31 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.plan9port; cfg = config.services.plan9port;
in in
{ {
meta.maintainers = [ maintainers.ehmry ]; meta.maintainers = [ lib.maintainers.ehmry ];
options.services.plan9port = { options.services.plan9port = {
fontsrv.enable = mkEnableOption "the Plan 9 file system access to host fonts"; fontsrv.enable = lib.mkEnableOption "the Plan 9 file system access to host fonts";
plumber.enable = mkEnableOption "the Plan 9 file system for interprocess messaging"; plumber.enable = lib.mkEnableOption "the Plan 9 file system for interprocess messaging";
}; };
config = mkIf (cfg.fontsrv.enable || cfg.plumber.enable) { config = lib.mkIf (cfg.fontsrv.enable || cfg.plumber.enable) {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.plan9port" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.plan9port" pkgs lib.platforms.linux)
]; ];
systemd.user.services.fontsrv = mkIf cfg.fontsrv.enable { systemd.user.services.fontsrv = lib.mkIf cfg.fontsrv.enable {
Unit.Description = "the Plan 9 file system access to host fonts"; Unit.Description = "the Plan 9 file system access to host fonts";
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 fontsrv"; Service.ExecStart = "${pkgs.plan9port}/bin/9 fontsrv";
}; };
systemd.user.services.plumber = mkIf cfg.plumber.enable { systemd.user.services.plumber = lib.mkIf cfg.plumber.enable {
Unit.Description = "file system for interprocess messaging"; Unit.Description = "file system for interprocess messaging";
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 plumber -f"; Service.ExecStart = "${pkgs.plan9port}/bin/9 plumber -f";

View file

@ -4,29 +4,26 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.playerctld; cfg = config.services.playerctld;
in in
{ {
meta.maintainers = [ hm.maintainers.fendse ]; meta.maintainers = [ lib.hm.maintainers.fendse ];
options.services.playerctld = { options.services.playerctld = {
enable = mkEnableOption "playerctld daemon"; enable = lib.mkEnableOption "playerctld daemon";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.playerctl; default = pkgs.playerctl;
defaultText = literalExpression "pkgs.playerctl"; defaultText = lib.literalExpression "pkgs.playerctl";
description = "The playerctl package to use."; description = "The playerctl package to use.";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.playerctld" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.playerctld" pkgs lib.platforms.linux)
]; ];

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
jsonFormat = pkgs.formats.json { }; jsonFormat = pkgs.formats.json { };
@ -14,23 +11,23 @@ let
in in
{ {
meta.maintainers = [ maintainers.starcraft66 ]; meta.maintainers = [ lib.maintainers.starcraft66 ];
options = { options = {
services.plex-mpv-shim = { services.plex-mpv-shim = {
enable = mkEnableOption "Plex mpv shim"; enable = lib.mkEnableOption "Plex mpv shim";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.plex-mpv-shim; default = pkgs.plex-mpv-shim;
defaultText = literalExpression "pkgs.plex-mpv-shim"; defaultText = lib.literalExpression "pkgs.plex-mpv-shim";
description = "The package to use for the Plex mpv shim."; description = "The package to use for the Plex mpv shim.";
}; };
settings = mkOption { settings = lib.mkOption {
type = jsonFormat.type; type = jsonFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
adaptive_transcode = false; adaptive_transcode = false;
allow_http = false; allow_http = false;
@ -51,12 +48,12 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.plex-mpv-shim" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.plex-mpv-shim" pkgs lib.platforms.linux)
]; ];
xdg.configFile."plex-mpv-shim/conf.json" = mkIf (cfg.settings != { }) { xdg.configFile."plex-mpv-shim/conf.json" = lib.mkIf (cfg.settings != { }) {
source = jsonFormat.generate "conf.json" cfg.settings; source = jsonFormat.generate "conf.json" cfg.settings;
}; };

View file

@ -4,8 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.podman; cfg = config.services.podman;
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; }; podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
@ -27,7 +28,7 @@ let
TLSVerify = buildDef.tlsVerify; TLSVerify = buildDef.tlsVerify;
}; };
Install = { Install = {
WantedBy = optionals buildDef.autoStart [ WantedBy = lib.optionals buildDef.autoStart [
"default.target" "default.target"
"multi-user.target" "multi-user.target"
]; ];
@ -93,7 +94,7 @@ let
environment = mkOption { environment = mkOption {
type = podman-lib.primitiveAttrs; type = podman-lib.primitiveAttrs;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
VAR1 = "0:100"; VAR1 = "0:100";
VAR2 = true; VAR2 = true;
@ -106,7 +107,7 @@ let
extraConfig = mkOption { extraConfig = mkOption {
type = podman-lib.extraConfigType; type = podman-lib.extraConfigType;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
Build = { Build = {
Arch = "aarch64"; Arch = "aarch64";
@ -128,7 +129,7 @@ let
file = mkOption { file = mkOption {
type = types.str; type = types.str;
example = literalExpression '' example = lib.literalExpression ''
`"xdg.configFile."containerfiles/my-img/Containerfile"` `"xdg.configFile."containerfiles/my-img/Containerfile"`
or or
`"https://github.com/.../my-img/Containerfile"` `"https://github.com/.../my-img/Containerfile"`
@ -179,11 +180,11 @@ in
config = config =
let let
buildQuadlets = mapAttrsToList toQuadletInternal cfg.builds; buildQuadlets = lib.mapAttrsToList toQuadletInternal cfg.builds;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
services.podman.internal.quadletDefinitions = buildQuadlets; services.podman.internal.quadletDefinitions = buildQuadlets;
assertions = flatten (map (build: build.assertions) buildQuadlets); assertions = lib.flatten (map (build: build.assertions) buildQuadlets);
xdg.configFile."podman/images.manifest".text = podman-lib.generateManifestText buildQuadlets; xdg.configFile."podman/images.manifest".text = podman-lib.generateManifestText buildQuadlets;
}; };

View file

@ -4,10 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.podman; cfg = config.services.podman;
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; }; podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
@ -25,11 +24,14 @@ let
dependencyBySuffix = dependencyBySuffix =
type: value: type: value:
if (hasInfix ".${type}" value) then if (lib.hasInfix ".${type}" value) then
let let
name = extractQuadletReference type value; name = extractQuadletReference type value;
in in
if (hasAttr name cfg.internal.builtQuadlets) then [ (cfg.internal.builtQuadlets.${name}) ] else [ ] if (lib.hasAttr name cfg.internal.builtQuadlets) then
[ (cfg.internal.builtQuadlets.${name}) ]
else
[ ]
else else
[ ]; [ ];
@ -55,25 +57,29 @@ let
builtins.concatLists (map (checkQuadletReference types) value) builtins.concatLists (map (checkQuadletReference types) value)
else else
let let
type = findFirst (t: hasInfix ".${t}" value) null types; type = lib.findFirst (t: lib.hasInfix ".${t}" value) null types;
in in
if (type != null) then if (type != null) then
let let
quadletName = extractQuadletReference type value; quadletName = extractQuadletReference type value;
quadletsOfType = filterAttrs (n: v: v.quadletData.resourceType == type) cfg.internal.builtQuadlets; quadletsOfType = lib.filterAttrs (
n: v: v.quadletData.resourceType == type
) cfg.internal.builtQuadlets;
in in
if (hasAttr quadletName quadletsOfType) then if (lib.hasAttr quadletName quadletsOfType) then
[ [
(replaceStrings [ quadletName ] [ "podman-${quadletName}" ] value) (lib.replaceStrings [ quadletName ] [ "podman-${quadletName}" ] value)
] ]
else else
[ value ] [ value ]
else if ((hasInfix "/nix/store" value) == false && hasAttr value cfg.internal.builtQuadlets) then else if
((lib.hasInfix "/nix/store" value) == false && lib.hasAttr value cfg.internal.builtQuadlets)
then
lib.warn '' lib.warn ''
A value for Podman container '${name}' might use a reference to another quadlet: ${value}. A value for Podman container '${name}' might use a reference to another quadlet: ${value}.
Append the type '.${ Append the type '.${
cfg.internal.builtQuadlets.${value}.quadletData.resourceType cfg.internal.builtQuadlets.${value}.quadletData.resourceType
}' to '${baseName value}' if this is intended. }' to '${lib.baseName value}' if this is intended.
'' [ value ] '' [ value ]
else else
[ value ]; [ value ];
@ -104,7 +110,7 @@ let
Volume = checkQuadletReference [ "volume" ] containerDef.volumes; Volume = checkQuadletReference [ "volume" ] containerDef.volumes;
}; };
Install = { Install = {
WantedBy = optionals containerDef.autoStart [ WantedBy = lib.optionals containerDef.autoStart [
"default.target" "default.target"
"multi-user.target" "multi-user.target"
]; ];
@ -226,7 +232,7 @@ let
environment = mkOption { environment = mkOption {
type = podman-lib.primitiveAttrs; type = podman-lib.primitiveAttrs;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
VAR1 = "0:100"; VAR1 = "0:100";
VAR2 = true; VAR2 = true;
@ -268,7 +274,7 @@ let
extraConfig = mkOption { extraConfig = mkOption {
type = podman-lib.extraConfigType; type = podman-lib.extraConfigType;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
Container = { Container = {
User = 1000; User = 1000;
@ -320,8 +326,8 @@ let
network = mkOption { network = mkOption {
type = with types; either str (listOf str); type = with types; either str (listOf str);
default = [ ]; default = [ ];
apply = value: if isString value then [ value ] else value; apply = value: if lib.isString value then [ value ] else value;
example = literalMD '' example = lib.literalMD ''
`"host"` `"host"`
or or
`"bridge_network_1"` `"bridge_network_1"`
@ -392,11 +398,11 @@ in
config = config =
let let
containerQuadlets = mapAttrsToList toQuadletInternal cfg.containers; containerQuadlets = lib.mapAttrsToList toQuadletInternal cfg.containers;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
services.podman.internal.quadletDefinitions = containerQuadlets; services.podman.internal.quadletDefinitions = containerQuadlets;
assertions = flatten (map (container: container.assertions) containerQuadlets); assertions = lib.flatten (map (container: container.assertions) containerQuadlets);
# manifest file # manifest file
xdg.configFile."podman/containers.manifest".text = xdg.configFile."podman/containers.manifest".text =

View file

@ -4,8 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.podman; cfg = config.services.podman;
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; }; podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
@ -29,7 +30,7 @@ let
TLSVerify = imageDef.tlsVerify; TLSVerify = imageDef.tlsVerify;
}; };
Install = { Install = {
WantedBy = optionals imageDef.autoStart [ WantedBy = lib.optionals imageDef.autoStart [
"default.target" "default.target"
"multi-user.target" "multi-user.target"
]; ];
@ -99,7 +100,7 @@ let
extraConfig = mkOption { extraConfig = mkOption {
type = podman-lib.extraConfigType; type = podman-lib.extraConfigType;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
Image = { Image = {
ContainersConfModule = "/etc/nvd.conf"; ContainersConfModule = "/etc/nvd.conf";
@ -162,10 +163,10 @@ in
config = config =
let let
imageQuadlets = mapAttrsToList toQuadletInternal cfg.images; imageQuadlets = lib.mapAttrsToList toQuadletInternal cfg.images;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
services.podman.internal.quadletDefinitions = imageQuadlets; services.podman.internal.quadletDefinitions = imageQuadlets;
assertions = flatten (map (image: image.assertions) imageQuadlets); assertions = lib.flatten (map (image: image.assertions) imageQuadlets);
}; };
} }

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.podman; cfg = config.services.podman;
@ -25,7 +22,7 @@ let
unpackPhase = '' unpackPhase = ''
mkdir -p $out/quadlets mkdir -p $out/quadlets
${concatStringsSep "\n" ( ${lib.concatStringsSep "\n" (
map ( map (
v: v:
"echo 'linking ${v.quadletData.serviceName}.${v.quadletData.resourceType}'; ln -s ${v.out}/quadlets/${v.quadletData.serviceName}.${v.quadletData.resourceType} $out/quadlets" "echo 'linking ${v.quadletData.serviceName}.${v.quadletData.resourceType}'; ln -s ${v.out}/quadlets/${v.quadletData.serviceName}.${v.quadletData.resourceType} $out/quadlets"
@ -46,7 +43,7 @@ let
''; '';
passthru = { passthru = {
outPath = self.out; outPath = lib.self.out;
quadletData = quadlet; quadletData = quadlet;
}; };
}; };
@ -76,9 +73,9 @@ let
} }
]; ];
in in
flatten (map (name: processEntry name (getAttr name entries)) (attrNames entries)); lib.flatten (map (name: processEntry name (lib.getAttr name entries)) (lib.attrNames entries));
allUnitFiles = concatMap ( allUnitFiles = lib.concatMap (
builtQuadlet: accumulateUnitFiles "" "${builtQuadlet.outPath}/units" builtQuadlet.quadletData builtQuadlet: accumulateUnitFiles "" "${builtQuadlet.outPath}/units" builtQuadlet.quadletData
) builtQuadlets; ) builtQuadlets;
@ -86,7 +83,7 @@ let
# merge from multiple sources. so we link each file explicitly, which is fine for all unique files # merge from multiple sources. so we link each file explicitly, which is fine for all unique files
generateSystemdFileLinks = generateSystemdFileLinks =
files: files:
listToAttrs ( lib.listToAttrs (
map (unitFile: { map (unitFile: {
name = "${config.xdg.configHome}/systemd/user/${unitFile.key}"; name = "${config.xdg.configHome}/systemd/user/${unitFile.key}";
value = { value = {
@ -99,7 +96,7 @@ in
{ {
imports = [ ./options.nix ]; imports = [ ./options.nix ];
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.file = generateSystemdFileLinks allUnitFiles; home.file = generateSystemdFileLinks allUnitFiles;
# if the length of builtQuadlets is 0, then we don't need register the activation script # if the length of builtQuadlets is 0, then we don't need register the activation script
@ -107,10 +104,10 @@ in
lib.hm.dag.entryAfter [ "reloadSystemd" ] activationCleanupScript lib.hm.dag.entryAfter [ "reloadSystemd" ] activationCleanupScript
); );
services.podman.internal.builtQuadlets = listToAttrs ( services.podman.internal.builtQuadlets = lib.listToAttrs (
map (pkg: { map (pkg: {
name = name =
(removePrefix "podman-" pkg.passthru.quadletData.serviceName) (lib.removePrefix "podman-" pkg.passthru.quadletData.serviceName)
+ "." + "."
+ pkg.passthru.quadletData.resourceType; + pkg.passthru.quadletData.resourceType;
value = pkg; value = pkg;

View file

@ -4,10 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.podman; cfg = config.services.podman;
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; }; podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
@ -44,7 +43,7 @@ let
PATH = ( PATH = (
builtins.concatStringsSep ":" [ builtins.concatStringsSep ":" [
"${podman-lib.newuidmapPaths}" "${podman-lib.newuidmapPaths}"
"${makeBinPath [ "${lib.makeBinPath [
pkgs.su pkgs.su
pkgs.coreutils pkgs.coreutils
]}" ]}"
@ -112,7 +111,7 @@ let
extraConfig = mkOption { extraConfig = mkOption {
type = podman-lib.extraConfigType; type = podman-lib.extraConfigType;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
Network = { Network = {
ContainerConfModule = "/etc/nvd.conf"; ContainerConfModule = "/etc/nvd.conf";
@ -179,11 +178,11 @@ in
config = config =
let let
networkQuadlets = mapAttrsToList toQuadletInternal cfg.networks; networkQuadlets = lib.mapAttrsToList toQuadletInternal cfg.networks;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
services.podman.internal.quadletDefinitions = networkQuadlets; services.podman.internal.quadletDefinitions = networkQuadlets;
assertions = flatten (map (network: network.assertions) networkQuadlets); assertions = lib.flatten (map (network: network.assertions) networkQuadlets);
xdg.configFile."podman/networks.manifest".text = podman-lib.generateManifestText networkQuadlets; xdg.configFile."podman/networks.manifest".text = podman-lib.generateManifestText networkQuadlets;
}; };

View file

@ -4,8 +4,14 @@
config, config,
... ...
}: }:
with lib;
let let
inherit (lib)
concatStringsSep
isList
mapAttrsToList
types
;
normalizeKeyValue = normalizeKeyValue =
k: v: k: v:
let let
@ -32,7 +38,7 @@ let
path path
]); ]);
toQuadletIni = generators.toINI { toQuadletIni = lib.generators.toINI {
listsAsDuplicateKeys = true; listsAsDuplicateKeys = true;
mkKeyValue = normalizeKeyValue; mkKeyValue = normalizeKeyValue;
}; };
@ -40,7 +46,7 @@ let
# meant for ini. favours b when two values are unmergeable # meant for ini. favours b when two values are unmergeable
deepMerge = deepMerge =
a: b: a: b:
foldl' ( lib.foldl' (
result: key: result: key:
let let
aVal = if builtins.hasAttr key a then a.${key} else null; aVal = if builtins.hasAttr key a then a.${key} else null;
@ -53,7 +59,7 @@ let
&& builtins.length list > 0 && builtins.length list > 0
&& builtins.typeOf (builtins.head list) == builtins.typeOf val; && builtins.typeOf (builtins.head list) == builtins.typeOf val;
in in
if isAttrs aVal && isAttrs bVal then if lib.isAttrs aVal && lib.isAttrs bVal then
result // { ${key} = deepMerge aVal bVal; } result // { ${key} = deepMerge aVal bVal; }
else if isList aVal && isList bVal then else if isList aVal && isList bVal then
result // { ${key} = aVal ++ bVal; } result // { ${key} = aVal ++ bVal; }
@ -102,7 +108,7 @@ in
buildSectionAsserts = buildSectionAsserts =
section: attrs: section: attrs:
if builtins.hasAttr section configRules then if builtins.hasAttr section configRules then
flatten ( lib.flatten (
mapAttrsToList ( mapAttrsToList (
attrName: attrValue: attrName: attrValue:
if builtins.hasAttr attrName configRules.${section} then if builtins.hasAttr attrName configRules.${section} then
@ -126,7 +132,7 @@ in
let let
imageTags = (extraConfig.Build or { }).ImageTag or [ ]; imageTags = (extraConfig.Build or { }).ImageTag or [ ];
containsRequiredTag = builtins.elem "homemanager/${quadletName}" imageTags; containsRequiredTag = builtins.elem "homemanager/${quadletName}" imageTags;
imageTagsStr = concatMapStringsSep ''" "'' toString imageTags; imageTagsStr = lib.concatMapStringsSep ''" "'' toString imageTags;
in in
[ [
{ {
@ -136,10 +142,12 @@ in
]; ];
# Flatten assertions from all sections in `extraConfig`. # Flatten assertions from all sections in `extraConfig`.
in in
flatten (concatLists [ lib.flatten (
(mapAttrsToList buildSectionAsserts extraConfig) lib.concatLists [
(checkImageTag extraConfig) (mapAttrsToList buildSectionAsserts extraConfig)
]); (checkImageTag extraConfig)
]
);
extraConfigType = extraConfigType =
with types; with types;
@ -156,9 +164,9 @@ in
quadlets: quadlets:
let let
# create a list of all unique quadlet.resourceType in quadlets # create a list of all unique quadlet.resourceType in quadlets
quadletTypes = unique (map (quadlet: quadlet.resourceType) quadlets); quadletTypes = lib.unique (map (quadlet: quadlet.resourceType) quadlets);
# if quadletTypes is > 1, then all quadlets are not the same type # if quadletTypes is > 1, then all quadlets are not the same type
allQuadletsSameType = length quadletTypes <= 1; allQuadletsSameType = lib.length quadletTypes <= 1;
# ensures the service name is formatted correctly to be easily read # ensures the service name is formatted correctly to be easily read
# by the activation script and matches `podman <resource> ls` output # by the activation script and matches `podman <resource> ls` output
@ -200,8 +208,8 @@ in
removeBlankLines = removeBlankLines =
text: text:
let let
lines = splitString "\n" text; lines = lib.splitString "\n" text;
nonEmptyLines = filter (line: line != "") lines; nonEmptyLines = lib.filter (line: line != "") lines;
in in
concatStringsSep "\n" nonEmptyLines; concatStringsSep "\n" nonEmptyLines;

View file

@ -4,23 +4,20 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.podman; cfg = config.services.podman;
in in
{ {
options.services.podman = { options.services.podman = {
autoUpdate = { autoUpdate = {
enable = mkOption { enable = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = "Automatically update the podman images."; description = "Automatically update the podman images.";
}; };
onCalendar = mkOption { onCalendar = lib.mkOption {
type = types.str; type = lib.types.str;
default = "Sun *-*-* 00:00"; default = "Sun *-*-* 00:00";
description = '' description = ''
The systemd `OnCalendar` expression for the update. See The systemd `OnCalendar` expression for the update. See
@ -30,63 +27,65 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = lib.mkIf cfg.enable (
(mkIf cfg.autoUpdate.enable { lib.mkMerge [
systemd.user.services."podman-auto-update" = { (lib.mkIf cfg.autoUpdate.enable {
Unit = { systemd.user.services."podman-auto-update" = {
Description = "Podman auto-update service"; Unit = {
Documentation = "man:podman-auto-update(1)"; Description = "Podman auto-update service";
Wants = [ "network-online.target" ]; Documentation = "man:podman-auto-update(1)";
After = [ "network-online.target" ]; Wants = [ "network-online.target" ];
}; After = [ "network-online.target" ];
};
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
Environment = "PATH=${ Environment = "PATH=${
builtins.concatStringsSep ":" [ builtins.concatStringsSep ":" [
"/run/wrappers/bin" "/run/wrappers/bin"
"/run/current-system/sw/bin" "/run/current-system/sw/bin"
"${config.home.homeDirectory}/.nix-profile/bin" "${config.home.homeDirectory}/.nix-profile/bin"
]
}";
ExecStart = "${cfg.package}/bin/podman auto-update";
ExecStartPost = "${cfg.package}/bin/podman image prune -f";
TimeoutStartSec = "300s";
TimeoutStopSec = "10s";
};
};
systemd.user.timers."podman-auto-update" = {
Unit = {
Description = "Podman auto-update timer";
};
Timer = {
OnCalendar = cfg.autoUpdate.onCalendar;
RandomizedDelaySec = 300;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
})
({
xdg.configFile."systemd/user/podman-user-wait-network-online.service.d/50-exec-search-path.conf".text =
''
[Service]
ExecSearchPath=${
makeBinPath (
with pkgs;
[
bashInteractive
systemd
coreutils
] ]
) }";
}:/bin ExecStart = "${cfg.package}/bin/podman auto-update";
''; ExecStartPost = "${cfg.package}/bin/podman image prune -f";
}) TimeoutStartSec = "300s";
]); TimeoutStopSec = "10s";
};
};
systemd.user.timers."podman-auto-update" = {
Unit = {
Description = "Podman auto-update timer";
};
Timer = {
OnCalendar = cfg.autoUpdate.onCalendar;
RandomizedDelaySec = 300;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
})
{
xdg.configFile."systemd/user/podman-user-wait-network-online.service.d/50-exec-search-path.conf".text =
''
[Service]
ExecSearchPath=${
lib.makeBinPath (
with pkgs;
[
bashInteractive
systemd
coreutils
]
)
}:/bin
'';
}
]
);
} }

View file

@ -4,10 +4,9 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.podman; cfg = config.services.podman;
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; }; podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
@ -17,7 +16,7 @@ let
let let
quadlet = podman-lib.deepMerge { quadlet = podman-lib.deepMerge {
Install = { Install = {
WantedBy = optionals volumeDef.autoStart [ WantedBy = lib.optionals volumeDef.autoStart [
"default.target" "default.target"
"multi-user.target" "multi-user.target"
]; ];
@ -27,7 +26,7 @@ let
PATH = ( PATH = (
builtins.concatStringsSep ":" [ builtins.concatStringsSep ":" [
"${podman-lib.newuidmapPaths}" "${podman-lib.newuidmapPaths}"
"${makeBinPath [ "${lib.makeBinPath [
pkgs.su pkgs.su
pkgs.coreutils pkgs.coreutils
]}" ]}"
@ -117,7 +116,7 @@ let
extraConfig = mkOption { extraConfig = mkOption {
type = podman-lib.extraConfigType; type = podman-lib.extraConfigType;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
Volume = { Volume = {
ContainerConfModule = "/etc/nvd.conf"; ContainerConfModule = "/etc/nvd.conf";
@ -191,11 +190,11 @@ in
config = config =
let let
volumeQuadlets = mapAttrsToList toQuadletInternal cfg.volumes; volumeQuadlets = lib.mapAttrsToList toQuadletInternal cfg.volumes;
in in
mkIf cfg.enable { lib.mkIf cfg.enable {
services.podman.internal.quadletDefinitions = volumeQuadlets; services.podman.internal.quadletDefinitions = volumeQuadlets;
assertions = flatten (map (volume: volume.assertions) volumeQuadlets); assertions = lib.flatten (map (volume: volume.assertions) volumeQuadlets);
xdg.configFile."podman/volumes.manifest".text = podman-lib.generateManifestText volumeQuadlets; xdg.configFile."podman/volumes.manifest".text = podman-lib.generateManifestText volumeQuadlets;
}; };

View file

@ -5,10 +5,13 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib)
concatLists
mkIf
mkOption
types
;
cfg = config.services.polybar; cfg = config.services.polybar;
opt = options.services.polybar; opt = options.services.polybar;
@ -24,8 +27,8 @@ let
# foo-0 = "a"; # foo-0 = "a";
# foo-1 = "b"; # foo-1 = "b";
# } # }
if isList val then if lib.isList val then
concatLists (imap0 (i: convertPolybarKeyVal "${key}-${toString i}") val) concatLists (lib.imap0 (i: convertPolybarKeyVal "${key}-${toString i}") val)
# Convert { # Convert {
# foo.text = "a"; # foo.text = "a";
# foo.font = 1; # foo.font = 1;
@ -33,29 +36,29 @@ let
# foo = "a"; # foo = "a";
# foo-font = 1; # foo-font = 1;
# } # }
else if isAttrs val && !lib.isDerivation val then else if lib.isAttrs val && !lib.isDerivation val then
concatLists ( concatLists (
mapAttrsToList (k: convertPolybarKeyVal (if k == "text" then key else "${key}-${k}")) val lib.mapAttrsToList (k: convertPolybarKeyVal (if k == "text" then key else "${key}-${k}")) val
) )
# Base case # Base case
else else
[ (nameValuePair key val) ]; [ (lib.nameValuePair key val) ];
convertPolybarSection = convertPolybarSection =
_: attrs: listToAttrs (concatLists (mapAttrsToList convertPolybarKeyVal attrs)); _: attrs: lib.listToAttrs (concatLists (lib.mapAttrsToList convertPolybarKeyVal attrs));
# Converts an attrset to INI text, quoting values as expected by polybar. # Converts an attrset to INI text, quoting values as expected by polybar.
# This does no more fancy conversion. # This does no more fancy conversion.
toPolybarIni = generators.toINI { toPolybarIni = lib.generators.toINI {
mkKeyValue = mkKeyValue =
key: value: key: value:
let let
quoted = v: if hasPrefix " " v || hasSuffix " " v then ''"${v}"'' else v; quoted = v: if lib.hasPrefix " " v || lib.hasSuffix " " v then ''"${v}"'' else v;
value' = value' =
if isBool value then if lib.isBool value then
(if value then "true" else "false") (if value then "true" else "false")
else if (isString value && key != "include-file") then else if (lib.isString value && key != "include-file") then
quoted value quoted value
else else
toString value; toString value;
@ -73,7 +76,7 @@ let
if isDeclarativeConfig then if isDeclarativeConfig then
pkgs.writeText "polybar.conf" '' pkgs.writeText "polybar.conf" ''
${toPolybarIni cfg.config} ${toPolybarIni cfg.config}
${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} ${toPolybarIni (lib.mapAttrs convertPolybarSection cfg.settings)}
${cfg.extraConfig} ${cfg.extraConfig}
'' ''
else else
@ -83,7 +86,7 @@ in
{ {
options = { options = {
services.polybar = { services.polybar = {
enable = mkEnableOption "Polybar status bar"; enable = lib.mkEnableOption "Polybar status bar";
package = lib.mkPackageOption pkgs "polybar" { package = lib.mkPackageOption pkgs "polybar" {
example = '' example = ''
@ -108,7 +111,7 @@ in
See also {option}`services.polybar.settings` for a more nix-friendly format. See also {option}`services.polybar.settings` for a more nix-friendly format.
''; '';
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
"bar/top" = { "bar/top" = {
monitor = "\''${env:MONITOR:eDP1}"; monitor = "\''${env:MONITOR:eDP1}";
@ -177,7 +180,7 @@ in
``` ```
''; '';
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
"module/volume" = { "module/volume" = {
type = "internal/pulseaudio"; type = "internal/pulseaudio";
@ -225,7 +228,7 @@ in
(lib.hm.assertions.assertPlatform "services.polybar" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.polybar" pkgs lib.platforms.linux)
]; ];
meta.maintainers = with maintainers; [ h7x4 ]; meta.maintainers = with lib.maintainers; [ h7x4 ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile."polybar/config.ini" = mkIf (configFile != null) { source = configFile; }; xdg.configFile."polybar/config.ini" = mkIf (configFile != null) { source = configFile; };

View file

@ -4,35 +4,34 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
inherit (lib) types;
inherit (lib.strings) toJSON; inherit (lib.strings) toJSON;
cfg = config.services.poweralertd; cfg = config.services.poweralertd;
escapeSystemdExecArg = escapeSystemdExecArg =
arg: arg:
let let
s = s =
if isPath arg then if lib.isPath arg then
"${arg}" "${arg}"
else if isString arg then else if lib.isString arg then
arg arg
else if isInt arg || isFloat arg || isDerivation arg then else if lib.isInt arg || lib.isFloat arg || lib.isDerivation arg then
toString arg toString arg
else else
throw "escapeSystemdExecArg only allows strings, paths, numbers and derivations"; throw "escapeSystemdExecArg only allows strings, paths, numbers and derivations";
in in
replaceStrings [ "%" "$" ] [ "%%" "$$" ] (toJSON s); lib.replaceStrings [ "%" "$" ] [ "%%" "$$" ] (toJSON s);
escapeSystemdExecArgs = concatMapStringsSep " " escapeSystemdExecArg; escapeSystemdExecArgs = lib.concatMapStringsSep " " escapeSystemdExecArg;
in in
{ {
meta.maintainers = [ maintainers.thibautmarty ]; meta.maintainers = [ lib.maintainers.thibautmarty ];
options.services.poweralertd = { options.services.poweralertd = {
enable = mkEnableOption "the Upower-powered power alertd"; enable = lib.mkEnableOption "the Upower-powered power alertd";
extraArgs = mkOption { extraArgs = lib.mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ ]; default = [ ];
example = [ example = [
@ -45,7 +44,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.poweralertd" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.poweralertd" pkgs lib.platforms.linux)
]; ];

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.pueue; cfg = config.services.pueue;
@ -15,17 +12,17 @@ let
in in
{ {
meta.maintainers = [ maintainers.AndersonTorres ]; meta.maintainers = [ lib.maintainers.AndersonTorres ];
options.services.pueue = { options.services.pueue = {
enable = mkEnableOption "Pueue, CLI process scheduler and manager"; enable = lib.mkEnableOption "Pueue, CLI process scheduler and manager";
package = mkPackageOption pkgs "pueue" { nullable = true; }; package = lib.mkPackageOption pkgs "pueue" { nullable = true; };
settings = mkOption { settings = lib.mkOption {
type = yamlFormat.type; type = yamlFormat.type;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
daemon = { daemon = {
default_parallel_tasks = 2; default_parallel_tasks = 2;
@ -39,8 +36,10 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ]; assertions = [
(lib.hm.assertions.assertPlatform "services.pueue" pkgs lib.platforms.linux)
];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];

View file

@ -4,21 +4,18 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.services.pulseeffects; cfg = config.services.pulseeffects;
presetOpts = optionalString (cfg.preset != "") "--load-preset ${cfg.preset}"; presetOpts = lib.optionalString (cfg.preset != "") "--load-preset ${cfg.preset}";
in in
{ {
meta.maintainers = [ hm.maintainers.jonringer ]; meta.maintainers = [ lib.hm.maintainers.jonringer ];
options.services.pulseeffects = { options.services.pulseeffects = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
Pulseeffects daemon Pulseeffects daemon
Note, it is necessary to add Note, it is necessary to add
```nix ```nix
@ -26,15 +23,15 @@ in
``` ```
to your system configuration for the daemon to work correctly''; to your system configuration for the daemon to work correctly'';
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.pulseeffects-legacy; default = pkgs.pulseeffects-legacy;
defaultText = literalExpression "pkgs.pulseeffects-legacy"; defaultText = lib.literalExpression "pkgs.pulseeffects-legacy";
description = "Pulseeffects package to use."; description = "Pulseeffects package to use.";
}; };
preset = mkOption { preset = lib.mkOption {
type = types.str; type = lib.types.str;
default = ""; default = "";
description = '' description = ''
Which preset to use when starting pulseeffects. Which preset to use when starting pulseeffects.
@ -43,7 +40,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.pulseeffects" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.pulseeffects" pkgs lib.platforms.linux)
]; ];

View file

@ -5,9 +5,8 @@
... ...
}: }:
with lib;
let let
inherit (lib) mkOption types;
cfg = config.services.random-background; cfg = config.services.random-background;
@ -22,11 +21,11 @@ let
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.random-background = { services.random-background = {
enable = mkEnableOption "" // { enable = lib.mkEnableOption "" // {
description = '' description = ''
Whether to enable random desktop background. Whether to enable random desktop background.
@ -83,44 +82,46 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge ([ config = lib.mkIf cfg.enable (
{ lib.mkMerge [
assertions = [ {
(hm.assertions.assertPlatform "services.random-background" pkgs platforms.linux) assertions = [
]; (lib.hm.assertions.assertPlatform "services.random-background" pkgs lib.platforms.linux)
];
systemd.user.services.random-background = { systemd.user.services.random-background = {
Unit = { Unit = {
Description = "Set random desktop background using feh"; Description = "Set random desktop background using feh";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}"; ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle"; IOSchedulingClass = "idle";
}; };
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ];
}; };
};
}
(mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = {
Description = "Set random desktop background using feh";
}; };
}
(lib.mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = {
Description = "Set random desktop background using feh";
};
Timer = { Timer = {
OnUnitActiveSec = cfg.interval; OnUnitActiveSec = cfg.interval;
}; };
Install = { Install = {
WantedBy = [ "timers.target" ]; WantedBy = [ "timers.target" ];
};
}; };
}; })
}) ]
])); );
} }

View file

@ -6,10 +6,16 @@
... ...
}: }:
with lib;
# TODO: Fix the formatting of the resulting config. # TODO: Fix the formatting of the resulting config.
let let
inherit (lib)
generators
isAttrs
literalExpression
mkOption
types
;
cfg = config.services.recoll; cfg = config.services.recoll;
# The key-value generator for Recoll config format. For future references, # The key-value generator for Recoll config format. For future references,
@ -18,15 +24,15 @@ let
mkRecollConfKeyValue = generators.mkKeyValueDefault { mkRecollConfKeyValue = generators.mkKeyValueDefault {
mkValueString = mkValueString =
let let
mkQuoted = v: ''"${escape [ ''"'' ] v}"''; mkQuoted = v: ''"${lib.escape [ ''"'' ] v}"'';
in in
v: v:
if v == true then if v == true then
"1" "1"
else if v == false then else if v == false then
"0" "0"
else if isList v then else if lib.isList v then
concatMapStringsSep " " mkQuoted v lib.concatMapStringsSep " " mkQuoted v
else else
generators.mkValueStringDefault { } v; generators.mkValueStringDefault { } v;
} " = "; } " = ";
@ -43,7 +49,7 @@ let
inherit listsAsDuplicateKeys; inherit listsAsDuplicateKeys;
mkKeyValue = mkRecollConfKeyValue; mkKeyValue = mkRecollConfKeyValue;
}; };
mkSectionName = name: strings.escape [ "[" "]" ] name; mkSectionName = name: lib.strings.escape [ "[" "]" ] name;
convert = convert =
k: v: k: v:
if isAttrs v then if isAttrs v then
@ -58,11 +64,11 @@ let
# There's a possibility of attributes with attrsets overriding other # There's a possibility of attributes with attrsets overriding other
# top-level attributes with non-attrsets so we're forcing the attrsets to # top-level attributes with non-attrsets so we're forcing the attrsets to
# come last. # come last.
_config = mapAttrsToList convert (filterAttrs (k: v: !isAttrs v) attr); _config = lib.mapAttrsToList convert (lib.filterAttrs (k: v: !isAttrs v) attr);
_config' = mapAttrsToList convert (filterAttrs (k: v: isAttrs v) attr); _config' = lib.mapAttrsToList convert (lib.filterAttrs (k: v: isAttrs v) attr);
config = _config ++ _config'; config = _config ++ _config';
in in
concatStringsSep "\n" config; lib.concatStringsSep "\n" config;
# A specific type for Recoll config format. Taken from `pkgs.formats` # A specific type for Recoll config format. Taken from `pkgs.formats`
# implementation from nixpkgs. See the 'Nix-representable formats' from the # implementation from nixpkgs. See the 'Nix-representable formats' from the
@ -97,10 +103,10 @@ let
settingsFormat = recollConfFormat { }; settingsFormat = recollConfFormat { };
in in
{ {
meta.maintainers = [ maintainers.foo-dogsquared ]; meta.maintainers = [ lib.maintainers.foo-dogsquared ];
options.services.recoll = { options.services.recoll = {
enable = mkEnableOption "Recoll file index service"; enable = lib.mkEnableOption "Recoll file index service";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -159,7 +165,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.recoll" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.recoll" pkgs lib.platforms.linux)
]; ];
@ -185,7 +191,7 @@ in
Service = { Service = {
ExecStart = "${cfg.package}/bin/recollindex"; ExecStart = "${cfg.package}/bin/recollindex";
Environment = [ "RECOLL_CONFDIR=${escapeShellArg cfg.configDir}" ]; Environment = [ "RECOLL_CONFDIR=${lib.escapeShellArg cfg.configDir}" ];
}; };
}; };

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
commonOptions = import ./lib/options.nix { commonOptions = import ./lib/options.nix {
inherit config lib pkgs; inherit config lib pkgs;
@ -27,5 +24,5 @@ in
{ {
inherit (commonOptions) imports meta; inherit (commonOptions) imports meta;
options.services.gammastep = commonOptions.options; options.services.gammastep = commonOptions.options;
config = mkIf config.services.gammastep.enable commonOptions.config; config = lib.mkIf config.services.gammastep.enable commonOptions.config;
} }

View file

@ -12,17 +12,15 @@
xdgConfigFilePath, xdgConfigFilePath,
serviceDocumentation, serviceDocumentation,
}: }:
with lib;
let let
inherit (lib) mkOption mkIf types;
cfg = config.services.${moduleName}; cfg = config.services.${moduleName};
settingsFormat = pkgs.formats.ini { }; settingsFormat = pkgs.formats.ini { };
in in
{ {
meta.maintainers = with maintainers; [ meta.maintainers = with lib.maintainers; [
rycee rycee
thiagokokada thiagokokada
]; ];
@ -31,7 +29,7 @@ in
let let
mkRenamed = mkRenamed =
old: new: old: new:
mkRenamedOptionModule lib.mkRenamedOptionModule
( (
[ [
"services" "services"
@ -48,7 +46,7 @@ in
]; ];
in in
[ [
(mkRemovedOptionModule [ "services" moduleName "extraOptions" ] (lib.mkRemovedOptionModule [ "services" moduleName "extraOptions" ]
"All ${programName} configuration is now available through services.${moduleName}.settings instead." "All ${programName} configuration is now available through services.${moduleName}.settings instead."
) )
(mkRenamed [ "brightness" "day" ] "brightness-day") (mkRenamed [ "brightness" "day" ] "brightness-day")
@ -56,7 +54,7 @@ in
]; ];
options = { options = {
enable = mkEnableOption programName; enable = lib.mkEnableOption programName;
dawnTime = mkOption { dawnTime = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
@ -134,13 +132,13 @@ in
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = defaultPackage; default = defaultPackage;
defaultText = literalExpression examplePackage; defaultText = lib.literalExpression examplePackage;
description = '' description = ''
${programName} derivation to use. ${programName} derivation to use.
''; '';
}; };
enableVerboseLogging = mkEnableOption "verbose service logging"; enableVerboseLogging = lib.mkEnableOption "verbose service logging";
tray = mkOption { tray = mkOption {
type = types.bool; type = types.bool;
@ -154,7 +152,7 @@ in
settings = mkOption { settings = mkOption {
type = types.submodule { freeformType = settingsFormat.type; }; type = types.submodule { freeformType = settingsFormat.type; };
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
${mainSection} = { ${mainSection} = {
adjustment-method = "randr"; adjustment-method = "randr";
@ -174,7 +172,7 @@ in
config = { config = {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.${moduleName}" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.${moduleName}" pkgs lib.platforms.linux)
{ {
assertion = assertion =
@ -238,7 +236,7 @@ in
configFullPath = config.xdg.configHome + "/${xdgConfigFilePath}"; configFullPath = config.xdg.configHome + "/${xdgConfigFilePath}";
in in
"${cfg.package}/bin/${command} " "${cfg.package}/bin/${command} "
+ cli.toGNUCommandLineShell { } { + lib.cli.toGNUCommandLineShell { } {
v = cfg.enableVerboseLogging; v = cfg.enableVerboseLogging;
c = configFullPath; c = configFullPath;
}; };

View file

@ -4,9 +4,6 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
commonOptions = import ./lib/options.nix { commonOptions = import ./lib/options.nix {
inherit config lib pkgs; inherit config lib pkgs;
@ -26,5 +23,5 @@ in
{ {
inherit (commonOptions) imports meta; inherit (commonOptions) imports meta;
options.services.redshift = commonOptions.options; options.services.redshift = commonOptions.options;
config = mkIf config.services.redshift.enable commonOptions.config; config = lib.mkIf config.services.redshift.enable commonOptions.config;
} }

View file

@ -5,8 +5,6 @@
... ...
}: }:
with lib;
let let
cfg = config.services.rsibreak; cfg = config.services.rsibreak;
@ -15,11 +13,11 @@ in
{ {
options.services.rsibreak = { options.services.rsibreak = {
enable = mkEnableOption "rsibreak"; enable = lib.mkEnableOption "rsibreak";
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.rsibreak" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.rsibreak" pkgs lib.platforms.linux)
]; ];

View file

@ -5,27 +5,25 @@
... ...
}: }:
with lib;
let let
cfg = config.services.safeeyes; cfg = config.services.safeeyes;
in in
{ {
meta.maintainers = [ hm.maintainers.rosuavio ]; meta.maintainers = [ lib.hm.maintainers.rosuavio ];
options = { options = {
services.safeeyes = { services.safeeyes = {
enable = mkEnableOption "The Safe Eyes OSGI service"; enable = lib.mkEnableOption "The Safe Eyes OSGI service";
package = mkPackageOption pkgs "safeeyes" { }; package = lib.mkPackageOption pkgs "safeeyes" { };
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.safeeyes" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.safeeyes" pkgs lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
@ -41,7 +39,7 @@ in
}; };
Service = { Service = {
ExecStart = getExe pkgs.safeeyes; ExecStart = lib.getExe pkgs.safeeyes;
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 3; RestartSec = 3;
}; };

View file

@ -5,17 +5,21 @@
... ...
}: }:
with lib;
let let
inherit (lib)
mkIf
mkRenamedOptionModule
mkOption
types
;
cfg = config.services.screen-locker; cfg = config.services.screen-locker;
in in
{ {
meta.maintainers = [ meta.maintainers = [
hm.maintainers.jrobsonchase lib.hm.maintainers.jrobsonchase
hm.maintainers.rszamszur lib.hm.maintainers.rszamszur
]; ];
imports = imports =
@ -45,7 +49,7 @@ in
]; ];
options.services.screen-locker = { options.services.screen-locker = {
enable = mkEnableOption "screen locker for X session"; enable = lib.mkEnableOption "screen locker for X session";
lockCmd = mkOption { lockCmd = mkOption {
type = types.str; type = types.str;
@ -136,67 +140,69 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
{ lib.mkMerge [
assertions = [ {
(lib.hm.assertions.assertPlatform "services.screen-locker" pkgs lib.platforms.linux) assertions = [
]; (lib.hm.assertions.assertPlatform "services.screen-locker" pkgs lib.platforms.linux)
];
systemd.user.services.xss-lock = { systemd.user.services.xss-lock = {
Unit = { Unit = {
Description = "xss-lock, session locker service"; Description = "xss-lock, session locker service";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = concatStringsSep " " ( ExecStart = lib.concatStringsSep " " (
[ [
"${cfg.xss-lock.package}/bin/xss-lock" "${cfg.xss-lock.package}/bin/xss-lock"
"-s \${XDG_SESSION_ID}" "-s \${XDG_SESSION_ID}"
] ]
++ cfg.xss-lock.extraOptions ++ cfg.xss-lock.extraOptions
++ [ "-- ${cfg.lockCmd}" ] ++ [ "-- ${cfg.lockCmd}" ]
); );
Environment = cfg.lockCmdEnv; Environment = cfg.lockCmdEnv;
Restart = "always"; Restart = "always";
}; };
};
}
(mkIf (!cfg.xautolock.enable) {
systemd.user.services.xss-lock.Service.ExecStartPre = "${pkgs.xorg.xset}/bin/xset s ${
toString (cfg.inactiveInterval * 60)
} ${toString cfg.xss-lock.screensaverCycle}";
})
(mkIf cfg.xautolock.enable {
systemd.user.services.xautolock-session = {
Unit = {
Description = "xautolock, session locker service";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
}; };
}
(mkIf (!cfg.xautolock.enable) {
systemd.user.services.xss-lock.Service.ExecStartPre = "${pkgs.xorg.xset}/bin/xset s ${
toString (cfg.inactiveInterval * 60)
} ${toString cfg.xss-lock.screensaverCycle}";
})
(mkIf cfg.xautolock.enable {
systemd.user.services.xautolock-session = {
Unit = {
Description = "xautolock, session locker service";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = concatStringsSep " " ( ExecStart = lib.concatStringsSep " " (
[ [
"${cfg.xautolock.package}/bin/xautolock" "${cfg.xautolock.package}/bin/xautolock"
"-time ${toString cfg.inactiveInterval}" "-time ${toString cfg.inactiveInterval}"
"-locker '${pkgs.systemd}/bin/loginctl lock-session \${XDG_SESSION_ID}'" "-locker '${pkgs.systemd}/bin/loginctl lock-session \${XDG_SESSION_ID}'"
] ]
++ optional cfg.xautolock.detectSleep "-detectsleep" ++ lib.optional cfg.xautolock.detectSleep "-detectsleep"
++ cfg.xautolock.extraOptions ++ cfg.xautolock.extraOptions
); );
Restart = "always"; Restart = "always";
};
}; };
}; })
}) ]
]); );
} }

View file

@ -5,17 +5,15 @@
... ...
}: }:
with lib;
{ {
meta.maintainers = [ maintainers.somasis ]; meta.maintainers = [ lib.maintainers.somasis ];
options = { options = {
services.sctd = { services.sctd = {
enable = mkEnableOption "sctd"; enable = lib.mkEnableOption "sctd";
baseTemperature = mkOption { baseTemperature = lib.mkOption {
type = types.ints.between 2500 9000; type = lib.types.ints.between 2500 9000;
default = 4500; default = 4500;
description = '' description = ''
The base color temperature used by sctd, which should be between 2500 and 9000. The base color temperature used by sctd, which should be between 2500 and 9000.
@ -27,8 +25,8 @@ with lib;
}; };
}; };
config = mkIf config.services.sctd.enable { config = lib.mkIf config.services.sctd.enable {
assertions = [ (hm.assertions.assertPlatform "services.sctd" pkgs platforms.linux) ]; assertions = [ (lib.hm.assertions.assertPlatform "services.sctd" pkgs lib.platforms.linux) ];
systemd.user.services.sctd = { systemd.user.services.sctd = {
Unit = { Unit = {

View file

@ -6,6 +6,8 @@
}: }:
let let
inherit (lib) mkOption types;
cfg = config.services.signaturepdf; cfg = config.services.signaturepdf;
extraConfigToArgs = extraConfigToArgs =
extraConfig: extraConfig:
@ -19,8 +21,8 @@ in
{ {
meta.maintainers = [ lib.maintainers.DamienCassou ]; meta.maintainers = [ lib.maintainers.DamienCassou ];
options.services.signaturepdf = with lib; { options.services.signaturepdf = {
enable = mkEnableOption "signaturepdf; signing, organizing, editing metadatas or compressing PDFs"; enable = lib.mkEnableOption "signaturepdf; signing, organizing, editing metadatas or compressing PDFs";
package = mkOption { package = mkOption {
type = types.package; type = types.package;

View file

@ -5,22 +5,20 @@
... ...
}: }:
with lib;
let let
cfg = config.services.snixembed; cfg = config.services.snixembed;
in in
{ {
meta.maintainers = [ maintainers.DamienCassou ]; meta.maintainers = [ lib.maintainers.DamienCassou ];
options = { options = {
services.snixembed = { services.snixembed = {
enable = mkEnableOption "snixembed: proxy StatusNotifierItems as XEmbedded systemtray-spec icons"; enable = lib.mkEnableOption "snixembed: proxy StatusNotifierItems as XEmbedded systemtray-spec icons";
package = mkPackageOption pkgs "snixembed" { }; package = lib.mkPackageOption pkgs "snixembed" { };
beforeUnits = mkOption { beforeUnits = lib.mkOption {
type = with types; listOf str; type = with lib.types; listOf str;
default = [ ]; default = [ ];
example = [ "safeeyes.service" ]; example = [ "safeeyes.service" ];
description = '' description = ''
@ -30,9 +28,9 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.snixembed" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.snixembed" pkgs lib.platforms.linux)
]; ];
systemd.user.services.snixembed = { systemd.user.services.snixembed = {
@ -47,7 +45,7 @@ in
}; };
Service = { Service = {
ExecStart = getExe pkgs.snixembed; ExecStart = lib.getExe pkgs.snixembed;
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 3; RestartSec = 3;
}; };

View file

@ -5,9 +5,8 @@
... ...
}: }:
with lib;
let let
inherit (lib) literalExpression;
cfg = config.services.spotifyd; cfg = config.services.spotifyd;
@ -18,10 +17,10 @@ let
in in
{ {
options.services.spotifyd = { options.services.spotifyd = {
enable = mkEnableOption "SpotifyD connect"; enable = lib.mkEnableOption "SpotifyD connect";
package = mkOption { package = lib.mkOption {
type = types.package; type = lib.types.package;
default = pkgs.spotifyd; default = pkgs.spotifyd;
defaultText = literalExpression "pkgs.spotifyd"; defaultText = literalExpression "pkgs.spotifyd";
example = literalExpression "(pkgs.spotifyd.override { withKeyring = true; })"; example = literalExpression "(pkgs.spotifyd.override { withKeyring = true; })";
@ -31,7 +30,7 @@ in
''; '';
}; };
settings = mkOption { settings = lib.mkOption {
type = tomlFormat.type; type = tomlFormat.type;
default = { }; default = { };
description = "Configuration for spotifyd"; description = "Configuration for spotifyd";
@ -47,7 +46,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.spotifyd" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.spotifyd" pkgs lib.platforms.linux)
]; ];

View file

@ -1,6 +1,5 @@
{ {
config, config,
options,
lib, lib,
pkgs, pkgs,
... ...

View file

@ -5,9 +5,13 @@
... ...
}: }:
with lib;
let let
inherit (lib)
mkIf
mkOption
types
literalExpression
;
cfg = config.services.stalonetray; cfg = config.services.stalonetray;
@ -15,7 +19,7 @@ in
{ {
options = { options = {
services.stalonetray = { services.stalonetray = {
enable = mkEnableOption "Stalonetray system tray"; enable = lib.mkEnableOption "Stalonetray system tray";
package = mkOption { package = mkOption {
default = pkgs.stalonetray; default = pkgs.stalonetray;
@ -55,52 +59,54 @@ in
}; };
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (
{ lib.mkMerge [
assertions = [ {
(hm.assertions.assertPlatform "services.stalonetray" pkgs platforms.linux) assertions = [
]; (lib.hm.assertions.assertPlatform "services.stalonetray" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
systemd.user.services.stalonetray = { systemd.user.services.stalonetray = {
Unit = { Unit = {
Description = "Stalonetray system tray"; Description = "Stalonetray system tray";
PartOf = [ "tray.target" ]; PartOf = [ "tray.target" ];
};
Install = {
WantedBy = [ "tray.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/stalonetray";
Restart = "on-failure";
};
}; };
}
Install = { (mkIf (cfg.config != { }) {
WantedBy = [ "tray.target" ]; xdg.configFile."stalonetrayrc".text =
}; let
valueToString =
v:
if lib.isBool v then
(if v then "true" else "false")
else if (v == null) then
"none"
else
''"${toString v}"'';
in
lib.concatStrings (
lib.mapAttrsToList (k: v: ''
${k} ${valueToString v}
'') cfg.config
);
})
Service = { (mkIf (cfg.extraConfig != "") {
ExecStart = "${cfg.package}/bin/stalonetray"; xdg.configFile."stalonetrayrc".text = cfg.extraConfig;
Restart = "on-failure"; })
}; ]
}; );
}
(mkIf (cfg.config != { }) {
xdg.configFile."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 != "") {
xdg.configFile."stalonetrayrc".text = cfg.extraConfig;
})
]);
} }

View file

@ -5,31 +5,27 @@
... ...
}: }:
with lib;
let let
cfg = config.services.status-notifier-watcher; cfg = config.services.status-notifier-watcher;
in in
{ {
meta.maintainers = [ hm.maintainers.pltanton ]; meta.maintainers = [ lib.hm.maintainers.pltanton ];
options = { options = {
services.status-notifier-watcher = { services.status-notifier-watcher = {
enable = mkEnableOption "Status Notifier Watcher"; enable = lib.mkEnableOption "Status Notifier Watcher";
package = mkOption { package = lib.mkOption {
default = pkgs.haskellPackages.status-notifier-item; default = pkgs.haskellPackages.status-notifier-item;
defaultText = literalExpression "pkgs.haskellPackages.status-notifier-item"; defaultText = lib.literalExpression "pkgs.haskellPackages.status-notifier-item";
type = types.package; type = lib.types.package;
example = literalExpression "pkgs.haskellPackages.status-notifier-item"; example = lib.literalExpression "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 { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.status-notifier-watcher" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.status-notifier-watcher" pkgs lib.platforms.linux)
]; ];

View file

@ -5,15 +5,18 @@
... ...
}: }:
with lib;
let let
inherit (lib)
mkOption
types
literalExpression
;
cfg = config.services.swayidle; cfg = config.services.swayidle;
in in
{ {
meta.maintainers = [ maintainers.c0deaddict ]; meta.maintainers = [ lib.maintainers.c0deaddict ];
options.services.swayidle = options.services.swayidle =
let let
@ -64,7 +67,7 @@ in
in in
{ {
enable = mkEnableOption "idle manager for Wayland"; enable = lib.mkEnableOption "idle manager for Wayland";
package = lib.mkPackageOption pkgs "swayidle" { }; package = lib.mkPackageOption pkgs "swayidle" { };
@ -110,9 +113,9 @@ in
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.swayidle" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.swayidle" pkgs lib.platforms.linux)
]; ];
systemd.user.services.swayidle = { systemd.user.services.swayidle = {
@ -128,7 +131,7 @@ in
Type = "simple"; Type = "simple";
Restart = "always"; Restart = "always";
# swayidle executes commands using "sh -c", so the PATH needs to contain a shell. # swayidle executes commands using "sh -c", so the PATH needs to contain a shell.
Environment = [ "PATH=${makeBinPath [ pkgs.bash ]}" ]; Environment = [ "PATH=${lib.makeBinPath [ pkgs.bash ]}" ];
ExecStart = ExecStart =
let let
mkTimeout = mkTimeout =
@ -138,7 +141,7 @@ in
(toString t.timeout) (toString t.timeout)
t.command t.command
] ]
++ optionals (t.resumeCommand != null) [ ++ lib.optionals (t.resumeCommand != null) [
"resume" "resume"
t.resumeCommand t.resumeCommand
]; ];
@ -148,9 +151,10 @@ in
e.command e.command
]; ];
args = cfg.extraArgs ++ (concatMap mkTimeout cfg.timeouts) ++ (concatMap mkEvent cfg.events); args =
cfg.extraArgs ++ (lib.concatMap mkTimeout cfg.timeouts) ++ (lib.concatMap mkEvent cfg.events);
in in
"${getExe cfg.package} ${escapeShellArgs args}"; "${lib.getExe cfg.package} ${lib.escapeShellArgs args}";
}; };
Install = { Install = {

View file

@ -5,22 +5,25 @@
... ...
}: }:
with lib;
let let
inherit (lib)
mkOption
types
optionalString
;
cfg = config.services.swayosd; cfg = config.services.swayosd;
in in
{ {
meta.maintainers = [ hm.maintainers.pltanton ]; meta.maintainers = [ lib.hm.maintainers.pltanton ];
options.services.swayosd = { options.services.swayosd = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
swayosd, a GTK based on screen display for keyboard shortcuts like swayosd, a GTK based on screen display for keyboard shortcuts like
caps-lock and volume''; caps-lock and volume'';
package = mkPackageOption pkgs "swayosd" { }; package = lib.mkPackageOption pkgs "swayosd" { };
topMargin = mkOption { topMargin = mkOption {
type = types.nullOr ( type = types.nullOr (
@ -53,9 +56,9 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.swayosd" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.swayosd" pkgs lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
@ -77,7 +80,7 @@ in
ExecStart = ExecStart =
"${cfg.package}/bin/swayosd-server" "${cfg.package}/bin/swayosd-server"
+ (optionalString (cfg.display != null) " --display ${cfg.display}") + (optionalString (cfg.display != null) " --display ${cfg.display}")
+ (optionalString (cfg.stylePath != null) " --style ${escapeShellArg cfg.stylePath}") + (optionalString (cfg.stylePath != null) " --style ${lib.escapeShellArg cfg.stylePath}")
+ (optionalString (cfg.topMargin != null) " --top-margin ${toString cfg.topMargin}"); + (optionalString (cfg.topMargin != null) " --top-margin ${toString cfg.topMargin}");
Restart = "always"; Restart = "always";
RestartSec = "2s"; RestartSec = "2s";

View file

@ -5,16 +5,19 @@
... ...
}: }:
with lib;
let let
inherit (lib)
mkOption
types
literalExpression
;
cfg = config.services.sxhkd; cfg = config.services.sxhkd;
keybindingsStr = concatStringsSep "\n" ( keybindingsStr = lib.concatStringsSep "\n" (
mapAttrsToList ( lib.mapAttrsToList (
hotkey: command: hotkey: command:
optionalString (command != null) '' lib.optionalString (command != null) ''
${hotkey} ${hotkey}
${command} ${command}
'' ''
@ -24,7 +27,7 @@ let
in in
{ {
imports = [ imports = [
(mkRemovedOptionModule [ (lib.mkRemovedOptionModule [
"services" "services"
"sxhkd" "sxhkd"
"extraPath" "extraPath"
@ -32,7 +35,7 @@ in
]; ];
options.services.sxhkd = { options.services.sxhkd = {
enable = mkEnableOption "simple X hotkey daemon"; enable = lib.mkEnableOption "simple X hotkey daemon";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
@ -79,14 +82,14 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.sxhkd" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.sxhkd" pkgs lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile."sxhkd/sxhkdrc".text = concatStringsSep "\n" [ xdg.configFile."sxhkd/sxhkdrc".text = lib.concatStringsSep "\n" [
keybindingsStr keybindingsStr
cfg.extraConfig cfg.extraConfig
]; ];

View file

@ -8,8 +8,6 @@ let
inherit (lib) inherit (lib)
literalExpression literalExpression
mkOption mkOption
mkEnableOption
mkPackageOption
types types
; ;
@ -226,7 +224,7 @@ in
options = { options = {
services.syncthing = { services.syncthing = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
Syncthing, a self-hosted open-source alternative to Dropbox and Bittorrent Sync. Syncthing, a self-hosted open-source alternative to Dropbox and Bittorrent Sync.
''; '';
@ -408,7 +406,7 @@ in
will be reverted on restart if [overrideFolders](#opt-services.syncthing.overrideFolders) will be reverted on restart if [overrideFolders](#opt-services.syncthing.overrideFolders)
is enabled. is enabled.
''; '';
example = literalExpression '' example = lib.literalExpression ''
{ {
"/home/user/sync" = { "/home/user/sync" = {
id = "syncme"; id = "syncme";
@ -492,7 +490,7 @@ in
There are 4 different types of versioning with different parameters. There are 4 different types of versioning with different parameters.
See <https://docs.syncthing.net/users/versioning.html>. See <https://docs.syncthing.net/users/versioning.html>.
''; '';
example = literalExpression '' example = lib.literalExpression ''
[ [
{ {
versioning = { versioning = {
@ -631,7 +629,7 @@ in
''; '';
}; };
package = mkPackageOption pkgs "syncthing" { }; package = lib.mkPackageOption pkgs "syncthing" { };
tray = mkOption { tray = mkOption {
type = type =

View file

@ -5,20 +5,18 @@
... ...
}: }:
with lib;
{ {
meta.maintainers = [ maintainers.asymmetric ]; meta.maintainers = [ lib.maintainers.asymmetric ];
options = { options = {
services.systembus-notify = { services.systembus-notify = {
enable = mkEnableOption "systembus-notify - system bus notification daemon"; enable = lib.mkEnableOption "systembus-notify - system bus notification daemon";
}; };
}; };
config = mkIf config.services.systembus-notify.enable { config = lib.mkIf config.services.systembus-notify.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.systembus-notify" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.systembus-notify" pkgs lib.platforms.linux)
]; ];
systemd.user.services.systembus-notify = { systemd.user.services.systembus-notify = {

View file

@ -5,33 +5,31 @@
... ...
}: }:
with lib;
let let
cfg = config.services.taffybar; cfg = config.services.taffybar;
in in
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.taffybar = { services.taffybar = {
enable = mkEnableOption "Taffybar"; enable = lib.mkEnableOption "Taffybar";
package = mkOption { package = lib.mkOption {
default = pkgs.taffybar; default = pkgs.taffybar;
defaultText = literalExpression "pkgs.taffybar"; defaultText = lib.literalExpression "pkgs.taffybar";
type = types.package; type = lib.types.package;
example = literalExpression "pkgs.taffybar"; example = lib.literalExpression "pkgs.taffybar";
description = "The package to use for the Taffybar binary."; description = "The package to use for the Taffybar binary.";
}; };
}; };
}; };
config = mkIf config.services.taffybar.enable { config = lib.mkIf config.services.taffybar.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.taffybar" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.taffybar" pkgs lib.platforms.linux)
]; ];
systemd.user.services.taffybar = { systemd.user.services.taffybar = {

View file

@ -5,20 +5,18 @@
... ...
}: }:
with lib;
{ {
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.tahoe-lafs = { services.tahoe-lafs = {
enable = mkEnableOption "Tahoe-LAFS"; enable = lib.mkEnableOption "Tahoe-LAFS";
}; };
}; };
config = mkIf config.services.tahoe-lafs.enable { config = lib.mkIf config.services.tahoe-lafs.enable {
assertions = [ assertions = [
(hm.assertions.assertPlatform "services.tahoe-lafs" pkgs platforms.linux) (lib.hm.assertions.assertPlatform "services.tahoe-lafs" pkgs lib.platforms.linux)
]; ];
systemd.user.services.tahoe-lafs = { systemd.user.services.tahoe-lafs = {

View file

@ -5,26 +5,24 @@
... ...
}: }:
with lib;
let let
cfg = config.services.taskwarrior-sync; cfg = config.services.taskwarrior-sync;
in in
{ {
meta.maintainers = with maintainers; [ meta.maintainers = with lib.maintainers; [
euxane euxane
minijackson minijackson
]; ];
options.services.taskwarrior-sync = { options.services.taskwarrior-sync = {
enable = mkEnableOption "Taskwarrior periodic sync"; enable = lib.mkEnableOption "Taskwarrior periodic sync";
package = mkPackageOption pkgs "taskwarrior" { example = "pkgs.taskwarrior3"; }; package = lib.mkPackageOption pkgs "taskwarrior" { example = "pkgs.taskwarrior3"; };
frequency = mkOption { frequency = lib.mkOption {
type = types.str; type = lib.types.str;
default = "*:0/5"; default = "*:0/5";
description = '' description = ''
How often to run `taskwarrior sync`. This How often to run `taskwarrior sync`. This
@ -36,7 +34,7 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.taskwarrior-sync" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.taskwarrior-sync" pkgs lib.platforms.linux)
]; ];

View file

@ -5,9 +5,8 @@
... ...
}: }:
with lib;
let let
inherit (lib) types;
boolTrue = { boolTrue = {
type = types.bool; type = types.bool;
@ -115,35 +114,35 @@ let
in in
{ {
meta.maintainers = [ hm.maintainers.mager ]; meta.maintainers = [ lib.hm.maintainers.mager ];
options = { options = {
services.trayer = { services.trayer = {
enable = mkEnableOption "trayer, the lightweight GTK2+ systray for UNIX desktops"; enable = lib.mkEnableOption "trayer, the lightweight GTK2+ systray for UNIX desktops";
package = mkOption { package = lib.mkOption {
default = pkgs.trayer; default = pkgs.trayer;
defaultText = literalExpression "pkgs.trayer"; defaultText = lib.literalExpression "pkgs.trayer";
type = types.package; type = types.package;
example = literalExpression "pkgs.trayer"; example = lib.literalExpression "pkgs.trayer";
description = "The package to use for the trayer binary."; description = "The package to use for the trayer binary.";
}; };
settings = mkOption { settings = lib.mkOption {
type = with types; attrsOf (nullOr (either str (either bool int))); type = with types; attrsOf (nullOr (either str (either bool int)));
description = '' description = ''
Trayer configuration as a set of attributes. Further details can be Trayer configuration as a set of attributes. Further details can be
found in [trayer's README](https://github.com/sargon/trayer-srg/blob/master/README). found in [trayer's README](https://github.com/sargon/trayer-srg/blob/master/README).
${concatStringsSep "\n" ( ${lib.concatStringsSep "\n" (
mapAttrsToList (n: v: '' lib.mapAttrsToList (n: v: ''
{var}`${n}` {var}`${n}`
: ${v.type.description} (default: `${builtins.toJSON v.default}`) : ${v.type.description} (default: `${builtins.toJSON v.default}`)
'') knownSettings '') knownSettings
)} )}
''; '';
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
edge = "top"; edge = "top";
padding = 6; padding = 6;
@ -155,7 +154,7 @@ in
}; };
}; };
config = mkIf cfg.enable ({ config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.trayer" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.trayer" pkgs lib.platforms.linux)
]; ];
@ -164,9 +163,9 @@ in
systemd.user.services.trayer = systemd.user.services.trayer =
let let
valueToString = v: if isBool v then (if v then "true" else "false") else "${toString v}"; valueToString = v: if lib.isBool v then (if v then "true" else "false") else "${toString v}";
parameter = k: v: "--${k} ${valueToString v}"; parameter = k: v: "--${k} ${valueToString v}";
parameters = concatStringsSep " " (mapAttrsToList parameter cfg.settings); parameters = lib.concatStringsSep " " (lib.mapAttrsToList parameter cfg.settings);
in in
{ {
Unit = { Unit = {
@ -181,5 +180,5 @@ in
Restart = "on-failure"; Restart = "on-failure";
}; };
}; };
}); };
} }

View file

@ -2,13 +2,16 @@
config, config,
lib, lib,
pkgs, pkgs,
stdenv,
... ...
}: }:
with lib;
let let
inherit (lib)
mkOption
mkEnableOption
types
literalExpression
;
cfg = config.services.twmn; cfg = config.services.twmn;
@ -34,7 +37,7 @@ let
in in
{ {
meta.maintainers = [ hm.maintainers.austreelis ]; meta.maintainers = [ lib.hm.maintainers.austreelis ];
options.services.twmn = { options.services.twmn = {
enable = mkEnableOption "twmn, a tiling window manager notification daemon"; enable = mkEnableOption "twmn, a tiling window manager notification daemon";
@ -304,7 +307,7 @@ in
################# #################
# Implementation # Implementation
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.twmn" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.twmn" pkgs lib.platforms.linux)
]; ];
@ -313,7 +316,7 @@ in
xdg.configFile."twmn/twmn.conf".text = xdg.configFile."twmn/twmn.conf".text =
let let
conf = recursiveUpdate { conf = lib.recursiveUpdate {
gui = { gui = {
always_on_top = if cfg.window.alwaysOnTop then "true" else "false"; always_on_top = if cfg.window.alwaysOnTop then "true" else "false";
background_color = cfg.window.color; background_color = cfg.window.color;
@ -337,7 +340,7 @@ in
}; };
# map null values to empty strings because formats.toml generator fails # map null values to empty strings because formats.toml generator fails
# when encountering a null. # when encountering a null.
icons = mapAttrs (_: toString) cfg.icons; icons = lib.mapAttrs (_: toString) cfg.icons;
main = { main = {
duration = toString cfg.duration; duration = toString cfg.duration;
host = cfg.host; host = cfg.host;
@ -350,10 +353,10 @@ in
mkSection = section: conf: '' mkSection = section: conf: ''
[${section}] [${section}]
${concatStringsSep "\n" (mapAttrsToList mkLine conf)} ${lib.concatStringsSep "\n" (lib.mapAttrsToList mkLine conf)}
''; '';
in in
concatStringsSep "\n" (mapAttrsToList mkSection conf) + "\n"; lib.concatStringsSep "\n" (lib.mapAttrsToList mkSection conf) + "\n";
systemd.user.services.twmnd = { systemd.user.services.twmnd = {
Unit = { Unit = {

Some files were not shown because too many files have changed in this diff Show more