NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.6k stars 1.51k forks source link

Check free disk space before download #4159

Open davidak opened 4 years ago

davidak commented 4 years ago

Describe the bug

Nix wants to download over 100 GB, but i have only 18 GB free.

It should not start since it will fail!

[davidak@gaming:~/code/nixpkgs]$ nix-shell -p nixpkgs-review --run "nixpkgs-review pr 100947"
$ git -c fetch.prune=false fetch --force https://github.com/NixOS/nixpkgs master:refs/nixpkgs-review/0 pull/100947/head:refs/nixpkgs-review/1
remote: Enumerating objects: 4295, done.
remote: Counting objects: 100% (4295/4295), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7529 (delta 4291), reused 4289 (delta 4289), pack-reused 3234
Receiving objects: 100% (7529/7529), 7.13 MiB | 8.18 MiB/s, done.
Resolving deltas: 100% (5328/5328), completed with 1394 local objects.
From https://github.com/NixOS/nixpkgs
   a9637e5b521..7c4305be84a  master                -> refs/nixpkgs-review/0
 + 9bac00e7497...1d65c536654 refs/pull/100947/head -> refs/nixpkgs-review/1  (forced update)
$ git worktree add /home/davidak/.cache/nixpkgs-review/pr-100947/nixpkgs 7c4305be84ae74499e1ddd9b8e97bcaaf6da0f7d
Preparing worktree (detached HEAD 7c4305be84a)
Updating files: 100% (22965/22965), done.
HEAD is now at 7c4305be84a Merge pull request #100873 from AtnNn/gtest
$ git merge --no-commit 1d65c5366544db3581c1d4799a308eb03c9d8430
Automatic merge went well; stopped before committing as requested
$ nix build --no-link --keep-going --option build-use-sandbox relaxed -f /home/davidak/.cache/nixpkgs-review/pr-100947/build.nix
warning: ignoring the user-specified setting 'sandbox', because it is a restricted setting and you are not a trusted user
[0/10943 built, 16/703/10029 copied (11118.6/104440.0 MiB), 7379.6/44743.2 MiB DL]
error: interrupted by the user
$ git worktree prune

[davidak@gaming:~/code/nixpkgs]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.6G     0  1.6G   0% /dev
tmpfs            16G  3.7G   13G  24% /dev/shm
tmpfs           7.9G  7.7M  7.9G   1% /run
tmpfs            16G  480K   16G   1% /run/wrappers
/dev/sda2       450G  412G   18G  96% /
tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
tmpfs            16G  2.4M   16G   1% /tmp
tmpfs           3.2G  100K  3.2G   1% /run/user/1000

Related to https://github.com/NixOS/nix/issues/4137

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

fail with error or at least show warning

nix-env --version output nix-env (Nix) 2.3.7

Additional context

Add any other context about the problem here.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

twhitehead commented 1 year ago

If this was ever implemented, would be better to do it on a per-download than entire download because otherwise it will start refusing to download when it would actually succeed on those of use that use on-the-fly disk compression.