mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 04:58:21 +00:00
1 line
3.0 KiB
JSON
1 line
3.0 KiB
JSON
{"pageProps":{"metadata":{"date":"2021-08-07 19:58:29 +08:00","date_modified":"2022-04-16 20:19:15 +08:00","language":"en","source":""},"title":"systemd environment directives","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"systemd enables setting the environment through environment directives.\nFor some, this is a nice shell-agnostic way of setting environment variables and could replace setting through shell profiles (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":".bashrc"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":".profile"}]},{"type":"text","value":").\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It needs a "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"*.conf"}]},{"type":"text","value":" file in one of the load paths (seen from the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"environment.d.5"}]},{"type":"text","value":" manual page).\nJust like how "},{"type":"element","tagName":"a","properties":{"href":"/linux.systemd#systemd-at-user-level"},"children":[{"type":"text","value":"systemd at user-level"}]},{"type":"text","value":", you can set it at user-level by placing them in certain user-level load paths (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"$XDG_CONFIG_HOME/environment.d"}]},{"type":"text","value":").\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Keep in mind it does not use the shell directly and instead makes use of shell-like syntax.\nThe syntax takes variable substitutions and parameter expansion seen from "},{"type":"element","tagName":"a","properties":{"href":"id:dd9d3ffa-03ff-42a1-8c5d-55dc9fcc70fe"},"children":[{"type":"text","value":"GNU Bash"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The following code block is an example of setting Nix-related environment variables to enable desktop integrations.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-ini"]},"children":[{"type":"text","value":"# Enable desktop integration with Nix-installed applications.\nNIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH\nPATH=${PATH:+$PATH:}$HOME/.nix-profile/bin\nXDG_DATA_DIRS=${XDG_DATA_DIRS:+$XDG_DATA_DIRS:}$HOME/.nix-profile/share/\n"}]}]}]},"backlinks":[{"path":"/linux.systemd","title":"systemd"}]},"__N_SSG":true} |