From c7592b747b332eded1a1728e87abbc6e66b934f4 Mon Sep 17 00:00:00 2001 From: polykernel <81340136+polykernel@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:02:00 -0500 Subject: [PATCH] treewide: prefer XDG variables over dot directories Currently, dot directories and XDG base directories are used inconsistently in the Home Manager option declarations. This creates ambiguity for the user as to where the location of the file should be albeit this is rarely encountered in practice as it is sufficient to read upstream documentation. The rationale is to make declarations consistent and make a clear distinction between hardcoded and modular specifications. References to ~/.config in relevant nixpkgs modules were untouched as the location is hardcoded upstream[1]. Furthermore, modules of programs which do not follow XDG specifications were also untouched. Generalization of tilde(~) expansions to $HOME were also considered, however there isn't sufficient rationale despite the use of $HOME being more universal. The expansion is standardized in POSIX[2] and is essentially portable across all shells, thus there is no pragmatic value to introducing the change. [1] https://github.com/nixos/nixpkgs/blob/master/pkgs/top-level/impure.nix [2] https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_01 --- docs/man-home-manager.xml | 4 ++-- modules/misc/gtk.nix | 4 ++-- modules/programs/alacritty.nix | 2 +- modules/programs/atuin.nix | 2 +- modules/programs/beets.nix | 2 +- modules/programs/direnv.nix | 4 ++-- modules/programs/hexchat.nix | 4 ++-- modules/programs/htop.nix | 2 +- modules/programs/kakoune.nix | 2 +- modules/programs/kitty.nix | 2 +- modules/programs/lazygit.nix | 2 +- modules/programs/lsd.nix | 2 +- modules/programs/mangohud.nix | 4 ++-- modules/programs/mpv.nix | 6 +++--- modules/programs/ncspot.nix | 2 +- modules/programs/noti.nix | 2 +- modules/programs/nushell.nix | 2 +- modules/programs/rtorrent.nix | 2 +- modules/programs/sm64ex.nix | 2 +- modules/programs/starship.nix | 2 +- modules/programs/topgrade.nix | 2 +- modules/services/grobi.nix | 4 ++-- 22 files changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/man-home-manager.xml b/docs/man-home-manager.xml index 9f537450..5a4f2d5d 100644 --- a/docs/man-home-manager.xml +++ b/docs/man-home-manager.xml @@ -414,7 +414,7 @@ Indicates the path to the Home Manager configuration file. If not given, - ~/.config/nixpkgs/home.nix is used. + $XDG_CONFIG_HOME/nixpkgs/home.nix is used. @@ -589,7 +589,7 @@ - ~/.local/share/home-manager/news-read-ids + $XDG_DATA_HOME/home-manager/news-read-ids diff --git a/modules/misc/gtk.nix b/modules/misc/gtk.nix index 669329b7..0b5a54d5 100644 --- a/modules/misc/gtk.nix +++ b/modules/misc/gtk.nix @@ -123,7 +123,7 @@ in { }; description = '' Extra configuration options to add to - ~/.config/gtk-3.0/settings.ini. + $XDG_CONFIG_HOME/gtk-3.0/settings.ini. ''; }; @@ -132,7 +132,7 @@ in { default = ""; description = '' Extra configuration lines to add verbatim to - ~/.config/gtk-3.0/gtk.css. + $XDG_CONFIG_HOME/gtk-3.0/gtk.css. ''; }; }; diff --git a/modules/programs/alacritty.nix b/modules/programs/alacritty.nix index d34efb77..c82d9c97 100644 --- a/modules/programs/alacritty.nix +++ b/modules/programs/alacritty.nix @@ -37,7 +37,7 @@ in { ''; description = '' Configuration written to - ~/.config/alacritty/alacritty.yml. See + $XDG_CONFIG_HOME/alacritty/alacritty.yml. See for the default configuration. ''; diff --git a/modules/programs/atuin.nix b/modules/programs/atuin.nix index dcf1232f..0e5fa071 100644 --- a/modules/programs/atuin.nix +++ b/modules/programs/atuin.nix @@ -60,7 +60,7 @@ in { ''; description = '' Configuration written to - ~/.config/atuin/config.toml. + $XDG_CONFIG_HOME/atuin/config.toml. See for the full list of options. diff --git a/modules/programs/beets.nix b/modules/programs/beets.nix index a0b8a346..fa959669 100644 --- a/modules/programs/beets.nix +++ b/modules/programs/beets.nix @@ -45,7 +45,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/beets/config.yaml + $XDG_CONFIG_HOME/beets/config.yaml ''; }; }; diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index ad4c4993..5220aaa1 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -29,7 +29,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/direnv/config.toml. + $XDG_CONFIG_HOME/direnv/config.toml. See @@ -45,7 +45,7 @@ in { default = ""; description = '' Custom stdlib written to - ~/.config/direnv/direnvrc. + $XDG_CONFIG_HOME/direnv/direnvrc. ''; }; diff --git a/modules/programs/hexchat.nix b/modules/programs/hexchat.nix index b0836758..5971bba6 100644 --- a/modules/programs/hexchat.nix +++ b/modules/programs/hexchat.nix @@ -270,7 +270,7 @@ in { }; }''; description = '' - Configures ~/.config/hexchat/servlist.conf. + Configures $XDG_CONFIG_HOME/hexchat/servlist.conf. ''; }; @@ -286,7 +286,7 @@ in { }; ''; description = '' - Configuration for ~/.config/hexchat/hexchat.conf, see + Configuration for $XDG_CONFIG_HOME/hexchat/hexchat.conf, see for supported values. ''; diff --git a/modules/programs/htop.nix b/modules/programs/htop.nix index 1506aab5..1c8a5931 100644 --- a/modules/programs/htop.nix +++ b/modules/programs/htop.nix @@ -133,7 +133,7 @@ in { ''; description = '' Configuration options to add to - ~/.config/htop/htoprc. + $XDG_CONFIG_HOME/htop/htoprc. ''; }; diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix index 49f259d0..d177048b 100644 --- a/modules/programs/kakoune.nix +++ b/modules/programs/kakoune.nix @@ -635,7 +635,7 @@ in { default = ""; description = '' Extra configuration lines to add to - ~/.config/kak/kakrc. + $XDG_CONFIG_HOME/kak/kakrc. ''; }; diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 6d3d4d00..2eefa8ab 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -57,7 +57,7 @@ in { ''; description = '' Configuration written to - ~/.config/kitty/kitty.conf. See + $XDG_CONFIG_HOME/kitty/kitty.conf. See for the documentation. ''; diff --git a/modules/programs/lazygit.nix b/modules/programs/lazygit.nix index f2d51620..87bcdecc 100644 --- a/modules/programs/lazygit.nix +++ b/modules/programs/lazygit.nix @@ -32,7 +32,7 @@ in { ''; description = '' Configuration written to - ~/.config/lazygit/config.yml on Linux + $XDG_CONFIG_HOME/lazygit/config.yml on Linux or ~/Library/Application Support/lazygit/config.yml on Darwin. See for supported values. diff --git a/modules/programs/lsd.nix b/modules/programs/lsd.nix index b5dd260e..0b54abe3 100644 --- a/modules/programs/lsd.nix +++ b/modules/programs/lsd.nix @@ -39,7 +39,7 @@ in { }; description = '' Configuration written to - ~/.config/lsd/config.yaml. See + $XDG_CONFIG_HOME/lsd/config.yaml. See for supported values. ''; diff --git a/modules/programs/mangohud.nix b/modules/programs/mangohud.nix index 0f14a8c6..ca77c07c 100644 --- a/modules/programs/mangohud.nix +++ b/modules/programs/mangohud.nix @@ -55,7 +55,7 @@ in { ''; description = '' Configuration written to - ~/.config/MangoHud/MangoHud.conf. See + $XDG_CONFIG_HOME/MangoHud/MangoHud.conf. See for the default configuration. ''; @@ -74,7 +74,7 @@ in { description = '' Sets MangoHud settings per application. Configuration written to - ~/.config/MangoHud/{application_name}.conf. See + $XDG_CONFIG_HOME/MangoHud/{application_name}.conf. See for the default configuration. ''; diff --git a/modules/programs/mpv.nix b/modules/programs/mpv.nix index a53f4c40..b37a2516 100644 --- a/modules/programs/mpv.nix +++ b/modules/programs/mpv.nix @@ -90,7 +90,7 @@ in { config = mkOption { description = '' Configuration written to - ~/.config/mpv/mpv.conf. See + $XDG_CONFIG_HOME/mpv/mpv.conf. See mpv 1 @@ -112,7 +112,7 @@ in { profiles = mkOption { description = '' Sub-configuration options for specific profiles written to - ~/.config/mpv/mpv.conf. See + $XDG_CONFIG_HOME/mpv/mpv.conf. See for more information. ''; type = mpvProfiles; @@ -143,7 +143,7 @@ in { bindings = mkOption { description = '' Input configuration written to - ~/.config/mpv/input.conf. See + $XDG_CONFIG_HOME/mpv/input.conf. See mpv 1 diff --git a/modules/programs/ncspot.nix b/modules/programs/ncspot.nix index 7acb8d36..3b6d401e 100644 --- a/modules/programs/ncspot.nix +++ b/modules/programs/ncspot.nix @@ -32,7 +32,7 @@ in { ''; description = '' Configuration written to - ~/.config/ncspot/config.toml. + $XDG_CONFIG_HOME/ncspot/config.toml. See for the full list of options. diff --git a/modules/programs/noti.nix b/modules/programs/noti.nix index 069d87e6..d8affdd5 100644 --- a/modules/programs/noti.nix +++ b/modules/programs/noti.nix @@ -17,7 +17,7 @@ in { default = { }; description = '' Configuration written to - ~/.config/noti/noti.yaml. + $XDG_CONFIG_HOME/noti/noti.yaml. See diff --git a/modules/programs/nushell.nix b/modules/programs/nushell.nix index f37b889a..4d6ab43a 100644 --- a/modules/programs/nushell.nix +++ b/modules/programs/nushell.nix @@ -42,7 +42,7 @@ in { ''; description = '' Configuration written to - ~/.config/nushell/config.toml. + $XDG_CONFIG_HOME/nushell/config.toml. See for the full list of options. diff --git a/modules/programs/rtorrent.nix b/modules/programs/rtorrent.nix index 7beeb2e4..95015e2c 100644 --- a/modules/programs/rtorrent.nix +++ b/modules/programs/rtorrent.nix @@ -17,7 +17,7 @@ in { default = ""; description = '' Configuration written to - ~/.config/rtorrent/rtorrent.rc. See + $XDG_CONFIG_HOME/rtorrent/rtorrent.rc. See for explanation about possible values. ''; diff --git a/modules/programs/sm64ex.nix b/modules/programs/sm64ex.nix index a5debee1..48c1cb9b 100644 --- a/modules/programs/sm64ex.nix +++ b/modules/programs/sm64ex.nix @@ -80,7 +80,7 @@ in { nullOr (attrsOf (either str (either int (either bool (listOf str))))); default = null; description = - "Settings for sm64ex's ~/.local/share/sm64pc/sm64config.txt file."; + "Settings for sm64ex's $XDG_DATA_HOME/sm64pc/sm64config.txt file."; example = literalExpression '' { fullscreen = false; diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 77a9cad3..85b41413 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -51,7 +51,7 @@ in { ''; description = '' Configuration written to - ~/.config/starship.toml. + $XDG_CONFIG_HOME/starship.toml. See for the full list of options. diff --git a/modules/programs/topgrade.nix b/modules/programs/topgrade.nix index 1511d4b4..ac88643d 100644 --- a/modules/programs/topgrade.nix +++ b/modules/programs/topgrade.nix @@ -42,7 +42,7 @@ in { ''; description = '' Configuration written to - ~/.config/topgrade.toml. + $XDG_CONFIG_HOME/topgrade.toml. See for the full list of options. diff --git a/modules/services/grobi.nix b/modules/services/grobi.nix index 2f643109..d90b7244 100644 --- a/modules/services/grobi.nix +++ b/modules/services/grobi.nix @@ -24,7 +24,7 @@ in { Commands to be run after an output configuration was changed. The Nix value declared here will be translated to JSON and written to the key - in ~/.config/grobi.conf. + in $XDG_CONFIG_HOME/grobi.conf. ''; }; @@ -64,7 +64,7 @@ in { for more information. The Nix value declared here will be translated to JSON and written to the - key in ~/.config/grobi.conf. + key in $XDG_CONFIG_HOME/grobi.conf. ''; }; };