catppuccin / grub

🌕 Soothing pastel theme for Grub2 & Ventoy
MIT License
335 stars 13 forks source link

❄️ NixOS logo #3

Closed sioodmy closed 2 years ago

sioodmy commented 2 years ago

Currently there is no logo for nixos, even though this distribution is becoming increasingly popular

elkrien commented 2 years ago

Currently there is no logo for nixos, even though this distribution is becoming increasingly popular

Hi, I have added some new icons to theme (NixOs also). Please test and let know if it works. I will try to install NixOS later in VM to test.

sioodmy commented 2 years ago

Still doesn't work

elkrien commented 2 years ago

Still doesn't work

Can You please paste output of command: ls /usr/share/grub/themes/catppuccin-grub-theme/icons/

sioodmy commented 2 years ago

image image

    boot = {
      cleanTmpDir = true;
      plymouth.enable = true;
      kernelParams = [ "quiet" "splash" "rd.systemd.show_status=false" "rd.udev.log_level=3" "udev.log_priority=3" ];
      kernelPackages = pkgs.linuxPackages_latest;
#      kernelPackages = pkgs.linuxPackages_xanmod;
      consoleLogLevel = 0;
      initrd.verbose = false;
      loader = {
        systemd-boot.enable = false;
        efi.canTouchEfiVariables = true;
        grub = {
          enable = true;
          useOSProber = true;
          efiSupport = true;
          device = "nodev";
          theme = pkgs.fetchFromGitHub {
            owner = "catppuccin";
            repo = "grub";
            rev = "3f62cd4174465631b40269a7c5631e5ee86dec45";
            sha256 = "d15FS7R78kdUKqC7EAei5Pe0Vuj2boVnm4WZYQdPURo=";
          } + "/catppuccin-grub-theme";

        };
      };
    };

Windows logo works fine. Perhaps this is a problem with the grub

elkrien commented 2 years ago

P

The problem is that icon filename should be named as a system class. And because I have no Nix installed I don't know how this name should be (right now the file is named nixos.png). But I know how to check it now - please paste here what is in file: /boot/grub/grub.cfg (You can use cat /boot/grub/grub.cfg)

sioodmy commented 2 years ago

    search --set=drive1 --fs-uuid C27B-8AB0
    if [ -s $prefix/grubenv ]; then
    load_env
    fi

    # ‘grub-reboot’ sets a one-time saved entry, which we process here and
    # then delete.
    if [ "${next_entry}" ]; then
    set default="${next_entry}"
    set next_entry=
    save_env next_entry
    set timeout=1
    set boot_once=true
    else
    set default=0
    set timeout=5
    fi

    function savedefault {
        if [ -z "${boot_once}"]; then
        saved_entry="${chosen}"
        save_env saved_entry
        fi
    }

    # Setup the graphics stack for bios and efi systems
    if [ "${grub_platform}" = "efi" ]; then
    insmod efi_gop
    insmod efi_uga
    else
    insmod vbe
    fi

        insmod font
        if loadfont ($drive1)//converted-font.pf2; then
        insmod gfxterm
        if [ "${grub_platform}" = "efi" ]; then
        set gfxmode=auto
        set gfxpayload=keep
        else
        set gfxmode=1024x768
        set gfxpayload=text
        fi
        terminal_output gfxterm
        fi

            background_color '#2F302F'

        insmod png
        if background_image --mode 'normal' ($drive1)//background.png; then
        set color_normal=white/black
        set color_highlight=black/white
        else
        set menu_color_normal=cyan/blue
        set menu_color_highlight=white/blue
        fi

        # Sets theme.
        set theme=($drive1)//theme/theme.txt
        export theme
        # Load theme fonts, if any

                        loadfont ($drive1)//theme/font.pf2

