[Nix#8995] Nix configuration option for overriding TMPDIR #112

Closed
opened 2024-03-16 06:44:58 +00:00 by lix-bot · 1 comment
Member

Upstream-Issue: NixOS/nix#8995

Is your feature request related to a problem? Please describe.
I'm running Nix with a case-sensitive store on macOS, where the root filesystem is case-insensitive. This allows me to store outputs with case-colliding files. However, the temporary directory used to download/unpack archives and to build derivations is located inside of $TMPDIR, with a fallback to /tmp, which means it occurs on my case-insensitive root volume instead of my case-sensitive Nix store.

Describe the solution you'd like
Nix should have a configuration option that sets the location for the temporary directory, which if set will override the TMPDIR env var. Nix can consult this config option first before looking at the TMPDIR env var. This way I can set the config value to a path in my Nix store (e.g. /nix/tmp) and not have to worry about the TMPDIR env var.

Describe alternatives you've considered
For the time being I'm using an overlay that replaces the nix derivation with a wrapper that sets TMPDIR, but this causes problems (the most obvious being unnecessary rebuilds of anything that depends on it). I'm considering removing the overlay in favor of customizing nix.package, but this means any other derivations that use nix won't get the desired temporary directory. Also anything that uses Nix as a library may use the wrong temporary directory for Nix-related actions.

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/8995 **Is your feature request related to a problem? Please describe.** I'm running Nix with a case-sensitive store on macOS, where the root filesystem is case-insensitive. This allows me to store outputs with case-colliding files. However, the temporary directory used to download/unpack archives and to build derivations is located inside of `$TMPDIR`, with a fallback to `/tmp`, which means it occurs on my case-insensitive root volume instead of my case-sensitive Nix store. **Describe the solution you'd like** Nix should have a configuration option that sets the location for the temporary directory, which if set will override the `TMPDIR` env var. Nix can consult this config option first before looking at the `TMPDIR` env var. This way I can set the config value to a path in my Nix store (e.g. `/nix/tmp`) and not have to worry about the `TMPDIR` env var. **Describe alternatives you've considered** For the time being I'm using an overlay that replaces the `nix` derivation with a wrapper that sets `TMPDIR`, but this causes problems (the most obvious being unnecessary rebuilds of anything that depends on it). I'm considering removing the overlay in favor of customizing `nix.package`, but this means any other derivations that use `nix` won't get the desired temporary directory. Also anything that uses Nix as a library may use the wrong temporary directory for Nix-related actions. **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
imported
label 2024-03-16 06:44:58 +00:00
Author
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2103 ("feat: Add temp-dir setting")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2103", "number": 2103, "kind": "commit message"}], "cl_meta": {"2103": {"change_title": "feat: Add temp-dir setting"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2103](https://gerrit.lix.systems/c/lix/+/2103) ("feat: Add temp-dir setting")
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#112
No description provided.