Skip to content
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/grub: Add extraEntriesAtEnd #317730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NazakatUmrani
Copy link

@NazakatUmrani NazakatUmrani commented Jun 6, 2024

This option allows the user to specify a list of extra entries to be added to the end of the grub menu.

Description of changes

I added this new option as boot.loader.grub.extraEntriesAtEnd, This option adds entries at the end of grub, The normal extraEntries option adds entries in the middle of NixOS and NixOS-Generations entry.

I wanted to add shutdown and reboot entries and end, but that old option was never designed to do that, so I created this new option which runs after OS Prober, and after OS Prober adds those entries then from this option entries are taken.

Things done

I added an option with its description.
I added that option in the Perl file, after the line where OS Prober entries are loaded.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

My Message

I have never worked with Perl, but I am a student studying software engineering, and I used GitHub Copilot, so it may or may not contain bugs, please check it, I want this option as I am frustrated with the old option and it's arrangement, so please add it.

This option allows the user to specify a list of extra entries to be added to the end of the grub menu.
@NazakatUmrani
Copy link
Author

For those who are facing same issue, I used extraInstallCommands option for now, this edits the grub file, after it is generated by perl file

boot.loader.grub.extraInstallCommands =  ''
cat << EOF >> /boot/grub/grub.cfg

# Shutdown
menuentry "Shutdown" --class shutdown {
  halt
}

# Reboot
menuentry "Reboot" --class restart{
  reboot
}
EOF
   '';

It works, it appends those entries in the file, but editing file like this, you should be careful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants