From 8b3fca4ec5e879f608473fe851cc5077dfb19bbd Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 21 Dec 2020 23:22:22 +0100 Subject: [PATCH] dconf: format file --- format | 2 -- modules/misc/dconf.nix | 44 ++++++++++++++++++------------------------ 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/format b/format index 7d48cb8a..9159a704 100755 --- a/format +++ b/format @@ -26,7 +26,6 @@ find . -name '*.nix' \ ! -path ./modules/lib/default.nix \ ! -path ./modules/lib/file-type.nix \ ! -path ./modules/manual.nix \ - ! -path ./modules/misc/dconf.nix \ ! -path ./modules/misc/news.nix \ ! -path ./modules/misc/nixpkgs.nix \ ! -path ./modules/misc/xdg.nix \ @@ -51,7 +50,6 @@ find . -name '*.nix' \ ! -path ./tests/modules/home-environment/default.nix \ ! -path ./tests/modules/home-environment/session-variables.nix \ ! -path ./tests/modules/programs/gpg/override-defaults.nix \ - ! -path ./tests/modules/programs/tmux/default.nix \ ! -path ./tests/modules/programs/zsh/session-variables.nix \ ! -path ./tests/modules/services/sxhkd/service.nix \ ! -path ./tests/modules/systemd/services.nix \ diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index 5fc7748a..476b61dd 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -8,12 +8,9 @@ let toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; - mkIniKeyValue = key: value: - "${key}=${toString (hm.gvariant.mkValue value)}"; + mkIniKeyValue = key: value: "${key}=${toString (hm.gvariant.mkValue value)}"; -in - -{ +in { meta.maintainers = [ maintainers.gnidorah maintainers.rycee ]; options = { @@ -29,7 +26,7 @@ in settings = mkOption { type = with types; attrsOf (attrsOf hm.types.gvariant); - default = {}; + default = { }; example = literalExample '' { "org/gnome/calculator" = { @@ -48,26 +45,23 @@ in }; }; - config = mkIf (cfg.enable && cfg.settings != {}) { - home.activation.dconfSettings = hm.dag.entryAfter ["installPackages"] ( - let - iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); - in - '' - if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then - DCONF_DBUS_RUN_SESSION="" - else - DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" - fi + config = mkIf (cfg.enable && cfg.settings != { }) { + home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] + (let iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); + in '' + if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then + DCONF_DBUS_RUN_SESSION="" + else + DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" + fi - if [[ -v DRY_RUN ]]; then - echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile} - else - $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} - fi + if [[ -v DRY_RUN ]]; then + echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile} + else + $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} + fi - unset DCONF_DBUS_RUN_SESSION - '' - ); + unset DCONF_DBUS_RUN_SESSION + ''); }; }