Nix Package Flake not Buildable

I have this flake

{
  description = "CrossGrub";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
    numtide-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, numtide-utils, ... }@inputs:
    numtide-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        crossGrub = pkgs.stdenv.mkDerivation {
          pname = "crossgrub";
          version = "1.0.0";
          src = pkgs.fetchFromGitHub {
            owner = "jnccd";
            repo = "crossgrub";
            rev = "1bac404598a3bd105c36ed02cb79895779a471bb";
            hash = "sha256-TBekdpKmvPlUIdAUbkLfFJXZH8oGufVeMELosHw4tC0=";
          };

          dontBuild = true;

          installPhase = ''
            runHook preInstall
            mkdir -p $out/
            cp ./assets/*.png ./theme.txt ./*.pf2 $out/
            runHook postInstall
          '';

          passthru.updateScript = pkgs.nix-update-script { };

          meta = with pkgs.lib; {
            description = "A CrossCode-styled GRUB theme";
            license = lib.licenses.mit;
            platforms = platforms.linux;
          };
        };
      in {
        packages.${system} = {
          inherit crossGrub;
          default = crossGrub;
        };
        defaultPackage.${system} = crossGrub;
      });
}

Its pretty much a standard approach for packaging something, I think.

Now when I try to build it I get this

$ nix build .
warning: Git tree '/home/dobiko/git/crossgrub' is dirty
error: expected flake output attribute 'defaultPackage.x86_64-linux' to be a derivation or path but found a set: { x86_64-linux = «thunk»; }

crossGrub is specifically made by pkgs.stdenv.mkDerivation, it doesnt get more derivationy than that right?

1 Like

Because you are adding an additional level. Just remove the ${system}. See the example: GitHub - numtide/flake-utils: Pure Nix flake utility functions [maintainer=@zimbatm] · GitHub. The framework you use already takes care of this.

This is the reason why I personally don’t use frameworks for simple things like that because you don’t exactly know what is done under the hood.

1 Like