numtide / flake-utils

Pure Nix flake utility functions [maintainer=@zimbatm]
MIT License
1.14k stars 78 forks source link

eachDefaultSystem leads to missing architecture attributes #114

Closed holzingk closed 7 months ago

holzingk commented 7 months ago

When I run the eachDefaultSystem example with nix develop I get:

error: flake 'git+file:///...' does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux', 'packages.x86_64-linux.devShell.x86_64-linux', 'legacyPackages.x86_64-linux.devShell.x86_64-linux', 'devShell.x86_64-linux' or 'defaultPackage.x86_64-linux'

I am using nix through home manager on opensuse Tumbleweed

zimbatm commented 7 months ago

Try adding a devShells.default = pkgs.mkShell { }; on the same level as the packages and apps entries.

holzingk commented 7 months ago

Ok. Now I have

{
  description = "Flake utils demo";

  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system}; in
      {
        devShells.default = pkgs.mkShell { };
        packages = rec {
          hello = pkgs.hello;
          default = hello;
        };
        apps = rec {
          hello = flake-utils.lib.mkApp { drv = self.packages.${system}.hello; };
          default = hello;
        };
      }
    );
}

Still gives me the same error.

zimbatm commented 7 months ago

Make sure you have Nix > 2.18: nix --version or replace the line with devShell = pkgs.mkShell { }; (which is deprecated now)

holzingk commented 7 months ago

After the upgrade the issue is gone. Thanks!

Maybe a minimum version should be mentioned in the README somewhere.