Skip to content

Feature request: nixos-assimilate: Turn currently running system into NixOS #2079

@aszlig

Description

@aszlig

This command would not only be very useful for users to switch to NixOS but also would get NixOps to support a large variety of different hosters. Also this would simplify the Hetzner bootstrapping process.

The implementation would look like this:

  • Gather hardware, networking and maybe partition information.
  • Evaluate configuration and build NixOS system.
  • Inject a initrd+kernel somewhere in the current system (maybe search for a continuous region within the free disk space).
  • Overwrite boot loader with pointers to the injected initrd+kernel.
  • Sync
  • reboot -f
  • Erase disk and repartition (at least in the first implementation of nixos-assimilate, because detecting available partitions and reusing them could become quite difficult).
  • Create filesystems and mount.
  • Copy closures into the new filesystem layout.
  • pivot_root into the new system and bootup NixOS.

In order to properly (re)partition, we need to do the refactoring of nixpart to first of all not be based on kickstart syntax and also have a sane way to specify filesystem layouts.

nixpart is based on blivet, which works with partitioning information in a tree-like structure and also is able to detect existing filesystem layouts, so it's perfectly suited to work with Nix expressions.

That means we need to refactor nixpart to use Nix expressions to specify the filesystem layout and remove all kickstart-related stuff (kickstart is more than just a way to specify partitioning and has dependencies and complexity which we really don't need).

And of course, before we could do that, we need to come up with a sane layout for specifying partitions, possibly something that would blend in seamlessly with the fileSystems attribute set.

This possibly affects/fixes NixOS/nixops#168 and #1080.

Metadata

Metadata

Assignees

Labels

0.kind: enhancementAdd something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS9.needs: reporter feedbackThis issue needs the person who filed it to respond
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions