Skip to content

with inputs.devshell but without devshell.toml: error: flake 'git+file:///...' does not provide attribute 'devShells.x86_64-linux.default', ... #153

Description

@devurandom

Describe the bug

When I add inputs.devshell to my flake.nix and create the .envrc (containing use flake), but do not have a devshell.toml file, I will see an error:

$ direnv allow
direnv: loading .../.envrc
direnv: using flake
error: flake 'git+file:///...' does not provide attribute 'devShells.x86_64-linux.default', 'devShell.x86_64-linux', 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
       Did you mean devShells?
direnv: nix-direnv: Evaluating current devShell failed. Falling back to previous environment!
direnv: export +NIX_DIRENV_DID_FALLBACK ~PATH

This can be worked around by creating an empty devshell.toml file:

touch devshell.toml
direnv reload

Due to nix-direnv's caching, which is not aware of the presence of devshell.toml, this problem can be easily masked by a cached direnv still existing from a previous run when devshell.toml was present.

To Reproduce

Steps to reproduce the behavior:

flake.nix:

{
  inputs = {
    ,,,
    blueprint = {
      url = "github:numtide/blueprint";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    devshell = {
      url = "github:numtide/devshell";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  ,,,
}

.envrc

#!/usr/bin/env bash
# Used by https://direnv.net

# Load `nix develop`
use flake

# Extend the environment with per-user overrides
source_env_if_exists .envrc.local

Expected behavior

When devshell.toml is missing, blueprint + devshell behave as if the file was present but empty.

System information

NixOS 25.11 and unstable

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