menuentry "NixOS - Default" --unrestricted {
search --set=drive1 --fs-uuid C27B-8AB0
  linux ($drive1)//kernels/pqvlbdn6nd7sapxr6hr1yb3hsz73ymvq-linux-5.16.8-bzImage init=/nix/store/2xfprysqa5a3c772c0y0bb5x836inssq-nixos-system-graphene-21.11.20220213.c28fb0a/init quiet splash rd.systemd.show_status=false rd.udev.log_level=3 udev.log_priority=3 splash loglevel=0 nohibernate nvidia-drm.modeset=1
  initrd ($drive1)//kernels/xis9g1jh4pw45v2lghllrpn2jn5493vz-initrd-linux-5.16.8-initrd
}

submenu "NixOS - All configurations" {
menuentry "NixOS - Configuration 651 (2022-03-15 - 21.11.20220213.c28fb0a)"  {
search --set=drive1 --fs-uuid C27B-8AB0
  linux ($drive1)//kernels/pqvlbdn6nd7sapxr6hr1yb3hsz73ymvq-linux-5.16.8-bzImage init=/nix/store/2xfprysqa5a3c772c0y0bb5x836inssq-nixos-system-graphene-21.11.20220213.c28fb0a/init quiet splash rd.systemd.show_status=false rd.udev.log_level=3 udev.log_priority=3 splash loglevel=0 nohibernate nvidia-drm.modeset=1
  initrd ($drive1)//kernels/xis9g1jh4pw45v2lghllrpn2jn5493vz-initrd-linux-5.16.8-initrd
}

menuentry "NixOS - Configuration 650 (2022-03-14 - 21.11.20220213.c28fb0a)"  {
search --set=drive1 --fs-uuid C27B-8AB0
  linux ($drive1)//kernels/pqvlbdn6nd7sapxr6hr1yb3hsz73ymvq-linux-5.16.8-bzImage init=/nix/store/wg0hdlwb0jz6704d1rjhlgs2f1dfd190-nixos-system-graphene-21.11.20220213.c28fb0a/init quiet splash rd.systemd.show_status=false rd.udev.log_level=3 udev.log_priority=3 splash loglevel=0 nohibernate nvidia-drm.modeset=1
  initrd ($drive1)//kernels/xis9g1jh4pw45v2lghllrpn2jn5493vz-initrd-linux-5.16.8-initrd
}

}
menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-C27B-8AB0' {
    insmod part_gpt
    insmod fat
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  C27B-8AB0
    else
      search --no-floppy --fs-uuid --set=root C27B-8AB0
    fi
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
elkrien commented 2 years ago

OK, so I'm now stupid. According to grub2 theme guide:

If you'd like to use icons you should make directory image in the theme directory.

Then you should place icons in png format to the directory image. Icon's name should correspond to some predefined class.

Default classes:

windows > os
gnu-linux > gnu > os
osx > darwin > os
hurd > gnu > os
More important class is to the left. If icon windows.png is found then it will be shown. The icon os.png will not.

Main system's class (equal to it's name) will be available also. (main system in this case - is the system where update-grub2 script was called). This class is more important than gnu-linux.

E.g. for ROSA system this class will be "rosa" etc. You can find classes in the file /boot/grub2/grub.cfg.

With patch applied to ROSA, such class will be shown for every other installed OS on the particular computer.

I was looking for something the same as with Windows line: menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os

But in case of Nix i don't see anything like this.

One last chance and big request to You sioodmy (7?). Can You please try to change the name of nix file icon on nix.png in /boot/theme/icons/ directory? If this will not help I will try to find some time to install Nix and do more tests and trials.

sioodmy commented 2 years ago

K, I'll try it later

sioodmy commented 2 years ago

It didn't work 😥 https://github.com/NixOS/nixpkgs/pull/161272

elkrien commented 2 years ago

It didn't work disappointed_relieved NixOS/nixpkgs#161272

So it looks that it's NixOS issue. If this PR will be commited then theme is prepared for it. It looks that I'm not able to do anything more with it. Let's just wait.