mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 22:50:39 +00:00
parent
b819d2cc41
commit
605a8fc92e
3 changed files with 32 additions and 4 deletions
|
@ -1649,6 +1649,21 @@ in
|
|||
A new module is available: 'programs.ncmpcpp'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-11T10:06:47+00:00";
|
||||
condition = hostPlatform.isLinux && config.targets.genericLinux.enable;
|
||||
message = ''
|
||||
A new option 'targets.genericLinux.extraXdgDataDirs' is available
|
||||
to setup the user environment with the OS's data files.
|
||||
|
||||
This is useful for example to get Bash completion for
|
||||
'systemctl' which shouldn't be installed through Home Manager.
|
||||
|
||||
This is also useful to have non Home Manager applications
|
||||
available in menus.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,14 +14,24 @@ in {
|
|||
GNU/Linux distributions other than NixOS.
|
||||
'';
|
||||
};
|
||||
|
||||
extraXdgDataDirs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "/usr/share" "/usr/local/share" ];
|
||||
description = ''
|
||||
List of directory names to add to <envar>XDG_DATA_DIRS</envar>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.targets.genericLinux.enable {
|
||||
home.sessionVariables = let
|
||||
profiles =
|
||||
[ "\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default" profileDirectory ];
|
||||
dataDirs =
|
||||
concatStringsSep ":" (map (profile: "${profile}/share") profiles);
|
||||
dataDirs = concatStringsSep ":"
|
||||
(map (profile: "${profile}/share") profiles
|
||||
++ config.targets.genericLinux.extraXdgDataDirs);
|
||||
in { XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; };
|
||||
|
||||
home.sessionVariablesExtra = ''
|
||||
|
|
|
@ -4,13 +4,16 @@ with lib;
|
|||
|
||||
{
|
||||
config = {
|
||||
targets.genericLinux.enable = true;
|
||||
targets.genericLinux = {
|
||||
enable = true;
|
||||
extraXdgDataDirs = [ "/foo" ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||
assertFileContains \
|
||||
home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"'
|
||||
'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share:/foo''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"'
|
||||
assertFileContains \
|
||||
home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'. "${pkgs.nix}/etc/profile.d/nix.sh"'
|
||||
|
|
Loading…
Reference in a new issue