nixpkgs/nixos/modules
obadz 3d16af70bf nixos/stage-1: add mechanism which lustrates all impurities from / (#17784)
lustrate /ˈlʌstreɪt/ verb.
  purify by expiatory sacrifice, ceremonial washing, or some other
  ritual action.

- sudo touch /etc/NIXOS_LUSTRATE
  ⇒ on next reboot, during stage 1, everything but /nix and /boot
  is moved to /old-root
- echo "etc/passwd" | sudo tee -a /etc/NIXOS_LUSTRATE
  ⇒ on next reboot, during stage 1, everything but /nix and /boot
  is moved to /old-root; except /etc/passwd is copied back.

Useful for installing NixOS in place on another distro. For instance:

$ nix-env -iE '_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config manual.manpages ]'
$ sudo mkdir /etc/nixos
$ sudo `which nixos-generate-config`

… edit the configuration files in /etc/nixos using man configuration.nix
  if needed

  maybe add: users.extraUsers.root.initialHashedPassword = "" ?

… Build the entire NixOS system and link it to the system profile:
$ nix-env -p /nix/var/nix/profiles/system -f '<nixpkgs/nixos>' -A system --set

… If you were using a single user install:
$ sudo chown -R 0.0 /nix

… NixOS is about to take over
$ sudo touch /etc/NIXOS
$ sudo touch /etc/NIXOS_LUSTRATE

… Let's keep the configuration files we just created
$ echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE

$ sudo mv -v /boot /boot.bak &&
  sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot
$ sudo reboot

… NixOS boots, Stage 1 moves all the old distro stuff in /old-root.
2016-08-22 01:15:13 +01:00
..
config Revert "Merge branch 'modprobe-fix' of git://github.com/abbradar/nixpkgs" 2016-08-15 19:05:52 -04:00
hardware nixos: blacklist radeon module if using amdgpu 2016-08-21 11:58:14 +02:00
i18n/input-method fcitx-unikey: mention in dockbook 2016-08-12 14:36:36 +07:00
installer Merge branch 'install-bootloader-flag' 2016-08-17 21:16:29 -04:00
misc mattermost service: init 2016-08-15 04:15:11 +02:00
profiles documentation: fix start display-manager command 2016-07-04 10:25:31 +02:00
programs nixos/shadow: setuid wrappers for new{uid,gid}map 2016-08-19 14:59:33 +02:00
security grsecurity module: systemd-nspawn requires cap_sys_admin 2016-08-15 20:36:47 +02:00
services mattermost: cosmetic: remove stray character (#17897) 2016-08-21 19:20:10 +02:00
system nixos/stage-1: add mechanism which lustrates all impurities from / (#17784) 2016-08-22 01:15:13 +01:00
tasks zfs: print the output of the zpool command (if any) when it succeeds 2016-08-18 17:27:57 +02:00
testing KDE test: Bump kdm start timeout 2016-05-27 11:22:27 +02:00
virtualisation Revert "Merge branch 'modprobe-fix' of git://github.com/abbradar/nixpkgs" 2016-08-15 19:05:52 -04:00
module-list.nix nixos: blacklist radeon module if using amdgpu 2016-08-21 11:58:14 +02:00
rename.nix unity3d: use chromium-suid-sandbox 2016-08-08 10:49:00 +03:00