Hi friends.
I am attempting to package a custom cursor set and reference it inside my own NixOS flakes configuration. I am at a bit of a loss and I’m not sure what the root of the issue is, so this is a bit of a long post. For reference, here is the file structure of files I will mention here.
nixos-config
├──pkgs
│ ├──phinger-cursors-gruvbox-material
│ │ └──default.nix
│ └──default.nix
└──flake.nix
So what I’ve done so far is create the derivation as “phinger-cursors-gruvbox-material/default.nix” . I don’t think this is part of the issue as it builds without error using nix build .\#phinger-cursors-gruvbox-material
, but I’m providing a link to the full file just in case.
Then I import nixpkgs and use pkgs.callPackage in “pkgs/default.nix”:
{ pkgs ? import <nixpkgs> { config = { allowUnfree = true; }; } }: rec
{
phinger-cursors-gruvbox-material = pkgs.callPackage ./phinger-cursors-gruvbox-material { };
}
And finally I have “pkgs/default.nix” imported into the packages output in flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
};
outputs = { self, nixpkgs, home-manager, plasma-manager, stylix, ... } @ inputs:
let
system = "x86_64-linux";
in
{
packages.${system} = (
let pkgs = nixpkgs.legacyPackages.${system};
in import ./pkgs { inherit pkgs; }
);
};
}
(This is an excerpt, full flake.nix is here)
So the problem is that when I try to reference pkgs.phingers-cursors-gruvbox-material somewhere in the configuration, I get this error from nix flake check
:
error: attribute 'phinger-cursors-gruvbox-material' missing
at /nix/store/ngzg67g2hyn6n5jkayh7nghxxiv66kgr-source/hosts/common/optional/stylix.nix:30:17:
29| cursor = {
30| package = pkgs.phinger-cursors-gruvbox-material;
| ^
31| name = "Phinger Cursors Gruvbox Material";
I would assume that after adding “pkgs/default.nix” as an output, I would be able to use the package made by the derivation anywhere just like any other package from nixpkgs. Am I missing a step somewhere? Do I need to provide more information? I would love to hear some input from someone else about this.
Also according to this post. I can add config = { allowUnfree = true; };
to the imported nixpkgs and have nix stop complaining about licenses, but I’m still having that issue even after adding it.
Thanks.