Plymouth Bootsplash

I’m trying to get a plymouth bootsplash working but I’m doing something wrong and can’t seem to figure it out. This is the excerpt from my configuration.nix and I suspect something is wrong with the syntax but can’t figure it out:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:
 {
  nixos-boot = {
    enable  = true;

    # Different colors
    # bgColor.red   = 100; # 0 - 255
    # bgColor.green = 100; # 0 - 255
    # bgColor.blue  = 100; # 0 - 255

    # If you want to make sure the theme is seen when your computer starts too fast
    # duration = 3; # in seconds
  };
}
 
 let
  # Fetch the repository
  nixos-boot-src = pkgs.fetchFromGitHub {
    owner = "Melkor333";
    repo = "nixos-boot";
    rev = "main";
    sha256 = "sha256-Dj8LhVTOrHEnqgONbCEKIEyglO7zQej+KS08faO9NJk=";
  };
in
{
  imports = [ "${nixos-boot-src}/modules.nix" ];
};

  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix ];
    
  # Bootloader.
  boot.loader.systemd-boot.enable = true;

  # Use latest kernel.
  boot.kernelPackages = pkgs.linuxPackages_latest;

Grateful for any help I can get.

You can set up a Plymouth bootsplash via boot.plymouth

You should install nixos-boot as a package (or extract the theme from it) and use boot.plymouth.themePackages/theme to set it instead of importing it as being done in your snippet.

The syntax is indeed very wrong. I have no knowledge of nixos-boot, but this should at least be closer to the intended syntax:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

let
  # Fetch the repository
  nixos-boot-src = pkgs.fetchFromGitHub {
    type = "github";
    owner = "Melkor333";
    repo = "nixos-boot";
    rev = "main";
    sha256 = "sha256-Dj8LhVTOrHEnqgONbCEKIEyglO7zQej+KS08faO9NJk=";
  };
in

{
  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
    "${nixos-boot-src}/modules.nix"
  ];
    
  nixos-boot = {
    enable  = true;

    # Different colors
    # bgColor.red   = 100; # 0 - 255
    # bgColor.green = 100; # 0 - 255
    # bgColor.blue  = 100; # 0 - 255

    # If you want to make sure the theme is seen when your computer starts too fast
    # duration = 3; # in seconds
  };
 
  # Bootloader.
  boot.loader.systemd-boot.enable = true;

  # Use latest kernel.
  boot.kernelPackages = pkgs.linuxPackages_latest;

However, it still has problems. It’s following a mutable branch, with a hash. That will break as soon as he updates the repository. Actually, looking at the repo, the hash is provided in the README, in the hashed repository, so it’s cryptographically impossible for it to ever be correct… Also, using pkgs.fetchFromGitHub can function (once you specify a hash), but it’s an instance of IFD (Import From Derivation), which has unpleasant effects on nix evaluation in various senses. If this is what the upstream suggested using… they don’t know nix all that well. I would reconsider using their code, personally. If you must, however, using builtins.fetchGit or builtins.fetchTarball would be better:

  # Fetch the repository
  nixos-boot-src = builtins.fetchTarball {
    # Fetch a specific commit permalink rather than a branch head, so it doesn't break.
    # Update the commit id AND HASH if you ever need to update to a newer version.
    url = "https://github.com/Melkor333/nixos-boot/archive/afaed735149d0a06f234e54dd2d9db2e18dc64ae.tar.gz";
    sha256 = "sha256:1pif4qywbx1bqyifasgiy44g1r7kxr1fpcqlfr02gfl0bj4ar07j";
  };

If this is what the upstream suggested using… they don’t know nix all that well.

@tejing

If I’m understanding you correctly, it means that the issue is with the code itself.

I’m just trying to get a decent bootsplash, something NixOS related. It doesn’t have to be very fancy; just something that looks professional and clean. Do you have any suggestions that may be helpful? I would really appreciate.

Thanks in advance.

Well, the issue you were initially running into was because you integrated the code into your config improperly. The syntax was all wrong. However, the provided code also has further issues, yes.

I’m afraid I don’t have a good suggestion. I’ve never been too concerned with aesthetics. I just use the included spinner theme and call that good enough:

@tejing thanks so much for your help. I’ve also decided to use the spinner and while minimal, it DOES look professional. So that is good enough for me. :ok_hand:

1 Like