fix(nix/darwin): Fix sessionVariables is being not passed to GUI apps unless it's
opened via terminal
This commit is contained in:
parent
c4d1bfd8e4
commit
4c7ec25d38
1 changed files with 17 additions and 0 deletions
|
@ -33,6 +33,23 @@
|
||||||
MOZ_ALLOW_DOWNGRADE = 1;
|
MOZ_ALLOW_DOWNGRADE = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Pass sessionVariables to GUI apps with launchctl
|
||||||
|
#
|
||||||
|
# REF: https://github.com/nix-community/home-manager/pull/5801/commits/dbe54a48a0bc9942289f6a5d8a751ed3be065c81
|
||||||
|
launchd.agents.launchctl-setenv = let
|
||||||
|
launchctl-setenv = pkgs.writeShellScriptBin "launchctl-setenv"
|
||||||
|
(concatStringsSep "\n" (mapAttrsToList
|
||||||
|
(name: val: "/bin/launchctl setenv ${name} ${toString val}")
|
||||||
|
config.home.sessionVariables));
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
ProgramArguments = [ "${launchctl-setenv}/bin/launchctl-setenv" ];
|
||||||
|
KeepAlive.SuccessfulExit = false;
|
||||||
|
RunAtLoad = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home.activation.applications = let
|
home.activation.applications = let
|
||||||
env = pkgs.buildEnv {
|
env = pkgs.buildEnv {
|
||||||
name = "home-applications";
|
name = "home-applications";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue