1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

dconf: format file

This commit is contained in:
Robert Helgesson 2020-12-21 23:22:22 +01:00
parent 2b1892e646
commit 8b3fca4ec5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 19 additions and 27 deletions

2
format
View file

@ -26,7 +26,6 @@ find . -name '*.nix' \
! -path ./modules/lib/default.nix \ ! -path ./modules/lib/default.nix \
! -path ./modules/lib/file-type.nix \ ! -path ./modules/lib/file-type.nix \
! -path ./modules/manual.nix \ ! -path ./modules/manual.nix \
! -path ./modules/misc/dconf.nix \
! -path ./modules/misc/news.nix \ ! -path ./modules/misc/news.nix \
! -path ./modules/misc/nixpkgs.nix \ ! -path ./modules/misc/nixpkgs.nix \
! -path ./modules/misc/xdg.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/default.nix \
! -path ./tests/modules/home-environment/session-variables.nix \ ! -path ./tests/modules/home-environment/session-variables.nix \
! -path ./tests/modules/programs/gpg/override-defaults.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/programs/zsh/session-variables.nix \
! -path ./tests/modules/services/sxhkd/service.nix \ ! -path ./tests/modules/services/sxhkd/service.nix \
! -path ./tests/modules/systemd/services.nix \ ! -path ./tests/modules/systemd/services.nix \

View file

@ -8,12 +8,9 @@ let
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; }; toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
mkIniKeyValue = key: value: mkIniKeyValue = key: value: "${key}=${toString (hm.gvariant.mkValue value)}";
"${key}=${toString (hm.gvariant.mkValue value)}";
in in {
{
meta.maintainers = [ maintainers.gnidorah maintainers.rycee ]; meta.maintainers = [ maintainers.gnidorah maintainers.rycee ];
options = { options = {
@ -29,7 +26,7 @@ in
settings = mkOption { settings = mkOption {
type = with types; attrsOf (attrsOf hm.types.gvariant); type = with types; attrsOf (attrsOf hm.types.gvariant);
default = {}; default = { };
example = literalExample '' example = literalExample ''
{ {
"org/gnome/calculator" = { "org/gnome/calculator" = {
@ -48,12 +45,10 @@ in
}; };
}; };
config = mkIf (cfg.enable && cfg.settings != {}) { config = mkIf (cfg.enable && cfg.settings != { }) {
home.activation.dconfSettings = hm.dag.entryAfter ["installPackages"] ( home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ]
let (let iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); in ''
in
''
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
DCONF_DBUS_RUN_SESSION="" DCONF_DBUS_RUN_SESSION=""
else else
@ -67,7 +62,6 @@ in
fi fi
unset DCONF_DBUS_RUN_SESSION unset DCONF_DBUS_RUN_SESSION
'' '');
);
}; };
} }