what is it?

nixGL is a tool that’s useful for people who use nix on distributions that aren’t nixos. it lets you run graphical applications from nixpkgs with hardware acceleration; without it everything falls back to software rendering

certain applications (such as alacritty won’t function as well without hardware acceleration). this is a guide on how to create a wrapper around these packages for home manager using flakes

how-to

follow this link diff

add to flake.nix inputs

flake.nix
inputs = {
  nixGL = {
    url = "github:nix-community/nixGL";
    inputs.nixpkgs.follows = "nixpkgs";
  };
};

in home.nix add an alias at the top

home.nix
{ pkgs, inputs, ... }:
 
let
  nixGLIntel = inputs.nixGL.packages."${pkgs.system}".nixGLIntel;
in
 
{
 
}

update imports, to get a sha256, run the following:

curl https://raw.githubusercontent.com/Smona/home-manager/nixgl-compat/modules/misc/nixgl.nix | sha256sum
home.nix
imports = [
  (builtins.fetchurl {
    url = "https://raw.githubusercontent.com/Smona/home-manager/nixgl-compat/modules/misc/nixgl.nix";
    sha256 = "<RESPONSE FROM CURL CMD ABOVE>";
  })
];
 
nixGL.prefix = "${nixGLIntel}/bin/nixGLIntel";

wrap the packages that need hardware acceleration

alacritty.nix
{ pkgs, config, ... }:
 
{
  programs.alacritty = {
    enable = true;
    package = (config.lib.nixGL.wrap pkgs.alacritty);
  };
}

run home-manager switch --flake .