Skip to content

nixos-init: read required data from boot.json#473273

Merged
nikstur merged 2 commits intoNixOS:staging-nixosfrom
r-vdp:rvdp/nixos-init
Jan 26, 2026
Merged

nixos-init: read required data from boot.json#473273
nikstur merged 2 commits intoNixOS:staging-nixosfrom
r-vdp:rvdp/nixos-init

Conversation

@r-vdp
Copy link
Copy Markdown
Contributor

@r-vdp r-vdp commented Dec 22, 2025

This PR does two things:

  1. pass info to nixos-init through bootspec. This has several advantages, it makes it easier to run nixos-init since you only need to supply the toplevel path, which also makes it easier to re-use it in the future to replace the activation script, and it also allows us to clean up some files in the toplevel (like the etc overlay stuff) and instead pass all that info through bootspec.
  2. make it possible to pass / as the prefix. This is a first step to be able to re-use nixos-init during reactivation.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@r-vdp r-vdp requested review from emilazy and nikstur December 22, 2025 12:23
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: systemd Software suite that provides an array of system components for Linux operating systems. labels Dec 22, 2025
@r-vdp r-vdp changed the base branch from master to staging-nixos December 22, 2025 12:31
@nixpkgs-ci nixpkgs-ci Bot closed this Dec 22, 2025
@nixpkgs-ci nixpkgs-ci Bot reopened this Dec 22, 2025
Comment thread pkgs/by-name/ni/nixos-init/src/activate.rs Outdated
Comment thread pkgs/by-name/ni/nixos-init/src/find_etc.rs Outdated
Comment thread nixos/modules/system/activation/top-level.nix Outdated
Comment thread nixos/modules/system/activation/top-level.nix Outdated
Comment thread nixos/modules/system/activation/top-level.nix Outdated
Comment thread pkgs/by-name/ni/nixos-init/src/config.rs Outdated
@r-vdp r-vdp force-pushed the rvdp/nixos-init branch 2 times, most recently from 3f4ec0d to cd0018a Compare December 30, 2025 21:10
@r-vdp r-vdp force-pushed the rvdp/nixos-init branch 2 times, most recently from 0b9bf11 to 0bb0bda Compare January 10, 2026 11:25
@r-vdp
Copy link
Copy Markdown
Contributor Author

r-vdp commented Jan 10, 2026

Somehow the etc-overlay is failing after the latest changes, I'm looking into it

Fixed, we use nixos-init for the find-etc service even if nixos-init isn't explicitly activated, so we need the extra bootspec extension independently of whether nixos-init is enabled.

@r-vdp r-vdp changed the title nixos-init: read required data from a metadata file in the toplevel dir nixos-init: read required data from boot.json Jan 10, 2026
Copy link
Copy Markdown
Contributor

@nikstur nikstur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use nixos-init for the find-etc service even if nixos-init isn't explicitly activated, so we need the extra bootspec extension independently of whether nixos-init is enabled.

This effectively makes the systemd initrd depend on bootspec now. Since the systemd-boot builder already depends on bootspec, however, this is fine IMO.

Comment thread pkgs/by-name/ni/nixos-init/Cargo.toml
Comment thread pkgs/by-name/ni/nixos-init/src/find_etc.rs Outdated
@r-vdp r-vdp requested a review from nikstur January 20, 2026 13:00
Comment thread pkgs/by-name/ni/nixos-init/src/find_etc.rs Outdated
Comment thread pkgs/by-name/ni/nixos-init/src/config.rs Outdated
Comment thread pkgs/by-name/ni/nixos-init/Cargo.toml
Comment thread pkgs/by-name/ni/nixos-init/src/find_etc.rs Outdated
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Jan 24, 2026
r-vdp added 2 commits January 26, 2026 11:54
…ad of from the environment

This is a first step towards using nixos-init also during re-activation.
@nikstur nikstur added this pull request to the merge queue Jan 26, 2026
Merged via the queue into NixOS:staging-nixos with commit 38afce7 Jan 26, 2026
32 of 34 checks passed
@r-vdp r-vdp deleted the rvdp/nixos-init branch January 26, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: systemd Software suite that provides an array of system components for Linux operating systems. 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants