Skip to content

devshell does not include outputs attrs #340

Description

@maxheld83

Describe the bug

A vanilla flake (or even with flake-parts) with devShells entry will yield, for example, a outputs.devShells.aarch64-darwin.default.outputs attribute set.
A flake using on devshell does not have this attribute set.

To Reproduce

Steps to reproduce the behavior:

Vanilla/flake-parts flake:

{
  description = "Description for the project";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts = {
      inputs.nixpkgs-lib.follows = "nixpkgs";
      url = "github:hercules-ci/flake-parts";
    };
  };

  outputs =
    inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [
        "aarch64-darwin"
      ];
      perSystem =
        { 
          pkgs,
          ...
        }:
        {
          devShells.default = pkgs.mkShell {
            packages = [
              pkgs.git
            ];
          };
        };
    };
}

in nix repl, this yields:

nix-repl> outputs.devShells.aarch64-darwin.default.outputs
[ "out" ]

Using a minimal devshell flake:

{
  description = "Description for the project";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts = {
      inputs.nixpkgs-lib.follows = "nixpkgs";
      url = "github:hercules-ci/flake-parts";
    };
    devshell.url = "github:numtide/devshell";
  };

  outputs =
    inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [ inputs.devshell.flakeModule ];
      systems = [
        "aarch64-darwin"
      ];
      perSystem =
        { 
          pkgs,
          ...
        }:
        {
          devshells.default = {
            packages = [
              pkgs.git
            ];
          };
        };
    };
}

nix repl yields:

nix-repl> outputs.devShells.aarch64-darwin.default.outputs
warning: Nix search path entry '/Users/max/.nix-defexpr/channels' does not exist, ignoring
error: attribute 'outputs' missing
       at «string»:1:1:
            1| outputs.devShells.aarch64-darwin.default.outputs
             | ^

Expected behavior

I am interpreting derivation {}'s docs to imply that while it's outputs argument is optional, because it has a default "out", all flake outputs can be expected to have a *.default.outputs attribute set.

System information

This is macOS 15.3.1, nix (Nix) 2.26.2.

Additional context

Other software such as flake-iter also seems to assume the *.default.outputs attribute; that's where I ran into this problem, see DeterminateSystems/flake-iter#22

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions