nixos: Support fileSystems.<name>.depends with fstab-generator
Description of changes
I have barely tested this, so I'm not entirely sure it's correct. Closes #217179
Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [ ] x86_64-darwin
- [ ] aarch64-darwin
- [ ] For non-Linux: Is
sandbox = trueset innix.conf? (See Nix manual) - [x] Tested, as applicable:
- NixOS test(s) (look inside nixos/tests)
- and/or package tests
- or, for functions and "core" functionality, tests in lib/tests or pkgs/test
- made sure NixOS tests are linked to the relevant packages
- [ ] Tested compilation of all packages that depend on this change using
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage - [ ] Tested basic functionality of all binary files (usually in
./result/bin/) -
23.05 Release Notes (or backporting 22.11 Release notes)
- [ ] (Package updates) Added a release notes entry if the change is major or breaking
- [ ] (Module updates) Added a release notes entry if the change is significant
- [ ] (Module addition) Added a release notes entry if adding a new NixOS module
- [ ] Fits CONTRIBUTING.md.
This would fix #217179
@nikstur I updated this with a little bit of tweaking to the overlay fs stuff. The depends functionality should be the same on systemd initrd, with slightly better behavior in scripted initrd. While testing with scripted, I noticed it doesn't work with the ro overlays, so I just added an assertion to disallow that, rather than trying to implement it.
(I also nixfmt'd some of this, so forgive the reformatting).
I'll note that ofBorg is unhappy for the same reason that I created https://github.com/NixOS/nixpkgs/pull/320846: the value of the message depends on the assertion failing, and as written it doesn't protect against that being so.
the value of the message depends on the assertion failing, and as written it doesn't protect against that being so.
@philiptaron No, that's not what's causing ofborg to fail. I apparently committed the assertion without testing that it works correctly. It should be fs.overlay.upperdir, not fs.upperdir. My bad. The message only depends on fs.mountPoint, which should always exist.