From 94f75728c4f27274c832a9563c92a2c5e4f14d23 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 22 Nov 2023 16:05:30 +0800 Subject: [PATCH] services/plover: update module descriptions and settings file generation --- modules/home-manager/services/plover.nix | 29 +++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/modules/home-manager/services/plover.nix b/modules/home-manager/services/plover.nix index eb299cf2..1f8b4d18 100644 --- a/modules/home-manager/services/plover.nix +++ b/modules/home-manager/services/plover.nix @@ -23,6 +23,7 @@ let }; settingsFormat = ploverIniFormat { }; + settingsFile = settingsFormat.generate "plover-config-${config.home.username}" cfg.settings; in { options.services.plover = { @@ -41,17 +42,15 @@ in description = "Configuration to be used for the application."; default = { }; defaultText = lib.literalExpression "{}"; - example = lib.literalExpression '' - { - "Output Configuration" = { - undo_levels = 100; - }; + example = { + "Output Configuration" = { + undo_levels = 100; + }; - "Stroke Display" = { - show = true; - }; - } - ''; + "Stroke Display" = { + show = true; + }; + }; }; extraOptions = lib.mkOption { @@ -74,9 +73,7 @@ in home.packages = [ cfg.package ]; - xdg.configFile."plover/plover.cfg".source = - settingsFormat.generate "plover-config-${config.home.username}" - cfg.settings; + xdg.configFile."plover/plover.cfg".source = lib.mkIf (cfg.settings != { }) settingsFile; systemd.user.services.plover = { Unit = { @@ -85,11 +82,7 @@ in PartOf = "default.target"; }; - Service = { - ExecStart = "${cfg.package}/bin/plover ${ - lib.concatStringsSep " " cfg.extraOptions - }"; - }; + Service.ExecStart = "${lib.getExe' cfg.package "plover"} ${lib.concatStringsSep " " cfg.extraOptions}"; Install.WantedBy = [ "default.target" ]; };