:PROPERTIES: :ID: 3c67e623-c269-4c9b-9bdf-4ad677d46a35 :END: #+title: systemd environment directives #+date: 2021-08-07 19:58:29 +08:00 #+date_modified: 2021-08-07 19:59:45 +08:00 #+language: en systemd enables setting the environment through environment directives. Just like how [[id:c7edff80-6dea-47fc-8ecd-e43b5ab8fb1e][systemd at user-level]], you can set it at user-level by placing them in certain user-level load paths (e.g., =$XDG_CONFIG_HOME/environment.d=). It needs a =*.conf= file in one of the load paths (seen from the =environment.d.5= manual page). Keep in mind it does not use the shell and instead makes use of shell-like syntax. The following code block is an example of setting Nix-related environment variables to enable desktop integrations. #+begin_src ini # Enable desktop integration with Nix-installed applications. NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH PATH=${PATH:+$PATH:}$HOME/.nix-profile/bin XDG_DATA_DIRS=${XDG_DATA_DIRS:+$XDG_DATA_DIRS:}$HOME/.nix-profile/share/ #+end_src