summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-08-31 09:18:13 -0700
committerWilliam A. Kennington III <william@wkennington.com>2014-09-02 09:16:13 -0700
commit36614ff3e290a9330dd8e29bdc6cc38ede1e7001 (patch)
treee09b3db53d7b9bd000687beaf82356b237d8056d /nixos/modules/installer
parentaf4c369d0a21e77afb1bdb0993e67e027d29235a (diff)
downloadnixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar.gz
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar.bz2
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar.lz
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar.xz
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.tar.zst
nixlib-36614ff3e290a9330dd8e29bdc6cc38ede1e7001.zip
Revert "Revert "Merge pull request #2449 from wkennington/master.grub""
This reverts commit 94205f5f21c4d9942bb4205c06229438051b6853.

Conflicts:
	nixos/modules/system/boot/loader/grub/install-grub.pl
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl21
-rw-r--r--nixos/modules/installer/tools/tools.nix1
-rw-r--r--nixos/modules/installer/virtualbox-demo.nix3
3 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 66a8152a3a6c..73dd87cef5cf 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/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" ];