I'm trying to use nix-shell
with a shell.nix
file to get a clean development environment but I don't know how to change the location of the temporary build directories.
The buildInputs
packages are built in /tmp
but this path doesn't have enough space and I get an error: [Errno 28] No space left on device
during the build.
I tried running nix-shell
with a modified TMPDIR
environment variable but it only affects the location of the nix-shell
temporary files. The nix-build
files are still put in /tmp
.
I also tried to export a new value for TMPDIR
in the shellHook
but it doesn't work.
How can I change the TMPDIR
of nix-build
when it's started by nix-shell
?
Here's my shell.nix
:
let
pkgs = import <nixpkgs> {};
in
pkgs.mkShell {
name = "something";
buildInputs = with pkgs; [
python38
python38Packages.pytorchWithCuda
];
shellHook = ''
'';
}
systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp/nix-daemon";
– Excipient