about summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-13 18:08:23 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-17 11:27:33 +0200
commitb1623385d0b5a578637911f4e8a13972af240448 (patch)
treef2bc46578bff3111f7eb4c315a1359b60f37387a /nixos/modules/installer
parentc46e424c8fa5e5b1b94d6c31bec5ccaa9ed7ad3a (diff)
downloadnixlib-b1623385d0b5a578637911f4e8a13972af240448.tar
nixlib-b1623385d0b5a578637911f4e8a13972af240448.tar.gz
nixlib-b1623385d0b5a578637911f4e8a13972af240448.tar.bz2
nixlib-b1623385d0b5a578637911f4e8a13972af240448.tar.lz
nixlib-b1623385d0b5a578637911f4e8a13972af240448.tar.xz
nixlib-b1623385d0b5a578637911f4e8a13972af240448.tar.zst
nixlib-b1623385d0b5a578637911f4e8a13972af240448.zip
nixos-generate-config: Container improvements
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl18
1 files changed, 15 insertions, 3 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index a2dbe31e0d8d..187ea7635eb5 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -70,7 +70,7 @@ my @attrs = ();
 my @kernelModules = ();
 my @initrdKernelModules = ();
 my @modulePackages = ();
-my @imports = ("<nixpkgs/nixos/modules/installer/scan/not-detected.nix>");
+my @imports;
 
 
 sub debug {
@@ -245,6 +245,18 @@ if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
 }
 
 
+# Pull in NixOS configuration for containers.
+if ($virt eq "systemd-nspawn") {
+    push @attrs, "boot.isContainer = true;";
+}
+
+
+# Provide firmware for devices that are not detected by this script,
+# unless we're in a VM/container.
+push @imports, "<nixpkgs/nixos/modules/installer/scan/not-detected.nix>"
+    if $virt eq "none";
+
+
 # For a device name like /dev/sda1, find a more stable path like
 # /dev/disk/by-uuid/X or /dev/disk/by-label/Y.
 sub findStableDevPath {
@@ -459,14 +471,14 @@ if ($showHardwareConfig) {
     if ($force || ! -e $fn) {
         print STDERR "writing $fn...\n";
 
-        my $bootloaderConfig;
+        my $bootloaderConfig = "";
         if (-e "/sys/firmware/efi/efivars") {
             $bootLoaderConfig = <<EOF;
   # Use the gummiboot efi boot loader.
   boot.loader.gummiboot.enable = true;
   boot.loader.efi.canTouchEfiVariables = true;
 EOF
-        } else {
+        } elsif ($virt ne "systemd-nspawn") {
             $bootLoaderConfig = <<EOF;
   # Use the GRUB 2 boot loader.
   boot.loader.grub.enable = true;