summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2014-08-30 10:04:02 +0200
committerVladimír Čunát <vcunat@gmail.com>2014-08-30 10:04:02 +0200
commite51f73652d38d5c53b331b7bcae2e2483e1b8afe (patch)
tree9126d3fd0737db3a0d57cda866d96c377fc0e452 /nixos/modules/installer
parenta283bec71cec60c2b9c84ea9af320fc8df0dfd5f (diff)
parent4e0d2706f174bb893378a8241df7bd2055901b9e (diff)
downloadnixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar.gz
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar.bz2
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar.lz
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar.xz
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.tar.zst
nixlib-e51f73652d38d5c53b331b7bcae2e2483e1b8afe.zip
Merge recent master into staging
Hydra: ?compare=1149952

Conflicts:
	nixos/doc/manual/configuration.xml (changed split file)
	nixos/modules/config/users-groups.nix (choosing filterNull instead of inline definition)
	pkgs/development/libraries/readline/readline6.3.nix (auto-solved)
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/cd-dvd/iso-image.nix7
-rw-r--r--nixos/modules/installer/cd-dvd/system-tarball.nix7
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl21
-rw-r--r--nixos/modules/installer/tools/nixos-install.sh3
-rw-r--r--nixos/modules/installer/tools/tools.nix1
-rw-r--r--nixos/modules/installer/virtualbox-demo.nix3
6 files changed, 36 insertions, 6 deletions
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index d43fa2203818..623cfdedd269 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -113,11 +113,12 @@ in
     };
 
     isoImage.contents = mkOption {
-      example =
+      example = literalExample ''
         [ { source = pkgs.memtest86 + "/memtest.bin";
             target = "boot/memtest.bin";
           }
-        ];
+        ]
+      '';
       description = ''
         This option lists files to be copied to fixed locations in the
         generated ISO image.
@@ -125,7 +126,7 @@ in
     };
 
     isoImage.storeContents = mkOption {
-      example = [pkgs.stdenv];
+      example = literalExample "[ pkgs.stdenv ]";
       description = ''
         This option lists additional derivations to be included in the
         Nix store in the generated ISO image.
diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix
index eaecbe1381f5..c24fe97fba46 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball.nix
@@ -15,11 +15,12 @@ in
 {
   options = {
     tarball.contents = mkOption {
-      example =
+      example = literalExample ''
         [ { source = pkgs.memtest86 + "/memtest.bin";
             target = "boot/memtest.bin";
           }
-        ];
+        ]
+      '';
       description = ''
         This option lists files to be copied to fixed locations in the
         generated ISO image.
@@ -27,7 +28,7 @@ in
     };
 
     tarball.storeContents = mkOption {
-      example = [pkgs.stdenv];
+      example = literalExample "[ pkgs.stdenv ]";
       description = ''
         This option lists additional derivations to be included in the
         Nix store in the generated ISO image.
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index c507f7f979fa..93a348f27174 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -20,6 +20,13 @@ sub uniq {
     return @res;
 }
 
+sub runCommand {
+    my ($cmd) = @_;
+    open FILE, "$cmd 2>/dev/null |" or die "Failed to execute: $cmd\n";
+    my @ret = <FILE>;
+    close FILE;
+    return ($?, @ret);
+}
 
 # Process the command line.
 my $outDir = "/etc/nixos";
@@ -337,6 +344,20 @@ EOF
         }
     }
 
+	# Is this a btrfs filesystem?
+	if ($fsType eq "btrfs") {
+		my ($status, @info) = runCommand("btrfs subvol show $rootDir$mountPoint");
+		if ($status != 0) {
+			die "Failed to retreive subvolume info for $mountPoint";
+		}
+		my @subvols = join("", @info) =~ m/Name:[ \t\n]*([^ \t\n]*)/;
+		if ($#subvols > 0) {
+			die "Btrfs subvol name for $mountPoint listed multiple times in mount\n"
+		} elsif ($#subvols == 0) {
+			push @extraOptions, "subvol=$subvols[0]";
+		}
+	}
+
     # Emit the filesystem.
     $fileSystems .= <<EOF;
   fileSystems.\"$mountPoint\" =
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh
index a55eda1cb8fd..86952486ade0 100644
--- a/nixos/modules/installer/tools/nixos-install.sh
+++ b/nixos/modules/installer/tools/nixos-install.sh
@@ -30,6 +30,9 @@ while [ "$#" -gt 0 ]; do
             absolute_path=$(readlink -m $given_path)
             extraBuildFlags+=("$i" "/mnt$absolute_path")
             ;;
+        --root)
+            mountPoint="$1"; shift 1
+            ;;
         --show-trace)
             extraBuildFlags+=("$i")
             ;;
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 39da2f1f0be6..91a30695a7a5 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -38,6 +38,7 @@ let
   nixos-generate-config = makeProg {
     name = "nixos-generate-config";
     src = ./nixos-generate-config.pl;
+    path = [ pkgs.btrfsProgs ];
     perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
   };
 
diff --git a/nixos/modules/installer/virtualbox-demo.nix b/nixos/modules/installer/virtualbox-demo.nix
index f68f8dc40aa8..49ec08996104 100644
--- a/nixos/modules/installer/virtualbox-demo.nix
+++ b/nixos/modules/installer/virtualbox-demo.nix
@@ -10,6 +10,9 @@ with lib;
       ../profiles/clone-config.nix
     ];
 
+  # FIXME: UUID detection is currently broken
+  boot.loader.grub.fsIdentifier = "provided";
+
   # Allow mounting of shared folders.
   users.extraUsers.demo.extraGroups = [ "vboxsf" ];