Branch: refs/heads/master
  Home:   https://github.com/NixOS/nixpkgs
  Commit: 24f8cf08cc897f0b3c2ff4118fe30c38eed85aa6
      
https://github.com/NixOS/nixpkgs/commit/24f8cf08cc897f0b3c2ff4118fe30c38eed85aa6
  Author: obadz <[email protected]>
  Date:   2016-08-16 (Tue, 16 Aug 2016)

  Changed paths:
    M nixos/lib/make-disk-image.nix
    M nixos/modules/installer/tools/nixos-install.sh
    M nixos/modules/installer/tools/tools.nix

  Log Message:
  -----------
  nixos/lib/make-disk-image: refactor to use nixos-install

- Replace hand-rolled version of nixos-install in make-disk-image by an
  actual call to nixos-install
- Required a few cleanups of nixos-install
- nixos-install invokes an activation script which the hand-rolled version
  in make-disk-image did not do. We remove /etc/machine-id as that's
  a host-specific, impure, output of the activation script

Testing:

nix-build '<nixpkgs/nixos/release.nix>' -A tests.installer.simple passes

Also tried generating an image with:

nix-build -E 'let
    pkgs = import <nixpkgs> {};
    lib = pkgs.lib;
    nixos = import <nixpkgs/nixos> {
      configuration = {
  fileSystems."/".device = "/dev/disk/by-label/nixos";
  boot.loader.grub.devices = [ "/dev/sda" ];
  boot.loader.grub.extraEntries = '"''"'
    menuentry "Ubuntu" {
       insmod ext2
       search --set=root --label ubuntu
       configfile /boot/grub/grub.cfg
    }
  '"''"';
      };
    };
  in import <nixpkgs/nixos/lib/make-disk-image.nix> {
    inherit pkgs lib;
    config = nixos.config;
    diskSize = 2000;
    partitioned = false;
    installBootLoader = false;
  }'

Then installed the image:
$ sudo df if=./result/nixos.img of=/dev/sdaX bs=1M
$ sudo resize2fs /dev/disk/by-label/nixos
$ sudo mount /dev/disk/by-label/nixos /mnt
$ sudo mount --rbind /proc /mnt/proc
$ sudo mount --rbind /dev /mnt/dev
$ sudo chroot /mnt /nix/var/nix/profiles/system/bin/switch-to-configuration boot

[ … optionally do something about passwords … ]

and successfully rebooted to that image.

Was doing all this from inside a Ubuntu VM with a single user nix install.


  Commit: 859157c36b1bf1aca36269ecbd1c5ca6c93e9813
      
https://github.com/NixOS/nixpkgs/commit/859157c36b1bf1aca36269ecbd1c5ca6c93e9813
  Author: Eelco Dolstra <[email protected]>
  Date:   2016-08-16 (Tue, 16 Aug 2016)

  Changed paths:
    M nixos/lib/make-disk-image.nix
    M nixos/modules/installer/tools/nixos-install.sh
    M nixos/modules/installer/tools/tools.nix

  Log Message:
  -----------
  Merge pull request #17779 from obadz/make-disk-image

nixos/lib/make-disk-image: refactor to use nixos-install


Compare: https://github.com/NixOS/nixpkgs/compare/4d1d37014a57...859157c36b1b
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to