nixos-generate-config: Container improvements
This commit is contained in:
parent
c46e424c8f
commit
b1623385d0
@ -70,7 +70,7 @@ my @attrs = ();
|
|||||||
my @kernelModules = ();
|
my @kernelModules = ();
|
||||||
my @initrdKernelModules = ();
|
my @initrdKernelModules = ();
|
||||||
my @modulePackages = ();
|
my @modulePackages = ();
|
||||||
my @imports = ("<nixpkgs/nixos/modules/installer/scan/not-detected.nix>");
|
my @imports;
|
||||||
|
|
||||||
|
|
||||||
sub debug {
|
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
|
# For a device name like /dev/sda1, find a more stable path like
|
||||||
# /dev/disk/by-uuid/X or /dev/disk/by-label/Y.
|
# /dev/disk/by-uuid/X or /dev/disk/by-label/Y.
|
||||||
sub findStableDevPath {
|
sub findStableDevPath {
|
||||||
@ -459,14 +471,14 @@ if ($showHardwareConfig) {
|
|||||||
if ($force || ! -e $fn) {
|
if ($force || ! -e $fn) {
|
||||||
print STDERR "writing $fn...\n";
|
print STDERR "writing $fn...\n";
|
||||||
|
|
||||||
my $bootloaderConfig;
|
my $bootloaderConfig = "";
|
||||||
if (-e "/sys/firmware/efi/efivars") {
|
if (-e "/sys/firmware/efi/efivars") {
|
||||||
$bootLoaderConfig = <<EOF;
|
$bootLoaderConfig = <<EOF;
|
||||||
# Use the gummiboot efi boot loader.
|
# Use the gummiboot efi boot loader.
|
||||||
boot.loader.gummiboot.enable = true;
|
boot.loader.gummiboot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
EOF
|
EOF
|
||||||
} else {
|
} elsif ($virt ne "systemd-nspawn") {
|
||||||
$bootLoaderConfig = <<EOF;
|
$bootLoaderConfig = <<EOF;
|
||||||
# Use the GRUB 2 boot loader.
|
# Use the GRUB 2 boot loader.
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user