vinceliuice / grub2-themes

Modern Design theme for Grub2
GNU General Public License v3.0
3.41k stars 240 forks source link

Add NixOS support #158

Closed dmadisetti closed 2 years ago

dmadisetti commented 2 years ago

Added a flake and module configuration options for installation on NixOS. During a nix build one should set

    boot.loader.grub2-theme = {                                                                                                                                                                                                               
      enable = true;                                                                                                                                                                                                              
      icon = "white";                                                                                                                                                                                                             
      theme = "whitesur";                                                                                                                                                                                                         
      screen = "1080p";                                                                                                                                                                                                           
      splashImage = ../../backgrounds/grub.jpg;                                                                                                                                                                                   
      footer = true;                                                                                                                                                                                                              
    };

in their configuration.

Moved the position of clear (no difference in usage), since this will break Nix on run. No big deal if this is too big of a change for an obscure OS

CardboardTurkey commented 2 years ago

@dmadisetti I use nixos but have no experience with flakes. Could you explain how I'd include this in my config?

dmadisetti commented 2 years ago

@CardboardTurkey I only know about flakes sorry. I think flakes are the future- so I haven't invested the time to figure out default.nix. Here's an example of it in my configs: https://github.com/dmadisetti/.dots/blob/main/nix/machines/mamba.nix#L9-L12

There is backwards compatibility though: https://github.com/edolstra/flake-compat Good luck! @thomassdk has also worked on the nix compatibility, maybe they can offer more insight

CardboardTurkey commented 2 years ago

Thanks a bunch for the suggestions! I played around a bit trying to make a default.nix but couldn't get past this error

error: 'outputs' at /path/to/grub2-themes/flake.nix:12:13 called without required argument 'nixpkgs'

Slightly tangential question: do you have any resources you'd recommend for someone trying to learn more about flakes?

dmadisetti commented 2 years ago

@CardboardTurkey It looks like you are pretty close, you just need to pass in pkgs

Resources: Xe's Blog: https://xeiaso.net/blog/nix-flakes-1-2022-02-21 Tweag's write up: https://www.tweag.io/blog/2020-05-25-flakes/

ink-pot-monkey commented 2 years ago

not much to add here apart from I agree you seem really close! I'm much the same as @dmadisetti in that I've only used Nix since the dawn of the flake, so not sure I have much insight to offer...

However I can add to the Resources list: Its definitely worth checking out the Nix wiki entry on flakes, and it has a bunch of links at the bottom of it as well

CardboardTurkey commented 1 year ago

Thanks for the literature guys!

For anyone reading this I managed to build a default.nix but failed to get it into my configuration.nix. Also tried using builtins.getFlake to no avail too.