Hacker News new | ask | show | jobs
by lima 1101 days ago
My biggest issue with Nix flakes right now is the way it integrates with Git.

It insists on copying the entire repository into the Nix store (which makes all of its content world-readable!). Even if your flake.nix is in a subdirectory of a monorepo, the entire monorepo will be copied into the store every time!

5 comments

It's a known issue but fortunately is being worked on: https://github.com/NixOS/nix/pull/6530
Doesn't this still copy the repo, but just doesn't unzip it?
I think it only lazily copies files that are referenced by your nix expression.

I tested this branch, and a flake-based shell launched in 3 seconds inside a large monorepo (vs 30 seconds before). I don't think it is possible to copy this repo in 3 seconds.

I hope that helps with nixpkgs repo as this takes a lot of time whenever it is updated.
I don't think it will. There isn't any good way to incrementally fetch remote nix files, so to use nixpkgs it all has to be downloaded and unpacked.
Unless you mean when developing on the nixpkgs repo, in which case it could help.
ah, yeah, we have a cheeky workaround for this in Devbox ;-)

https://github.com/jetpack-io/devbox/blob/main/internal/impl...

Yeah this is annoying purely from a disk space perspective too as I easily go through 200GB of disk space in a day if I'm actively working and iterating on some Nix code
Isn't it the same with channels though? On my system `/nix/var/nix/profiles/per-user/root/channels/nixos` is a symlink to `/nix/store/[...]-nixos-23.05/nixos`.
Yes, but channels are updated less often and it's very unusual to put an application git repository into one.

You might have two dozen flakes in your system. You'll typically only have a single channel, if you use them.

Is this still an issue when using gitignoreSrc?

https://github.com/hercules-ci/gitignore.nix

For me, yes. Even with a completely clean checkout, the repo is a few hundred megs.