Repository navigation
Conversation
0e8789b to
e1dcff3
Compare
78ea1aa to
47db8b8
Compare
47db8b8 to
331f943
Compare
331f943 to
0402074
Compare
103994b to
f8be66a
Compare
f8be66a to
73a4581
Compare
48be000 to
6d9f996
Compare
6d9f996 to
053e903
Compare
053e903 to
65d7cad
Compare
|
Gave a look over the nix stuff and it looks fine, but unfortunately I do not have a lot of systemd-specific knowledge to say about the config changes. It would also be nice to have some nixos tests dedicated to this feature. I'll give the rust a look later. |
|
I don't think it's acceptable to add so much nspawn related logic hardcoded into switch-to-configuration. I'm struggling to see the use-case we're trying to solve here, since it doesn't look like any of the |
Thanks for the review! I do actually have some NixOS tests for all of this in m1cr0man/python-nixos-nspawn which I used to validate the latest set of commits here. I will port those into NixOS if/when the whole of RFC108 can be mainlined. This PR is meant to cover only the changes which I cannot perform outside of nixpkgs.
The main issue these changes solve is that imperative containers would otherwise be shut down by switch-to-configuration. Systemd-nspawn containers exist both as Additionally, there is logic to handle the changing (and ignoring) of specific fields in the The intention of this PR has always been to add the minimal set of changes to nixpkgs to make RFC108 operational on NixOS. I really can't see a solution to making things work correctly which does not involve special code in switch-to-configuration. I don't like it either honestly, but given that unique setup of nspawn containers I mentioned, it is a necessary evil. Maintaining this patchset over the last 2 years has been quite painful - it started off being part of switch-to-configuration.pl and I had to then perform the Rust port. I'd really like to get this merged so I can focus on the container modules themselves. |
|
I'm testing a solution which requires no changes to STC and no new unit attributes. Hope to report back soon. |
|
OK, it has been done. It wasn't zero changes to STC... because I found a bug. None of the changes are technically specific to RFC108 either - they just so happen to be necessary to make it work. All my commit descriptions go into detail on what has been done here. Looking forward to the reviews 😄 |
6e73503 to
9567dd8
Compare
I think the main issue I see with the changes introduced in this PR is actually a surfacing of an issue with how NixOS manages systemd units. Systemd intends for distros to have three places that units can be managed:
NixOS has the latter two, but lacks the first one (traditionally located at /usr/lib) outside of the first-party units shipped with systemd itself (located in systemd's derivation output path). Because of that, switch-to-configuration and the etc builder for NixOS resorts to managing the units created at build time in /etc/, which ends up conflating the vendor managed units with the end-user managed units, and causes issues for use cases like this, where units are intentionally being managed outside of the NixOS configuration. |
|
@ofborg test switchTest |
To be honest, I don't view this as a problem specific to NixOS. For any systemd distro, you don't really want to edit the vendored unit files. The overrides files are a sufficient way to extend unit configuration if you want to, and otherwise declaring a unit in full affects the result on NixOS the same as it would on another distro. It's a matter of making the correct and conscious decision on how you would like to declare your unit. Network units, on the other hand, are a total pain. You can't mix the vendor config with your own as they use wildcard match patterns. I had some fun working around that in the rest of the module in my other repo. |
That's my exact point though, vendor/manufacturer units can be read-only in a dedicated directory tree (and even on a different read-only mountpoint). With NixOS, we're conflating units created by the vendor (the NixOS config) and the end-user at runtime into one place (/etc), which makes stc's job harder since it now has to differentiate which units it should care about managing, versus which ones it should probably ignore. |
|
Ah yes, I get what you mean now. BTW I ran switchTest locally (wow what a mammoth test that one is) and it unfortunately failed. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Rebased on nixos-unstable. |
|
@r-vdp I see you are working on refactoring STC-NG a bit. Would I be able to ask for your help getting this merged beforehand? I have been maintaining this PR for so long and I would really like to get it into master to stop having to refactor the STC-NG changes regularly. |
|
Rebased on master and re-ran switchTest and activation-template-dropin test locally. |
|
This has now been broken into 5 other PRs. Since none of the work is uniquely specific to RFC108 and has other applicability, plus the fact that this has been stuck for so long, hopefully we can get some stuff merged now. |
There was a problem hiding this comment.
Thanks for contributing to the documentation.
Follow the documentation style guide, especially:
- Show, don’t tell. Start with a minimal working example. Explain after the code.
- Avoid meta-commentary. Don’t write "This section explains how to…".
- Use present tense, imperative mood, and active voice. For example: "Run the command," not "The user should run the following command."
- Avoid vague references like "this" when the referent is unclear. Write "This command creates a folder," not "This will create a folder."
- Be direct. Avoid "should", "might", "typically", and "usually".
- Cut filler words like "simply", "just", "easily", and "basically". Use "to" instead of "in order to".
For larger changes, such as adding or removing whole sections, ask the NixOS documentation team for review.
Two major changes in this commit: - Refactor options to use `.settings` pattern and use settingsToSections to generate the content. This brings the module in line with other modern systemd modules. - Write individual units to etc/: This allows imperative container management to create unit files in /etc/systemd/nspawn
|
#512577 is merged! RFC108 imperative containers are now possible on master. 🎉 |
Description of changes
This is a fork of #140669 in a minified and refactored form covering the changes which cannot be placed in a separate flake.
I have been working on python-nixos-nspawn which implements all the components for managing imperative RFC108 style containers. I have been able to refactor almost all parts of the original POC to work within this repo/flake however I could not find a satisfactory way to otherwise apply the changes covered in this PR.
With this, it would be possible to use python-nixos-nspawn as a tool or module to manage RFC108 containers on any system with networkd enabled + configured appropriately.
TODO
None - all done
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)CC @Ma27