mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
Unify the two Memtest modules
This means we now have Memtest86+ on the installation CD.
This commit is contained in:
parent
1c58fbe4a9
commit
c13041c65c
@ -7,8 +7,7 @@ with pkgs.lib;
|
||||
|
||||
{
|
||||
imports =
|
||||
[ ./memtest.nix
|
||||
./channel.nix
|
||||
[ ./channel.nix
|
||||
./iso-image.nix
|
||||
|
||||
# Profiles of this basic installation CD.
|
||||
@ -32,4 +31,7 @@ with pkgs.lib;
|
||||
# To speed up installation a little bit, include the complete stdenv
|
||||
# in the Nix store on the CD.
|
||||
isoImage.storeContents = [ pkgs.stdenv pkgs.busybox ];
|
||||
|
||||
# Add Memtest86+ to the CD.
|
||||
boot.loader.grub.memtest86 = true;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ in
|
||||
|
||||
boot.initrd.kernelModules = [ "loop" ];
|
||||
|
||||
boot.kernelModules = pkgs.stdenv.lib.optional config.isoImage.makeEfiBootable "efivars";
|
||||
boot.kernelModules = optional config.isoImage.makeEfiBootable "efivars";
|
||||
|
||||
# In stage 1, mount a tmpfs on top of / (the ISO image) and
|
||||
# /nix/store (the squashfs image) to make this a live CD.
|
||||
@ -235,7 +235,11 @@ in
|
||||
[ { source = grubImage;
|
||||
target = "/boot/grub/grub_eltorito";
|
||||
}
|
||||
{ source = pkgs.writeText "grub.cfg" grubCfg;
|
||||
{ source = pkgs.substituteAll {
|
||||
name = "grub.cfg";
|
||||
src = pkgs.writeText "grub.cfg-in" grubCfg;
|
||||
bootRoot = "/boot";
|
||||
};
|
||||
target = "/boot/grub/grub.cfg";
|
||||
}
|
||||
{ source = config.boot.kernelPackages.kernel + "/bzImage";
|
||||
@ -254,19 +258,19 @@ in
|
||||
target = "/nix-store.squashfs";
|
||||
}
|
||||
{ # Quick hack: need a mount point for the store.
|
||||
source = pkgs.runCommand "empty" {} "ensureDir $out";
|
||||
source = pkgs.runCommand "empty" {} "mkdir -p $out";
|
||||
target = "/nix/store";
|
||||
}
|
||||
] ++ pkgs.stdenv.lib.optionals config.isoImage.makeEfiBootable [
|
||||
] ++ optionals config.isoImage.makeEfiBootable [
|
||||
{ source = efiImg;
|
||||
target = "/boot/efi.img";
|
||||
}
|
||||
];
|
||||
] ++ mapAttrsToList (n: v: { source = v; target = "/boot/${n}"; }) config.boot.loader.grub.extraFiles;
|
||||
|
||||
# The Grub menu.
|
||||
boot.loader.grub.extraEntries =
|
||||
''
|
||||
menuentry "NixOS Installer / Rescue" {
|
||||
menuentry "NixOS ${config.system.nixosVersion} Installer" {
|
||||
linux /boot/bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
||||
initrd /boot/initrd
|
||||
}
|
||||
@ -287,7 +291,7 @@ in
|
||||
|
||||
bootable = true;
|
||||
bootImage = "/boot/grub/grub_eltorito";
|
||||
} // pkgs.stdenv.lib.optionalAttrs config.isoImage.makeEfiBootable {
|
||||
} // optionalAttrs config.isoImage.makeEfiBootable {
|
||||
efiBootable = true;
|
||||
efiBootImage = "boot/efi.img";
|
||||
});
|
||||
|
@ -1,24 +0,0 @@
|
||||
# This module adds Memtest86 to the Grub boot menu on the CD.
|
||||
|
||||
{config, pkgs, ...}:
|
||||
|
||||
let
|
||||
|
||||
memtestPath = "/boot/memtest.bin";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
boot.loader.grub.extraEntries =
|
||||
''
|
||||
menuentry "Memtest86" {
|
||||
linux16 ${memtestPath}
|
||||
}
|
||||
'';
|
||||
|
||||
isoImage.contents =
|
||||
[ { source = pkgs.memtest86 + "/memtest.bin";
|
||||
target = memtestPath;
|
||||
}
|
||||
];
|
||||
}
|
@ -150,6 +150,19 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
extraFiles = mkOption {
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{ "memtest.bin" = "${pkgs.memtest86plus}/memtest.bin"; }
|
||||
'';
|
||||
description = ''
|
||||
A set of files to be copied to <filename>/boot</filename>.
|
||||
Each attribute name denotes the destination file name in
|
||||
<filename>/boot</filename>, while the corresponding
|
||||
attribute value specifies the source file.
|
||||
'';
|
||||
};
|
||||
|
||||
splashImage = mkOption {
|
||||
default =
|
||||
if cfg.version == 1
|
||||
@ -225,6 +238,11 @@ in
|
||||
|
||||
environment.systemPackages = [ grub ];
|
||||
|
||||
boot.loader.grub.extraPrepareConfig =
|
||||
concatStrings (mapAttrsToList (n: v: ''
|
||||
${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
|
||||
'') config.boot.loader.grub.extraFiles);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,39 +1,42 @@
|
||||
# This module allows getting memtest86 in grub menus.
|
||||
# This module adds Memtest86+ to the GRUB boot menu.
|
||||
|
||||
{config, pkgs, ...}:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
isEnabled = config.boot.loader.grub.memtest86;
|
||||
memtest86 = pkgs.memtest86plus;
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
|
||||
boot.loader.grub.memtest86 = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Make Memtest86+, a memory testing program, available from the
|
||||
GRUB menu.
|
||||
GRUB boot menu.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config.boot.loader.grub = mkIf isEnabled {
|
||||
extraEntries = if config.boot.loader.grub.version == 2 then
|
||||
''
|
||||
menuentry "${memtest86.name}" {
|
||||
linux16 @bootRoot@/memtest.bin
|
||||
}
|
||||
''
|
||||
config = mkIf config.boot.loader.grub.memtest86 {
|
||||
|
||||
boot.loader.grub.extraEntries =
|
||||
if config.boot.loader.grub.version == 2 then
|
||||
''
|
||||
menuentry "Memtest86+" {
|
||||
linux16 @bootRoot@/memtest.bin
|
||||
}
|
||||
''
|
||||
else
|
||||
''
|
||||
menuentry "${memtest86.name}"
|
||||
linux16 @bootRoot@/memtest.bin
|
||||
'';
|
||||
extraPrepareConfig =
|
||||
''
|
||||
${pkgs.coreutils}/bin/cp ${memtest86}/memtest.bin /boot/memtest.bin;
|
||||
'';
|
||||
''
|
||||
menuentry "Memtest86+"
|
||||
linux16 @bootRoot@/memtest.bin
|
||||
'';
|
||||
|
||||
boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin";
|
||||
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user