1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00

home-environment: add home.sessionSearchVariables

This commit introduces `home.sessionSearchVariables` option, that is
created to be a "generic" version of `home.sessionPath` for any
environment variables that is similar to PATH (e.g.: MANPATH). This
allows composition of those variables between multiple modules, avoiding
issues like this one:

https://github.com/nix-community/home-manager/pull/4579/files#r1364374048

This commit also reimplements `home.sessionPath` as terms of
`home.sessionSearchVariables`, to reduce code duplication and show that
the code is correct.

The behavior is to prepend the new search paths. This will allow
the user to override the defaults easily by setting it later in the
configuration.
This commit is contained in:
Thiago Kenji Okada 2025-03-09 12:47:25 +00:00 committed by Austin Horstman
parent 07f505f91e
commit 277eea1cc7
5 changed files with 59 additions and 7 deletions

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
imports = [
@ -10,6 +10,6 @@
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmSessVars
assertFileContains $hmSessVars \
'export PATH="$PATH''${PATH:+:}bar:baz:foo"'
'export PATH="bar:baz:foo''${PATH:+:}$PATH"'
'';
}