generic-linux: respect NIX_STATE_DIR

This commit is contained in:
Robert Helgesson 2020-06-14 23:34:53 +02:00
parent dc227b579d
commit ecb93ab9ae
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 3 additions and 2 deletions

View file

@ -16,7 +16,8 @@ in {
config = mkIf config.targets.genericLinux.enable {
home.sessionVariables = let
profiles = [ "/nix/var/nix/profiles/default" profileDirectory ];
profiles =
[ "\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default" profileDirectory ];
dataDirs =
concatStringsSep ":" (map (profile: "${profile}/share") profiles);
in { XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; };

View file

@ -10,7 +10,7 @@ with lib;
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/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''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'. "${pkgs.nix}/etc/profile.d/nix.sh"'