You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetchingNetworking with the outside (non-Nix) world, input lockingflakessignificantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.
Currently flakes are evaluated from the Nix store, so when using a local flake, it's first copied to the store. This means that
$ cd /path/to/nixpkgs
$ nix build .#hello
is a lot slower than the non-flake alternative
$ nix build -f . hello
Ideally, we would copy the flake to the store only when its outPath attribute is evaluated. However, we also need to ensure that it's not possible to access untracked files (i.e. we need to check every file against git ls-files).
Reacted by Henri Menke, Marek Rychly, Tristan Maat, Tim DeHerrera, Bobby Rong, Piper McCorkle, Sandro, Roman Frołow, Brendan Zabarauskas, Roman Gonzalez and 149 more
Reacted by Muaz and Ethan Shumate
Reacted by AleXoundOS, Roman Gonzalez, Yipeng Sun, Arash Sal Moslehian, John Soo, Cody Schafer, ErrorNoInternet, Suraj, giladwo, sokai and 12 more
It would be nice if Nix could take advantage of the filesystem's native CoW functionality (if present) in order to speed up copying.
We discussed this briefly in #offtopic:nixos.org.
Reacted by asymmetric, Damián Franco Álvarez, Antoine Martin, Ellie Hermaszewska, Jess, AleXoundOS, Austin Horstman, giladwo, Peter A., Mat and 14 more
Also for context, in my case the flake was not in a git repo, it was just in a folder. Copying to the nix store is unacceptable because the folder contains multiple git repos along with all their build artifacts. Copying a git repo to the Nix store at least would avoid copying untracked files, but in my case it had hundreds of thousands of files and multiple gigabytes of data to look at and copy.
Reacted by Bjørn Stabell, Emmanuel Lebeaupin, anpandey, John Soo, Emanuel Särnhammar, Tobias Bergkvist, Benjamin Saunders, Qyriad, Renan Ribeiro, Alessandro Re and 10 more
While that reduces the space usage needed asynchronously, it still does a copy which wastes IO time and write endurance.
Reacted by Francesco Gazzetta, Pavel Atanasov, Tyler Miller, Mel Bourgeois, Yipeng Sun, Dennis Gosnell, Arian Baishya, Matthew Burns, Patrick Shaw, Theo Paris and 1 more
Thank you. I guess I forgot that that mechanism works based off of file content and not nix store hash (or something else).
I am using that currently, but I have to run a custom nix store optimise daemon/service on a schedule instead of using the option (as the option causes random build issues/failures on darwin last I checked).
It sounds like even using that option causes extra fs writes to occur however (but will work for saving space alone).
note that reflinking is something an application must choose to do; it is not the default.
I don't think it's worth spending time on this at this point though as it's much more important to push #6530 forward. After that's done, reflinking would be an extremely minor optimisation; probably not signficant enough to be worth considering.
@Atemu Reflinking wouldn’t be significant for reducing the copies incurred by the eval, but it could still be significant in reducing the otherwise still necessary copies of inputs for the build itself, right?
I'm not sure what you mean by that. Reflink copies speed up copying any path to the Nix store aswell as reducing storage cost (though in an unpredictable manner) but the best thing to do on any case is to copy as few things to the Nix store as possible.
For reducing copies between existing build inputs in the Nix store, the right tool is Nix store optimisation as @fgaz mentioned and it's filesystem-agnostic.
My attempt at doing this in #15711, @edolstra has done a lot of good work to make that PR possible, I'm just putting the pieces together. Feedback welcome of course.
Reacted by hakan-demirli, Kasper Kondzielski, Axel Karjalainen, Benoit de Chezelles, Chris McDevitt, Nikita Pedorich, Keegan Carruthers-Smith, sokai, Francesco Gazzetta, Matthieu Coudron and 6 more
fetchingNetworking with the outside (non-Nix) world, input lockingflakessignificantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.
Activity
nixos-discourse commentedon Dec 30, 2020
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/flakes-without-git-copies-entire-tree-to-nix-store/10743/2
hmenke commentedon Jun 28, 2021
Still important.
nixos-discourse commentedon Jul 26, 2021
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/my-painpoints-with-flakes/9750/20
L-as commentedon Sep 3, 2021
It would be nice if Nix could take advantage of the filesystem's native CoW functionality (if present) in order to speed up copying.
We discussed this briefly in #offtopic:nixos.org.
nixos-discourse commentedon Nov 13, 2021
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/is-it-possible-to-make-a-flake-that-has-no-source-tree/16037/2
lilyball commentedon Nov 13, 2021
lilyball commentedon Nov 13, 2021
Also for context, in my case the flake was not in a git repo, it was just in a folder. Copying to the nix store is unacceptable because the folder contains multiple git repos along with all their build artifacts. Copying a git repo to the Nix store at least would avoid copying untracked files, but in my case it had hundreds of thousands of files and multiple gigabytes of data to look at and copy.
132 remaining items
fgaz commentedon Sep 22, 2024
@tmillr you can set
auto-optimise-store = trueinnix.conf.Atemu commentedon Sep 22, 2024
While that reduces the space usage needed asynchronously, it still does a copy which wastes IO time and write endurance.
tmillr commentedon Sep 23, 2024
Thank you. I guess I forgot that that mechanism works based off of file content and not nix store hash (or something else).
I am using that currently, but I have to run a custom
nix store optimisedaemon/service on a schedule instead of using the option (as the option causes random build issues/failures on darwin last I checked).It sounds like even using that option causes extra fs writes to occur however (but will work for saving space alone).
nixos-discourse commentedon Oct 1, 2024
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/confused-about-nix-copying-nixpkgs/53737/2
anka-213 commentedon Oct 3, 2024
@Atemu Reflinking wouldn’t be significant for reducing the copies incurred by the eval, but it could still be significant in reducing the otherwise still necessary copies of inputs for the build itself, right?
Atemu commentedon Oct 3, 2024
I'm not sure what you mean by that. Reflink copies speed up copying any path to the Nix store aswell as reducing storage cost (though in an unpredictable manner) but the best thing to do on any case is to copy as few things to the Nix store as possible.
For reducing copies between existing build inputs in the Nix store, the right tool is Nix store optimisation as @fgaz mentioned and it's filesystem-agnostic.
Use flake-compat to get the host configurations instead of getFlake
nixos-discourse commentedon Oct 27, 2024
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nix-team-member-suggests-removing-flakes-data-suggest-it-isnt-a-good-idea-please-remove-the-experimental-flag-instead/54959/78
nixos-discourse commentedon Nov 9, 2024
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/how-can-i-delete-sensitive-information-copied-into-nix-store-by-flake/55782/1
nixos-discourse commentedon Jan 22, 2025
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/flakes-for-development-in-large-repos/59180/3
nix-flakes etude (#247)
xokdvium commentedon Apr 19, 2026
My attempt at doing this in #15711, @edolstra has done a lot of good work to make that PR possible, I'm just putting the pieces together. Feedback welcome of course.
lisanna-dettwyler commentedon Jun 9, 2026
Completed in #15711