Hi!
I’m on PopOS with an AMD graphics card, so neither the alacritty nor alacritty-graphics packages work for me out of the box when installed using nix profile add nixpkgs#alacritty-graphics. (They simply refuse to launch.)
I installed nixGL using nix profile install github:guibou/nixGL --impure. This allows me to successfully launch alacritty using the command nixGL alacritty at the terminal. However, hopefully you see the circular dependency here, and I would like to be able to launch it using the cosmic-launcher, as normal.
As far as I understand, this means that I need to change the last line of ~/.nix-profile/share/applications/alacritty.desktop from Exec=alacritty to Exec=nixGL alacritty. However, like all files managed by Nix, this is a read-only symlink into the nix store, so it cannot be manually modified.
The approach that I’m trying to use to tackle this problem is by creating a flake that defines an overlay that adds a preInstall script that modifies that last line using substituteInPlace.
Here’s what I have so far:
flake.nix →
{
description = "Installs a modified alacritty that uses nixGL.";
inputs = {
nixpkgs.url = "https://releases.nixos.org/nixos/25.11/nixos-25.11.4506.078d69f03934";
nixgl.url = "github:nix-community/nixGL";
};
outputs = { self, nixpkgs, nixgl, alacritty }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config = { };
};
in
{
packages.${system}.alacritty = pkgs.alacritty;
packages.${system}.nixgl = pkgs.nixGL;
overlays.default = import ./overlay.nix;
};
}
overlay.nix →
final: prev: {
alacritty = prev.alacritty-graphics.overrideAttrs (oldAttrs: {
preInstall = ''
substituteInPlace extra/linux/Alacritty.desktop \
--replace 'Exec=alacritty' 'Exec=nixGL alacritty'
'';
});
];
}
However, when I try to install this overlay using nix profile add . inside the directory that contains both of the above files, I get this error:
error:
… while updating the lock file of flake 'git+file:///home/rahzael/Git/alacritty-nixGL-patch'
… while updating the flake input 'alacritty'
error: cannot find flake 'flake:alacritty' in the flake registries
So for some reason it doesn’t seem to be able to grab alacritty from nixpkgs?
What am I missing here?