How to "add darkmatter-grub-theme to your flake as nixos module"

I am using NixOS.

There is documentation on how to enable the darkmatter-theme for the grub boot loader on NixOS, here:

However, this documentation is just not enough for me to figure out what exactly I do. There is a file shown that looks to me like a flake.nix and then the next file looks to me like a /etc/nixos/configuration.nix and depends somehow on that flake.

The part that I am missing is (probably):

:one: Add darkmatter-grub-theme to your flake as nixos module

If someone can point me to some basic introduction on the relation of flakes with NixOS modules, I would be grateful, too.

To use the dark matter theme:

  1. Add the repo to your inputs.
  2. Add the dark matter module to the list of modules.
  3. Enable the theme in your configuration.


   inputs.darkmatter.url = "gitlab:VandalByte/darkmatter-grub-theme";

  outputs = { self, nixpkgs, darkmatter }@attrs: { = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [         


{ config, pkgs, lib, nixpkgs, ... }:
    loader = {
      systemd-boot.enable = false;     
      grub.enable = true;

      grub.darkmatter-theme = {
        enable = true;
        style = "nixos";

There is still something basic that I am missing: where does the file flakes.nix live?

How is my configuration.nix in /etc/nixos/ aware of grub.darkmatter-theme?

Perhaps you’re not using Nix flakes. What files do you have in /etc/nixos/?

that’s right. I am not using nix flakes for my system configuration. I activated the flakes experimental feature to use flakes as dependency in my haskell projects.

$ ls /etc/nixos

Try using my fork (Files · nixos-non-flake · Emmanuel Rosa / Dark Matter GRUB Theme · GitLab) like this in your configuration.nix:

{ config, lib, pkgs, ... }:

  imports =
    [(let rev = "e38afc30f28299b525ccc7ccff421d4fb8bebb1b"; in import (builtins.fetchTarball {
          url = "${rev}/darkmatter-grub-theme-${rev}.tar.gz";
          sha256 = "0i0swsw2fb82c6fn84i4rqz455d9x17ym59gd6rm33i8iys81xbl";

Let me know how it goes so I can submit a PR.

I can confirm that this works - for my NixOS w/o flakes.

Also, I finally found the documentation for switching to flakes for my NixOS configuration, scrolling down here:


Using nix flakes with NixOS

Doesn’t look to difficult, really. I might as well do the switch.

Now grub doesn’t recognize my MS Windows installation. But that’s a different problem …