update firstboot examples in docs and tests - #23
Conversation
|
Seems like we should also update the workflows. |
|
Can confirm the tests build locally, likely hitting NixOS/nixpkgs#399245 |
|
Today I had more success with plain config, than with symlink variants mentioned in the docs. This works perfectly fine without any additional configuration: {
file = "/etc/machine-id";
inInitrd = true;
configureParent = true;
} |
Yes, it does work, and for most setups this is sufficient — this setup is also shown in https://nix-community.github.io/preservation/examples.html#simple. However, in the first-boot section, the goal is not only to make machine-id preservation work, but to ensure compatibility with systemd's first-boot semantics. |
|
yeah, it actually fails with a mountpoint until I add that ConditionFirstBoot = true; |
| systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ]; | ||
| boot.initrd.systemd.tmpfiles.settings.preservation."/sysroot/persistent/etc/machine-id".f = { | ||
| argument = "uninitialized"; | ||
| }; |
There was a problem hiding this comment.
It might be worth adding an explicit option for the tmpfiles argument, rather than requiring users to write something like boot.initrd.systemd.tmpfiles.settings.preservation."/sysroot/persistent/etc/machine-id".f.argument.
That would be more ergonomic and less coupled to the implementation details of preservation, making it less likely to break if the implementation changes in the future.
There was a problem hiding this comment.
I agree: having to patch the generated tmpfiles rules is awkward.
I see 2 possible improvements (inclusive or'ed):
- add an option like
initialContenttopreserveAt.*.files - have an opinionated option to setup machine-id properly:
preservation.machine-id.preserveAt :: paththat sets up everything (apreserveAt.${config.preservation.machine-id.preserveAt}.filesentry, and patches the tmpfiles rule &systemd-machine-id-commit.service)
I think 2 would be nicer in the long term: on top of being more ergonomic than 1 (less specific knowledge needed about machine-id, and hiding implementation details better), it avoids users copy-pasting magic configuration that needs to be updated from time to time, which is easy to miss both initially and when updated.
ThinkChaos
left a comment
There was a problem hiding this comment.
The updated documentation works for me, thank you!
| systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ]; | ||
| boot.initrd.systemd.tmpfiles.settings.preservation."/sysroot/persistent/etc/machine-id".f = { | ||
| argument = "uninitialized"; | ||
| }; |
There was a problem hiding this comment.
I agree: having to patch the generated tmpfiles rules is awkward.
I see 2 possible improvements (inclusive or'ed):
- add an option like
initialContenttopreserveAt.*.files - have an opinionated option to setup machine-id properly:
preservation.machine-id.preserveAt :: paththat sets up everything (apreserveAt.${config.preservation.machine-id.preserveAt}.filesentry, and patches the tmpfiles rule &systemd-machine-id-commit.service)
I think 2 would be nicer in the long term: on top of being more ergonomic than 1 (less specific knowledge needed about machine-id, and hiding implementation details better), it avoids users copy-pasting magic configuration that needs to be updated from time to time, which is easy to miss both initially and when updated.
Flake lock file updates:
• Updated input 'flake-parts':
'github:hercules-ci/flake-parts/4524271976b625a4a605beefd893f270620fd751?narHash=sha256-%2BuWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw%3D' (2025-09-01)
→ 'github:hercules-ci/flake-parts/f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb?narHash=sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4%3D' (2026-05-13)
• Updated input 'flake-parts/nixpkgs-lib':
'github:nix-community/nixpkgs.lib/a73b9c743612e4244d865a2fdee11865283c04e6?narHash=sha256-x2rJ%2BOvzq0sCMpgfgGaaqgBSwY%2BLST%2BWbZ6TytnT9Rk%3D' (2025-08-10)
→ 'github:nix-community/nixpkgs.lib/f5901329dade4a6ea039af1433fb087bd9c1fe14?narHash=sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ%3D' (2026-04-26)
• Updated input 'nixpkgs':
'github:nixos/nixpkgs/8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9?narHash=sha256-NOrUtIhTkIIumj1E/Rsv1J37Yi3xGStISEo8tZm3KW4%3D' (2025-09-05)
→ 'github:nixos/nixpkgs/a799d3e3886da994fa307f817a6bc705ae538eeb?narHash=sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY%3D' (2026-06-06)
ede2d13 to
1566cc1
Compare
1566cc1 to
b1b12d1
Compare
Update the firstboot examples in the documentation and tests to be compatible with systemd v258.
Closes #22