[Nix-dev] minimal install archive

Marc Weber marco-oweber at gmx.de
Tue Apr 23 03:14:10 CEST 2013


I've spent some time updating the old "minimal install archive"  I
provided once which is still referenced on the wiki [G3].

Its goal is to split the nixos-install script into
reusable pieces which can then be used with a nixos install iso or a
minimal bootsrap archive.

The README/documentation roughly looks like this - which means you can
install nixos by 4 steps:

1) unpack to /mnt
2) prepare
3) adjust configuration.nix
4) install

=== README (short documentation)
    HOWTO
    =====

    export mountPoint=/mnt # and mount it

    1)
    IF-ARCHIVE:
      tar xJf $THIS_ARCHIVE -C $mountPoint 

    2)
    PREPARE:
      ${P}nixos-prepare-install copy-nix guess-config iso-source|official-source create-etc-files
      # lookup items by using --help

    3)
    Adjust $mountPoint/etc/nixos/configuration.nix [1], then install:

    4)
      ${P}nixos-prepare-install install --show-trace -j NUM_CORES_PLUS_1 --install --keep-going [--no-grub]

      This runs $mountPoint/nix/store/prepare-install using run-in-chroot


    NOTES:
    $mountPoint/nix/store contains the helper scripts listed at the beginning. They
    should be gone the next time you run the garbage collector.


===== Why should nixos-install be improved ?

- split scripts into pieces, so that you can use the run-in-chroot feature to
  rebuild your system quickly eg if you forgott to add a module to
  initrd

- allows you to use your own sources if you check them out into
  /etc/nixos/{nixos,nixpkgs}
  predefined sources: 
    iso-source  (sources from iso)
    official-source (official latest trunk git sources)


- it automatically exports mountPoint :-)
  (See https://github.com/NixOS/nixos/pull/151)

Alternative [guides] (requiring more manual steps):
  [G1] https://nixos.org/wiki/Install_NixOS_on_Linode
  [G2] https://nixos.org/wiki/Install_NixOS_on_Rackspace_Cloud_Servers
  [G3] https://nixos.org/wiki/Install_NixOS_as_OpenVZ_guest


===== Questions to you (community):

    - Are you interested in this?

    - Should be merged with the minimal binary package which does already
      exist?

I ask before creating pull requests, because Eelco once removed the
previous version "due to lack of documentation" without asking.

The last two weeks at least two people asked on irc about how to install
nixos on linode like v-servers or on computers without cdrom.



===== Things I haven't checked yet:

Will using the [guides] referenced above be in trouble if the host
system does not have a group called nixbld or such?
AFAIK nixos-install does depend on the /etc files found on the host
system which have them - but using an arbitrary linux for bootsrapping
this might be causing trouble. My scripts write minimal
/etc/{passwd,group} files

Let me know how you feel about this. The current code can be found at
github.com/MarcWeber/nixos -> branch experimental/minimal-install-archive

Marc Weber


More information about the nix-dev mailing list