mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-15 17:50:53 +00:00
dconf: format file
This commit is contained in:
parent
2b1892e646
commit
8b3fca4ec5
2 changed files with 19 additions and 27 deletions
2
format
2
format
|
@ -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 \
|
||||||
|
|
|
@ -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,26 +45,23 @@ 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
|
||||||
''
|
DCONF_DBUS_RUN_SESSION=""
|
||||||
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
|
else
|
||||||
DCONF_DBUS_RUN_SESSION=""
|
DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session"
|
||||||
else
|
fi
|
||||||
DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -v DRY_RUN ]]; then
|
if [[ -v DRY_RUN ]]; then
|
||||||
echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile}
|
echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile}
|
||||||
else
|
else
|
||||||
$DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile}
|
$DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset DCONF_DBUS_RUN_SESSION
|
unset DCONF_DBUS_RUN_SESSION
|
||||||
''
|
'');
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue