NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.59k stars 13.07k forks source link

boot.loader.grub.configurationName unused? #15416

Open Shou opened 8 years ago

Shou commented 8 years ago

Issue description

Setting boot.loader.grub.configurationName in /etc/nixos/configuration.nix to anything still generates an entry named NixOS - Default in GRUB.

Technical details

stefano-m commented 6 years ago

I have just realized that this is still the case in NixOS 17.09.

AFAIU, configurationName is referenced in nixos/modules/system/activation/top-level.nix only. The script that generates the grub menu entries is nixos/modules/system/boot/loader/grub/install-grub.pl where "NixOS - Default" is hardcoded.

I am not sure about the current use of configurationName, but it seems that the following change in the Perl script may work (disclaimer: I'm not familiar with Perl)

my $configurationName = get("configurationName") or "NixOS - Default";

# and then

addEntry($configurationName, $defaultConfig);
stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
x3rAx commented 4 years ago

This still does not work. In my Grub boot menu the entries are still named "NixOS - Default" and so on instead of "Kirbix - Default".

This is my boot loader config:

{ config, pkgs, ... }:

{
  # [...] #

  boot.loader = {
    timeout = 1;
    efi = {
      canTouchEfiVariables = true;
      efiSysMountPoint = "/boot/efi";
    };
    grub = {
      enable = true;
      version = 2;
      device = "nodev";
      efiSupport = true;
      efiInstallAsRemovable = false;
      memtest86.enable = true;
      backgroundColor = "#000000";
      splashImage = ./res/nixos-boot-background-scaled.png;
      configurationName = "Kirbix";
      # Get gfxmodes from the grub cli with `videoinfo`
      gfxmodeEfi = "1280x1024";
      enableCryptodisk = true;
      extraInitrd = /boot/initrd.keys.gz;
    };
  };

  # [...] #

}
stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

GrabbenD commented 1 year ago

Still not solved :smiling_face_with_tear:

vSLG commented 1 year ago

Still not solved :\

bertbesser commented 5 months ago

bumping, b/c i would find this handy

vSLG commented 5 months ago

I work around this with the following snippet, edit according to your needs

system.activationScripts.update-grub-menu = {
  text = ''
    echo "Updating GRUB menu entry name..."

    GRUB_CFG="/boot/grub/grub.cfg"
    BACKUP_GRUB_CFG="/boot/grub/grub.cfg.bak"
    SEARCH_STR="\"NixOS"
    REPLACE_STR="\"<whatever text you want>"

    if [ -f "$GRUB_CFG" ]; then
        cp "$GRUB_CFG" "$BACKUP_GRUB_CFG"
        ${pkgs.gnused}/bin/sed -i "s/$SEARCH_STR/$REPLACE_STR/g" "$GRUB_CFG"
    else
        echo "Error: GRUB configuration file not found."
    fi
  '';
};
tomodachi94 commented 2 months ago

Perhaps relevant: https://github.com/NixOS/nixpkgs/pull/3796 (bd811d32b4b194b9e551a66069641a76bd8eab58), and its revert 4061c18c9878ca4b97a0e97debd5c533fc1422ff,