WIP: btrfs-subvol support impermanence on provision #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently you have to boot the system once before you can convert it to impermanence, manually creating your persistent data subvol and then after switching to it, deleting the
@
subvol.This is suboptimal, and it should be possible to directly provision with impermanence.
First up, the RAMIFY tooling is annoying, and now that btrfs-progs will (soon) support subvol creation during mkfs, throw that all away and use it instead, removing the risk of the metadata allocation filling up during the shuffle and throwing ENOSPC. As the in-line override is only used during the build of the sdImage, it's contained away from everything else enough I'm happy to do this for now, I expect it'll be able to be removed in a month.
Second with impermanence, / won't be around, so we need to pick someplace that will be persistent to hold nix-path-registration. All of /nix is probably persistent, and I don't really want to stuff it into /nix/store, so into /nix it goes. It's a bootstrap detail, so it's created during sdImage creation and used on first-boot, we can change its location however we want without breaking live systems.
Finally, we work out the subvolMap passed to the forked make-btrfs-fs from config.system.build.fileSystems(?) so
/
can be a tmpfs. It could use some more asserts for sanity checking, but is otherwise ready to go.Last patch is not boot tested yet, as the first pass missed re-sizing, so I need to re-run that.
Ref: #18