mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
parent
179f6acaf7
commit
3142bdcc47
4 changed files with 49 additions and 4 deletions
|
@ -473,6 +473,12 @@ in
|
|||
will be printed when the user configuration is being built.
|
||||
'';
|
||||
};
|
||||
|
||||
home.preferXdgDirectories = mkEnableOption "" // {
|
||||
description = ''
|
||||
Whether to make programs use XDG directories whenever supported.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
|
|
@ -68,8 +68,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.file.".inputrc".text = let
|
||||
config = mkIf cfg.enable (let
|
||||
finalConfig = let
|
||||
configStr = concatStringsSep "\n"
|
||||
(optional cfg.includeSystemConfig "$include /etc/inputrc"
|
||||
++ mapAttrsToList mkSetVariableStr cfg.variables
|
||||
|
@ -80,5 +80,13 @@ in {
|
|||
${configStr}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
in mkMerge [
|
||||
(mkIf (!config.home.preferXdgDirectories) {
|
||||
home.file.".inputrc".text = finalConfig;
|
||||
})
|
||||
(mkIf config.home.preferXdgDirectories {
|
||||
xdg.configFile.inputrc.text = finalConfig;
|
||||
home.sessionVariables.INPUTRC = "${config.xdg.configHome}/inputrc";
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{ readline-using-all-options = ./using-all-options.nix; }
|
||||
{
|
||||
readline-using-all-options = ./using-all-options.nix;
|
||||
readline-prefer-xdg-dirs = ./prefer-xdg-dirs.nix;
|
||||
}
|
||||
|
|
28
tests/modules/programs/readline/prefer-xdg-dirs.nix
Normal file
28
tests/modules/programs/readline/prefer-xdg-dirs.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
home.preferXdgDirectories = true;
|
||||
|
||||
programs.readline = {
|
||||
enable = true;
|
||||
variables.bell-style = "audible";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/inputrc \
|
||||
${
|
||||
builtins.toFile "readline-expected" ''
|
||||
# Generated by Home Manager.
|
||||
|
||||
$include /etc/inputrc
|
||||
set bell-style audible
|
||||
|
||||
''
|
||||
}
|
||||
|
||||
assertFileContains \
|
||||
home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'export INPUTRC="/home/hm-user/.config/inputrc"'
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue