-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos: set default for boot.tmpOnTmpfs to true #17494
Conversation
@cmfwyp, thanks for your PR! By analyzing the annotation information on this pull request, we identified @ehmry, @domenkozar and @vcunat to be potential reviewers |
848b407
to
6083f5b
Compare
One concern that I have is that building massive projects like Chromium can eat all the RAM with tmpfs because Nix creates build directories in |
Nitpick: Shouldn't this option be named |
Yes, that would be the correct option name. I can push a commit to rename it to that and alias the old name. @abbradar Good point. Builds are something that would preferably be done in memory, to make them faster and use the disk less, but systems may not have a swap file and therefore come out of memory pretty fast with some builds, which is a more important concern. On the other hand, I think this would already be an issue when using Nix on most Linux distributions that mount a tmpfs on /tmp; which can mean either that this is already a problem on these distributions and that the path should be changed to /var/tmp (how likely is changing the default path for Nix to break things?), or that it has not been a problem on these distributions and as a consequence that it should not be a problem for NixOS either. /tmp is the more semantically-correct place for builds, since they do not need to persist for a long time or even through reboots, but it is not ideal for large files.1 1: A good comparison: http://0pointer.de/blog/projects/tmp.html. |
@cmfwyp Subjectively that would be a bigger problem on NixOS because it's the main platform for overall Nix development and also for Hydra hosts, which together (anecdotally!) account for almost all "big" builds in the Linux/Nix world. That said, I also do like I'm not sure how this problem should be solved. For some prior experience, on Arch Linux |
In Gentoo Linux I usually mount Maybe something in this line can be figured out for NixOS too. |
This currently uses the tmp.mount systemd unit. Mounting /tmp as a tmpfs keeps /tmp clean on boot and diminishes disk usage, which in turn can save power and increase lifetime of SSD devices. It is the default behavior on Arch Linux, Fedora, and Ubuntu. Since this is an incompatible change, an item was added to the release notes for 17.03.
d193d73
to
51980a1
Compare
The more common name seems to be "tmp on tmpfs" ([1] [2] [3] [4]), so I suggest keeping that. Regarding large builds, I see multiple options. Adding a meta-attribute for build expressions that use large files is not an elegant solution. Build servers (Hydra or otherwise) that do builds with large files can set Builds could also all be done in |
Deferred to 17.09 because a solution to use another directory on a per build basis would be needed. |
Another solution may be to make Nix build in |
Any news on this one? Will this make it into 18.03? |
Adopting into 18.09 not for definitive inclusion, but since it previously was part of release milestones. I would like to know if the previous concerns are still relevant, and what work is being done to fix them, if any. And while I was sending this, something related popped-up
This may be a valid concern, with the previously shared concerns. |
It's a rather special use case, but I disabled this on the |
|
Motivation for this change
Mounting /tmp as a tmpfs keeps /tmp clean on boot and diminishes disk usage, which in turn can save power and increase lifetime of SSD devices. It is the default behavior on Fedora, Arch Linux, and Ubuntu.
Things done
This currently uses the tmp.mount systemd unit, which has issues #14777 and #10670. It is perhaps preferable to wait for #14778 to be merged so that these issues are solved.
Since this is an incompatible change, I added an item to the release notes for 16.09.