# Flakes without Git copies entire tree to Nix store

**URL:** https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743
**Category:** Help
**Created:** [December 30, 2020, 9:45am UTC](https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743 "2020-12-30T09:45:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hmenke](https://discourse.nixos.org/user_avatar/discourse.nixos.org/hmenke/32/2369_2.png) [@hmenke](https://discourse.nixos.org/u/hmenke)
#### Post date: [December 30, 2020, 9:45am UTC](https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743/1 "2020-12-30T09:45:40Z")

</div>

Say I have a directory with some big files. Let’s create a 100 MB file as an example:

```plaintext
$ mkdir flake-test
$ cd flake-test
$ dd if=/dev/zero of=big-file bs=1024 count=100000

```

Now I want to analyze my data and need some tools for that. Of course I do this using a Nix shell environment. For this I create a new `flake.nix`:

```auto
{
  description = "big-file";
  outputs = { self, nixpkgs }: let
    system = "x86_64-linux";
  in
  with nixpkgs.legacyPackages.${system};
  {
    devShell.${system} = mkShell {
      buildInputs = [hello];
    };
  };
}

```

Let’s run `nix develop`. Hm, this is taking longer than I expected and suddenly my disk usage is going up a lot. What’s happening?

```auto
$ find /nix/store -maxdepth 2 -name 'big-file'
/nix/store/pjr81pnji330cdc980kr3dl9c2495hpm-source/big-file

```

Eh, what?

Why did Nix just copy my entire tree to the Nix store? Is there a way to prevent this? (except tracking the directory in Git) It doesn’t happen when I use old `nix-shell`.

---

<div class="post-metadata">

### Author: ![edolstra](https://discourse.nixos.org/user_avatar/discourse.nixos.org/edolstra/32/84_2.png) [@edolstra](https://discourse.nixos.org/u/edolstra)
#### Post date: [December 30, 2020, 9:57am UTC](https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743/2 "2020-12-30T09:57:26Z")

</div>

There is currently no way to prevent this, see [Copy local flakes to the store lazily · Issue #3121 · NixOS/nix · GitHub](https://github.com/NixOS/nix/issues/3121).

---

<div class="post-metadata">

### Author: ![hmenke](https://discourse.nixos.org/user_avatar/discourse.nixos.org/hmenke/32/2369_2.png) [@hmenke](https://discourse.nixos.org/u/hmenke)
#### Post date: [December 30, 2020, 10:06am UTC](https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743/3 "2020-12-30T10:06:19Z")

</div>

Hm, that’s a real bummer. Looks like I’m stuck with `nix-shell` for now then. At least I can still use `flake.nix` thanks to your `flake-compat`.
