DTSPCDENV(4)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

Hiii bestie πŸ’– so you've stumbled into dtspcdenv(special file) β€” yeah, that's the manual section, "special file", we're doing fancy today β€” and honestly? This page is a whole vibe check on how environment variables travel between systems. Let's get into it. πŸ¦‹


πŸŽ€ NAME πŸŽ€

dtspcdenv β€” the environment Variable File for the CDE Subprocess Control Service ✨


🌸 DESCRIPTION 🌸

Okay so picture this: the CDE Subprocess Control service is the icon that lets a process running on one system go invoke another process on a totally different system. Cross-host main character energy. πŸ‘‘

By default, the parent process's environment variables get passed to the child process (that's the one on the remote host) unmodified β€” no edits, no notes, just vibes. But some environment variables get special treatment, and on top of that, you (or your system administrator) can specify variables that should be modified on their way to the child process. Slay. πŸ’…

πŸ—‚οΈ the files, bestie

The system-wide environment files are:

/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv
/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv

and the user-specific environment file is:

$HOME/.dt/dtspcdenv

Now listen πŸ‘€ β€” the file /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv is created when CDE is installed. And it may be overwritten by subsequent CDE installations. Rude, but true. 😭 So consequently, your local variable definitions should go in /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv instead, because that file does not get overwritten during installation. Protect your peace. 🫢

⭐ the order of operations (literally)

The environment variable files are evaluated in this exact order:

  1. local host: /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv
  2. local host: /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv
  3. local host: $HOME/.dt/dtspcdenv
  4. remote host: /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv
  5. remote host: /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv
  6. remote host: $HOME/.dt/dtspcdenv

And here's the plot twist πŸŒ€ β€” precedence occurs in the reverse order of evaluation. So variables in the remote host's $HOME/.dt/dtspcdenv file have the highest precedence, and variables in the local host's /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv file have the lowest precedence. iykyk.

In this context: the local host is the host where a CDE client is running, and the remote host is the host where a remote process will be started (on behalf of that local client). Don't mix them up bestie, it's giving chaos otherwise. πŸ’€

✍️ syntax time

Lines beginning with a numer symbol (#) are considered comments and are not processed. (Yes, the original page says "numer" β€” we love a typo moment, it's iconic, keeping it. πŸŽ€)

The syntax for a non-commented line is:

VAR_NAME=some_value

where VAR_NAME is the name of an environment variable and some_value is the value assigned to the variable. Simple, clean, no notes.

πŸ” variable references (the good part)

If some_value contains a variable reference, that reference gets replaced by the variable's value. Fr fr. Example time:

Say a CDE client has this definition in its environment:

PATH=/bin:/sbin:/usr/local/bin

and this definition shows up in one of the environment files:

PATH=/opt/foo/bin:$PATH

then before the remote process is executed, PATH will be expanded to:

PATH=/opt/foo/bin:/bin:/sbin:/usr/local/bin

Ate. πŸ”₯

🧚 names + the unset command

The environment variable names may consist of letters, digits or underscores and may be enclosed in curly braces. πŸ’œ

The environment variable files may also contain unset &<variable_name> commands, which prevent an environment variable from being propagated to the remote process. For example, this line would prevent the variable LIB_PATH from being propagated to the remote process:

unset LIB_PATH

Bye bye LIB_PATH, we hardly knew ye. πŸ‘‹


πŸ‘‘ ENVIRONMENT VARIABLES πŸ‘‘

The dtspcd daemon treats these variables specially β€” pay attention, this is the important part:

  • DISPLAY β€” If DISPLAY is set to "unix:&<n>", "local:&<n>" or ":&<n>" (where &<n> is the screen number), then before the remote process is executed, DISPLAY is changed to the name of the local host and the screen number is preserved. Cute and functional. ✨
  • HOME β€” Before the remote process is executed, HOME is set to the value of the user's home directory in the password file on the remote host. 🏠
  • SHELL β€” If SHELL is not in the parent process's environment, SHELL is set to the value of the user's shell in the password file on the remote host. 🐚
  • PWD β€” The variable PWD is not propagated to the remote host. πŸ™ˆ
Note that all the above variables will be overridden by their corresponding definitions in an environment file. So like, the file always wins. Periodt. πŸ’…

🌈 EXAMPLES 🌈

The following definition sets the variable FOO_BIN_PATH to the value /var/foo/bin:

FOO_BIN_PATH=/var/foo/bin

Short, sweet, sets a variable. Obsessed. πŸ“


πŸ¦‹ FILES πŸ¦‹

  • /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv β€” System-wide, installed environment variable definitions used when a process is executed πŸŽ€
  • /nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv β€” System-wide, locally defined environment variable definitions used when a process is executed ✨
  • $HOME/.dt/dtspcdenv β€” User-specific environment variable definitions used when a process is executed πŸ’–

πŸ’œ SEE ALSO πŸ’œ

  • dtspcd(1m) β€” go read that one next bestie, it's the whole other half of the story πŸ“–

and that's the page!! you made it to the end, I'm so proud of you 🫢 this was dtspcdenv(special file) β€” that's the title and the footer, we keep it consistent around here β€” manifesting good env vars for you and yours. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from