fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . xdg . systemDirs ; 8 9configDirs = concatStringsSep ":" cfg . config ; 10 11dataDirs = concatStringsSep ":" cfg . data ; 12 13in { 14meta . maintainers = with maintainers ; [ tadfisher ]; 15 16options . xdg . systemDirs = { 17config = mkOption { 18type = types . listOf types . str ; 19default = [ ]; 20example = literalExpression ''[ "/etc/xdg" ]'' ; 21description = '' 22Directory names to add to {env}`XDG_CONFIG_DIRS` 23in the user session. 24'' ; 25}; 26 27data = mkOption { 28type = types . listOf types . str ; 29default = [ ]; 30example = literalExpression ''[ "/usr/share" "/usr/local/share" ]'' ; 31description = '' 32Directory names to add to {env}`XDG_DATA_DIRS` 33in the user session. 34'' ; 35}; 36}; 37 38config = mkMerge [ 39( mkIf ( cfg . config != [ ] || cfg . data != [ ]) { 40assertions = [ 41( hm . assertions . assertPlatform "xdg.systemDirs" pkgs platforms . linux ) 42]; 43}) 44 45( mkIf ( cfg . config != [ ]) { 46home . sessionVariables . XDG_CONFIG_DIRS = 47" ${ configDirs } \${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}" ; 48 49systemd . user . sessionVariables . XDG_CONFIG_DIRS = 50" ${ configDirs } \${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}" ; 51}) 52 53( mkIf ( cfg . data != [ ]) { 54home . sessionVariables . XDG_DATA_DIRS = 55" ${ dataDirs } \${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ; 56 57systemd . user . sessionVariables . XDG_DATA_DIRS = 58" ${ dataDirs } \${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ; 59}) 60]; 61}