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

**URL:** https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599
**Category:** Help
**Created:** [April 25, 2023, 3:35pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599 "2023-04-25T15:35:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rubenmoor](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rubenmoor/32/3631_2.png) [@rubenmoor](https://discourse.nixos.org/u/rubenmoor)
#### Post date: [April 25, 2023, 3:35pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/1 "2023-04-25T15:35:52Z")

</div>

I am using NixOS.

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

> **[Vandal / Dark Matter GRUB Theme · GitLab](https://gitlab.com/VandalByte/darkmatter-grub-theme)**
>
> Dark Matter GRUB Theme 👾💙 is a collection of dark polished GRUB themes for a variety of Linux distros

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):

> 1️⃣ 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.

---

<div class="post-metadata">

### Author: ![emmanuelrosa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/emmanuelrosa/32/1924_2.png) [@emmanuelrosa](https://discourse.nixos.org/u/emmanuelrosa)
#### Post date: [April 26, 2023, 1:29pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/2 "2023-04-26T13:29:18Z")

</div>

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.

**flakes.nix**

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

  outputs = { self, nixpkgs, darkmatter }@attrs: {
    nixosConfigurations.my-hostname = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [         
        darkmatter.nixosModule
        ./configuration.nix
      ];
    };
  };
}

```

**configuration.nix**

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

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

```

---

<div class="post-metadata">

### Author: ![rubenmoor](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rubenmoor/32/3631_2.png) [@rubenmoor](https://discourse.nixos.org/u/rubenmoor)
#### Post date: [April 27, 2023, 1:38pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/3 "2023-04-27T13:38:23Z")

</div>

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`?

---

<div class="post-metadata">

### Author: ![emmanuelrosa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/emmanuelrosa/32/1924_2.png) [@emmanuelrosa](https://discourse.nixos.org/u/emmanuelrosa)
#### Post date: [April 27, 2023, 1:50pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/4 "2023-04-27T13:50:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![rubenmoor](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rubenmoor/32/3631_2.png) [@rubenmoor](https://discourse.nixos.org/u/rubenmoor)
#### Post date: [April 27, 2023, 1:52pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/5 "2023-04-27T13:52:53Z")

</div>

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.

```auto
$ ls /etc/nixos
configuration.nix
hardware-configuration.nix
include
users.nix

```

---

<div class="post-metadata">

### Author: ![emmanuelrosa](https://discourse.nixos.org/user_avatar/discourse.nixos.org/emmanuelrosa/32/1924_2.png) [@emmanuelrosa](https://discourse.nixos.org/u/emmanuelrosa)
#### Post date: [April 27, 2023, 4:43pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/6 "2023-04-27T16:43:27Z")

</div>

Try using my fork ([https://gitlab.com/emmanuelrosa/darkmatter-grub-theme/-/tree/nixos-non-flake?ref\_type=heads](https://gitlab.com/emmanuelrosa/darkmatter-grub-theme/-/tree/nixos-non-flake?ref_type=heads)) like this in your configuration.nix:

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

{
  imports =
    [(let rev = "e38afc30f28299b525ccc7ccff421d4fb8bebb1b"; in import (builtins.fetchTarball {
          url = "https://gitlab.com/emmanuelrosa/darkmatter-grub-theme/-/archive/${rev}/darkmatter-grub-theme-${rev}.tar.gz";
          sha256 = "0i0swsw2fb82c6fn84i4rqz455d9x17ym59gd6rm33i8iys81xbl";
     }))
    ];
}

```

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

---

<div class="post-metadata">

### Author: ![rubenmoor](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rubenmoor/32/3631_2.png) [@rubenmoor](https://discourse.nixos.org/u/rubenmoor)
#### Post date: [April 27, 2023, 6:49pm UTC](https://discourse.nixos.org/t/how-to-add-darkmatter-grub-theme-to-your-flake-as-nixos-module/27599/7 "2023-04-27T18:49:36Z")

</div>

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:

> **[Flakes - NixOS Wiki](https://nixos.wiki/wiki/Flakes)**

to

## 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 …

Thanks!
