DTSPCDENV(4)
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:
- local host:
/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv - local host:
/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv - local host:
$HOME/.dt/dtspcdenv - remote host:
/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/config/dtspcdenv - remote host:
/nix/store/6waxpwr8lzfzc9ka48gl7yh60rqvlkdb-cde-2.5.3/etc/config/dtspcdenv - 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β IfDISPLAYis set to"unix:&<n>","local:&<n>"or":&<n>"(where&<n>is the screen number), then before the remote process is executed,DISPLAYis changed to the name of the local host and the screen number is preserved. Cute and functional. β¨HOMEβ Before the remote process is executed,HOMEis set to the value of the user's home directory in the password file on the remote host. πSHELLβ IfSHELLis not in the parent process's environment,SHELLis set to the value of the user's shell in the password file on the remote host. πPWDβ The variablePWDis 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
- nixos 26.05: cde 2.5.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms