Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow config activation in initrd #4

Open
arianvp opened this issue May 6, 2020 · 2 comments
Open

Allow config activation in initrd #4

arianvp opened this issue May 6, 2020 · 2 comments

Comments

@arianvp
Copy link
Owner

arianvp commented May 6, 2020

initrd should be able to get a NixOS config and nixos-install it to /sysroot before switch-root'ing to stage-2.

Initrd could use kernel parameter pointing to the configuration file; e.g.:

rd.nixos.systemConfig=https://arianvp.me/config.nix 

or a derivation:

rd.nixos.systemConfig=/nix/store/asdhkqhdequehyiqu-systemConfig.drv

or an output path (which must be substitutable by a cache, or already exist on /sysroot/nix/store):

rd.nixos.systemConfig=/nix/store/asdhkqhdequehyiqu-systemConfig

In the future; we might want to support Cloud metadata services through github.com/coreos/afterburn and allow user-data too.

Mechanism wil be implemented through a systemd-generator that orders a unit doing the realisation at the correct time in boot process (just after /sysroot is mounted).

See man bootup

@arianvp
Copy link
Owner Author

arianvp commented May 6, 2020

Something like this would work:

result=$(nix-build --store /sysroot --no-out-link @systemConfig@)
nixos-install --no-channel-copy --system $result --root /sysroot

@arianvp
Copy link
Owner Author

arianvp commented Oct 13, 2020

Pointing to a flake would also be an interesting option :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant