4 ms·
As opposed to Docker, or Bazel? Conversely I have never had this problem with Nix. It tells you plainly how to clean up garbage. It's easy to interrogate to fi
by xyzzy_plugh 3y ago
As opposed to Docker, or Bazel?
Conversely I have never had this problem with Nix. It tells you plainly how to clean up garbage. It's easy to interrogate to find out what's hanging around, and why. The reason it's not on by default is that, like any garbage collector, it can be disruptive -- there is no "one size fits all" policy.
Ultimately if you have too many gc roots you have to make some decisions.
- aidenn0 3y agoThe problem (especially pre-flakes) with nix (and Docker too; haven't used Bazel) is that if you GC, you can't recreate your previous environment (which version of nixpkgs were you using when you built it/which day did you run apt-get update in your Dockerfile). It appears that Flox uses flakes and versions the flake.lock file, so it should be possible to readily reproduce anything that hasn't completely disappeared from the internet.
- Cyph0n 3y agoTrue, but with Flakes, as long as you didn’t upddate your lock file, you should always be able to rollback to your previous environment. On NixOS, you can then configure background GC to clean up the Nix store periodically: https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=nix.gc https://search.nixos.org/options?channel=23.11&from=0&size=5...
- OJFord 3y agoCan't you just pin pkgs to particular commit, so everything will have the version it did as of that commit?
- aidenn0 3y agoRight, but traditional nix doesn't make that easy (which is why niv and flakes exist).
- OJFord 3y agoI suppose you're just saying it's easier than this with flakes, but this isn't a flake is it? (Honestly so confused about it all, looking at trying out nix again after toying with it briefly years ago.) https://nix.dev/guides/recipes/sharing-dependencies#complete-example https://nix.dev/guides/recipes/sharing-dependencies#complete...
- aidenn0 3y agoThat is not with flakes, nor does it pin nixpkgs. It tracks nixpkgs-23.11 Now at the bottom it links to an example of pinning without using flakes, but the page you linked directly does not pin nixpkgs. Flakes pin by default, and defaults matter. Using flakes, anything that isn't explicitly listed with a hash to ensure it's unchanged must be explicitly listed as an input, and a lock file for the inputs is automatically generated.