jeaye / nixos-in-place

Install NixOS on top of any existing Linux distribution without rebooting
MIT License
460 stars 57 forks source link

Use only Nix? #9

Open wmertens opened 8 years ago

wmertens commented 8 years ago

I wonder, wouldn't it be more efficient to install Nix (as root) and then install the necessary packages for stage1 and 2 using Nix? Then there wouldn't be a need to download the ISO or to have squashfs.

The packages that make the ISO can simply be installed from the nixos channel, right?

jeaye commented 8 years ago

On Fri, Mar 18, 2016 at 05:37:17AM -0700, Wout Mertens wrote:

I wonder, wouldn't it be more efficient to install Nix (as root) and then install the necessary packages for stage1 and 2 using Nix? Then there wouldn't be a need to download the ISO or to have squashfs.

The packages that make the ISO can simply be installed from the nixos channel, right?

I think a good deal of this could be changed to Nix, but certainly Nix would end up using bash literals as well. With that said, I'm not very good at Nix, so this ended up being in bash to be most portable.

If you'd like to cook up an Nix version, we can definitely talk about bringing it in; I don't see why it wouldn't work.

wmertens commented 8 years ago

@elitak made a sort of nixos-in-place with just Nix, see https://github.com/NixOS/nixpkgs/issues/2079#issuecomment-197597028 and the ensuing discussion.

Basically, you can build nixos-install while running on the host OS and then run it.

wmertens commented 4 years ago

Note: I'm giving something like this a shot again, and so far I came up with

nix-build '<nixpkgs/nixos>' -A config.system.build.nixos-generate-config -I nixos-config=/nix/store/75yffgx3600s8cwdmmzz9803k88ppxmv-nixpkgs-20.09pre221814.10100a97c89/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix

to get nixos-generate-config from a regular nix install. nixos-install is the same.

So this just needs the nixos-in-place.nix configuration and a wrapper to call everything.

It would probably be better to move the installer scripts to a regular package though, that's easier than the above, and then it'd be something like nix-shell -p nixos-in-place to get everything in one go, no iso download needed.