Skip to content

Install NixOS on top of any existing Linux distribution without rebooting

License

Notifications You must be signed in to change notification settings

jeaye/nixos-in-place

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nixos-in-place

An all-in-one script for installing NixOS on top of any existing Linux system without using live media. When you reboot, you're in NixOS.

nixos-in-place is known to work on Ubuntu, Debian, CentOS, Fedora, Arch, and Slackware, including x86 and x86_64 variants, with and without LVM, including systems on Digital Ocean droplets and Hetzner Cloud!

How to do it

  1. BACKUP

  2. See the Platform-specifics for your distribution

  3. Run the following (see ./install -h for options)

    $ ./install
  4. STOP AND VERIFY, then hit y to confirm

  5. Grab some coffee while NixOS installs

  6. Hit y to reboot into NixOS! (root's password will be 'nixos')

  7. Go through the first section of /etc/nixos/nixos-in-place.nix and remove or change it as you see fit

What you get

A fresh install of NixOS, either minimal or graphical (your choice). Your old system and all your old files still exist and are setup to mount on /old-root. As far as the file system is concerned, NixOS is installed in /old-root/nixos and / is rebound before spinning up the system; everything else in /old-root is fair game to delete.

NixOS installs GRUB2 on top of your existing boot loader. If you'd like to boot into /old-root, you can; you just need to add the GRUB entry, from /old-root/boot/grub, manually in your Nix files.

Platform-specifics

Digital Ocean

DO makes some assumptions about static ips and networking, based on the droplet OS and version you choose. nixos-in-place will work best from a Debian 8 droplet.

To install on a DO droplet, follow the normal steps for your platform, but add the -d flag to ./install (see -h for more info). Once installed, if you clean up /old-root, you must keep /old-root/etc/network around; DO needs it!

The default configuration for NixOS disables SSH, so you'll need to use the DO console, once you've finished the installation, in order to setup which services you'd actually like.

I recommend installing from a tmux session, to avoid SSH timeouts and losing access to your install part-way through. Seriously, use tmux or screen.

Ubuntu 15.10