diff --git a/README.md b/README.md index 3dffb86..8a1b2aa 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,42 @@ For Debian, you can follow [this link](https://vitux.com/install-grub-customizer Install grub themes with `grub-customizer` tool +## NixOS installation + +- Add this flake input to your **flake.nix** inputs +```nix +inputs = { + grub-theme = { + url = "github:xenlism/Grub-themes"; + }; + + # More inputs ... +}; +``` + +> [!IMPORTANT] +> If you switched your theme from systemd-boot to GRUB. +> You have to change your boot entry in UEFI or BIOS to GRUB. +> Because NixOS will otherwise still boot into systemd-boot. + +- Then set GRUB theme to this package in your **configuration.nix** file +```nix +boot.loader.grub.theme = inputs.grub-theme.packages.x86_64-linux.xenlism-grub-theme-nixos-1080p; +``` + +> [!NOTE] +> Just a side note, in case you are using stylix or something that sets GRUB theme for you. +> You will maybe have to set this option with *lib.mkForce* to make it override other value. + +- You can pick from list of distros and resolutions that are present in the [original repo](https://github.com/xenlism/Grub-themes/) + +- To view all possible options run `nix flake show github:xenlism/Grub-themes --no-write-lock-file` this will display all possible packages to install + +- To change theme you just have to change the package name in **configuration.nix** option like this: +```nix +boot.loader.grub.theme = inputs.grub-theme.packages.x86_64-linux.xenlism-grub-theme-[distribution]-[resolution]; +``` + ## Preview | Ubuntu | Mint Linux | diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4dea52a --- /dev/null +++ b/flake.nix @@ -0,0 +1,73 @@ +{ + description = "Xenlism GRUB themes — packaged for NixOS"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + lib = pkgs.lib; + + + # supported resolutions and distros + resolutions = [ "1080p" "2k" "4k" ]; + distros = [ + "arch" "Debian" "Fedora" "gentoo" "kali" "mac" "Manjaro" + "mint" "nixos" "opensuse" "popos" "ubuntu" "win10" "win11" + ]; + + mkTheme = { distro, resolution }: pkgs.stdenvNoCC.mkDerivation { + pname = "xenlism-grub-theme-${distro}-${resolution}"; + version = "2025-10-18"; + + src = pkgs.fetchFromGitHub { + owner = "xenlism"; + repo = "Grub-themes"; + rev = "40ac048df9aacfc053c515b97fcd24af1a06762f"; + hash = "sha256-ProTKsFocIxWAFbYgQ46A+GVZ7mUHXxZrvdiPJqZJ6I="; + }; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + # Construct path like xenlism-grub-1080p-nixos/ + srcDir="xenlism-grub-${resolution}-${distro}" + themeDir="$out" + + mkdir -p "$themeDir" + echo "Copying theme from $srcDir" + cp -r "$srcDir"/Xenlism-${lib.toUpper (lib.substring 0 1 distro)}${lib.substring 1 (lib.stringLength distro - 1) distro}/* "$themeDir/" + + runHook postInstall + ''; + + meta = { + description = "Xenlism GRUB theme for ${lib.toUpper distro} (${resolution})"; + homepage = "https://github.com/xenlism/Grub-themes"; + #license = lib.licenses.gpl3Plus; + platforms = lib.platforms.linux; + maintainers = []; + }; + }; + + allThemes = builtins.listToAttrs ( + builtins.concatLists (map (distro: + map (resolution: { + name = "xenlism-grub-theme-${distro}-${resolution}"; + value = mkTheme { inherit distro resolution; }; + }) resolutions + ) distros) + ); + + in { + packages.${system} = allThemes // { + default = allThemes."xenlism-grub-theme-nixos-1080p"; + }; + }; +} +