# Garbage Collection vs Nix Evaluation

**URL:** https://discourse.nixos.org/t/garbage-collection-vs-nix-evaluation/14197
**Category:** Help
**Created:** [July 22, 2021, 7:59am UTC](https://discourse.nixos.org/t/garbage-collection-vs-nix-evaluation/14197 "2021-07-22T07:59:06Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![blitz](https://discourse.nixos.org/user_avatar/discourse.nixos.org/blitz/32/2037_2.png) [@blitz](https://discourse.nixos.org/u/blitz)
#### Post date: [July 30, 2021, 7:45pm UTC](https://discourse.nixos.org/t/garbage-collection-vs-nix-evaluation/14197/7 "2021-07-30T19:45:40Z")

</div>

After some thinking about the GC process, we believe we have a fundamental problem with our approach. We execute our Nix builds from Docker containers. The approach is pretty much identical to what is outlined here in the [NixOS Wiki](https://nixos.wiki/wiki/Gitlab_runner).

These containers have access to the host Nix daemon and store, because they are mapped into the container. Now the problem is that a GC root from the container will actually be a non-existent path in the host system. That means if the build from the container tries to register a path, it will do so with its local chroot path name. The Nix daemon then presumably ignores/removes GC roots that point to non-existent paths.

So the solution is to not use Nix from inside Docker. 😉 Or at least try to configure the GC to not coincide with build jobs.

---

_[View the full topic](https://discourse.nixos.org/t/garbage-collection-vs-nix-evaluation/14197)._
