New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/systemd-boot: add support for memtest86 EFI app #61036
Conversation
This commit adds support for installing the memtest86 EFI app and adding a boot entry for it with systemd-boot.
memtest_entry_file_tmp_path = "%s.tmp" % memtest_entry_file | ||
with open(memtest_entry_file_tmp_path, 'w') as f: | ||
f.write(MEMTEST_BOOT_ENTRY) | ||
os.rename(memtest_entry_file_tmp_path, memtest_entry_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code does the following:
- Delete
/boot/loader/entries/memtest86.conf
if it exists. - Delete the
/boot/efi/memtest86/
directory. (This is the directory that contains the actual memtest86 UEFI app, calledBOOTX64.efi
.) - If
boot.loader.systemd-boot.memtest86.enable
is set totrue
, the@memtest86@
string will be replaced with the path to thememtest86-efi
derivation, so the following things will be done. (Ifboot.loader.systemd-boot.memtest86.enable
is set tofalse
, none of the following will be done.)- Create the
/boot/efi/memtest86/
directory. - Copy all the files from the
memtest86-efi
derivation to the/boot/efi/memtest86/
. - Create the
/boot/loader/entries/memtest86.conf
file.
- Create the
The above is relatively similar to what this script is doing for the actual nixos generation loader files.
Pinging @c0bw3b @JohnAZoidberg and @Lassulus since they all did reviews of #60967. Also, on cdepillabout@8c85e24#commitcomment-33415487 @JohnAZoidberg suggested that it would be nice if there was a general NixOS module to install arbitrary EFI apps. I think this would be a great idea, but it is somewhat out of scope for this PR. Ideally this PR (#61036) would get merged in, and then someone would send a PR adding a general module to install arbitrary EFI apps. Once that gets merged in, I'll send a follow-up PR adapting memtest86 to use it. |
description = '' | ||
Make MemTest86 available from the systemd-boot menu. MemTest86 is a | ||
program for testing memory. MemTest86 is a non-open-source program, so | ||
this requires <literal>allowUnfree</literal> to be set to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open source != free software ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ yheah I'm not going down that rabbit hole here and now!
My check was merely on the description clearly explaining the precondition on using this. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not looking for a discussion either :D
But the option is literally called Unfree
- so I think the description should use the same choice words.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit d88d675, I changed non-open-source
to unfree
.
@@ -25,6 +25,8 @@ let | |||
inherit (cfg) consoleMode; | |||
|
|||
inherit (efi) efiSysMountPoint canTouchEfiVariables; | |||
|
|||
memtest86 = if cfg.memtest86.enable then pkgs.memtest86-efi else ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone try to enable it anyway with allowUnfree = false
it will bring memtest86-efi
into scope but the next nixos-rebuild should fail to eval with a clear enough error message. So it works as intended.
EDIT: virtualisation.virtualbox.host.enableExtensionPack
does it in a similar fashion.
….03) This commit adds support for installing the memtest86 EFI app and adding a boot entry for it with systemd-boot. Backported from NixOS#61036. (cherry picked from commit b12ea62) (cherry picked from commit d88d675)
This commit adds support for installing the memtest86 EFI app and adding a boot entry for it with systemd-boot.
In order to test this, you can set the following in
/etc/nixos/configuration.nix
:This should work as long as you have
boot.loader.systemd-boot.enable
set totrue
.You'll also need
allowUnfree
set totrue
, since memtest86 is not open source.Motivation for this change
I wanted a way to install memtest86 easily from NixOS. This is a follow-up of #60967.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)