From c476cc61b2dd8c7f868b213b7757b565bdf2bb7d Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 12 Jul 2021 23:59:37 -0600 Subject: [PATCH] xsettingsd: add service module --- modules/misc/news.nix | 8 ++++++ modules/modules.nix | 1 + modules/services/xsettingsd.nix | 44 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 modules/services/xsettingsd.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index b4eec3bbd..c55483796 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2125,6 +2125,14 @@ in A new module is available: 'programs.sm64ex'. ''; } + + { + time = "2021-07-15T13:38:32+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.xsettingsd'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 13e94ecca..8b76f6c04 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -229,6 +229,7 @@ let (loadModule ./services/xembed-sni-proxy.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/xidlehook.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/xscreensaver.nix { }) + (loadModule ./services/xsettingsd.nix { condition = hostPlatform.isLinux; }) (loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; }) (loadModule ./systemd.nix { }) (loadModule ./targets/darwin { condition = hostPlatform.isDarwin; }) diff --git a/modules/services/xsettingsd.nix b/modules/services/xsettingsd.nix new file mode 100644 index 000000000..2ae846b64 --- /dev/null +++ b/modules/services/xsettingsd.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.xsettingsd; + +in { + meta.maintainers = [ maintainers.imalison ]; + + options = { + services.xsettingsd = { + enable = mkEnableOption "xsettingsd"; + + package = mkOption { + type = types.package; + default = pkgs.xsettingsd; + defaultText = literalExample "pkgs.xsettingsd"; + description = '' + Package containing the xsettingsd program. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.xsettingsd = { + Unit = { + Description = "xsettingsd"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + + Service = { + Environment = "PATH=${config.home.profileDirectory}/bin"; + ExecStart = "${cfg.package}/bin/xsettingsd"; + Restart = "on-abort"; + }; + }; + }; +}