mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 05:37:40 +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 =
|
imports =
|
||||||
[ ./memtest.nix
|
[ ./channel.nix
|
||||||
./channel.nix
|
|
||||||
./iso-image.nix
|
./iso-image.nix
|
||||||
|
|
||||||
# Profiles of this basic installation CD.
|
# Profiles of this basic installation CD.
|
||||||
@ -32,4 +31,7 @@ with pkgs.lib;
|
|||||||
# To speed up installation a little bit, include the complete stdenv
|
# To speed up installation a little bit, include the complete stdenv
|
||||||
# in the Nix store on the CD.
|
# in the Nix store on the CD.
|
||||||
isoImage.storeContents = [ pkgs.stdenv pkgs.busybox ];
|
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.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
|
# In stage 1, mount a tmpfs on top of / (the ISO image) and
|
||||||
# /nix/store (the squashfs image) to make this a live CD.
|
# /nix/store (the squashfs image) to make this a live CD.
|
||||||
@ -235,7 +235,11 @@ in
|
|||||||
[ { source = grubImage;
|
[ { source = grubImage;
|
||||||
target = "/boot/grub/grub_eltorito";
|
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";
|
target = "/boot/grub/grub.cfg";
|
||||||
}
|
}
|
||||||
{ source = config.boot.kernelPackages.kernel + "/bzImage";
|
{ source = config.boot.kernelPackages.kernel + "/bzImage";
|
||||||
@ -254,19 +258,19 @@ in
|
|||||||
target = "/nix-store.squashfs";
|
target = "/nix-store.squashfs";
|
||||||
}
|
}
|
||||||
{ # Quick hack: need a mount point for the store.
|
{ # 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";
|
target = "/nix/store";
|
||||||
}
|
}
|
||||||
] ++ pkgs.stdenv.lib.optionals config.isoImage.makeEfiBootable [
|
] ++ optionals config.isoImage.makeEfiBootable [
|
||||||
{ source = efiImg;
|
{ source = efiImg;
|
||||||
target = "/boot/efi.img";
|
target = "/boot/efi.img";
|
||||||
}
|
}
|
||||||
];
|
] ++ mapAttrsToList (n: v: { source = v; target = "/boot/${n}"; }) config.boot.loader.grub.extraFiles;
|
||||||
|
|
||||||
# The Grub menu.
|
# The Grub menu.
|
||||||
boot.loader.grub.extraEntries =
|
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}
|
linux /boot/bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
||||||
initrd /boot/initrd
|
initrd /boot/initrd
|
||||||
}
|
}
|
||||||
@ -287,7 +291,7 @@ in
|
|||||||
|
|
||||||
bootable = true;
|
bootable = true;
|
||||||
bootImage = "/boot/grub/grub_eltorito";
|
bootImage = "/boot/grub/grub_eltorito";
|
||||||
} // pkgs.stdenv.lib.optionalAttrs config.isoImage.makeEfiBootable {
|
} // optionalAttrs config.isoImage.makeEfiBootable {
|
||||||
efiBootable = true;
|
efiBootable = true;
|
||||||
efiBootImage = "boot/efi.img";
|
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 {
|
splashImage = mkOption {
|
||||||
default =
|
default =
|
||||||
if cfg.version == 1
|
if cfg.version == 1
|
||||||
@ -225,6 +238,11 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [ grub ];
|
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;
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
isEnabled = config.boot.loader.grub.memtest86;
|
|
||||||
memtest86 = pkgs.memtest86plus;
|
memtest86 = pkgs.memtest86plus;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
boot.loader.grub.memtest86 = mkOption {
|
boot.loader.grub.memtest86 = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
Make Memtest86+, a memory testing program, available from the
|
Make Memtest86+, a memory testing program, available from the
|
||||||
GRUB menu.
|
GRUB boot menu.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.boot.loader.grub = mkIf isEnabled {
|
config = mkIf config.boot.loader.grub.memtest86 {
|
||||||
extraEntries = if config.boot.loader.grub.version == 2 then
|
|
||||||
''
|
boot.loader.grub.extraEntries =
|
||||||
menuentry "${memtest86.name}" {
|
if config.boot.loader.grub.version == 2 then
|
||||||
linux16 @bootRoot@/memtest.bin
|
''
|
||||||
}
|
menuentry "Memtest86+" {
|
||||||
''
|
linux16 @bootRoot@/memtest.bin
|
||||||
|
}
|
||||||
|
''
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
menuentry "${memtest86.name}"
|
menuentry "Memtest86+"
|
||||||
linux16 @bootRoot@/memtest.bin
|
linux16 @bootRoot@/memtest.bin
|
||||||
'';
|
'';
|
||||||
extraPrepareConfig =
|
|
||||||
''
|
boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin";
|
||||||
${pkgs.coreutils}/bin/cp ${memtest86}/memtest.bin /boot/memtest.bin;
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user