Skip to content

Infinite recursion error on macOS for Rust language and processes config #580

@kaiba42

Description

@kaiba42

Describe the bug
After setting up a new project using nix flake init --template github:cachix/devenv after having installed direnv and nix-direnv, the devenv shell fails to initialize if Rust language support is enabled and any process is defined.

direnv: loading ~/Projects/test/.envrc
direnv: using flake . --impure
error: infinite recursion encountered

       at /nix/store/z23x3la7s4ghznq0r9h1vihrmmc4gqg1-source/src/modules/languages/rust.nix:66:35:

           65|       env.RUSTDOCFLAGS = [ "-L framework=${config.env.DEVENV_PROFILE}/Library/Frameworks" ];
           66|       env.CFLAGS = [ "-iframework ${config.env.DEVENV_PROFILE}/Library/Frameworks" ];
             |                                   ^
           67|     })
(use '--show-trace' to show detailed location information)
realpath: /Users/kaiba/Projects/test/.direnv/flake-profile.41320: No such file or directory
direnv: nix-direnv: renewed cache

To reproduce

# .envrc
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

nix_direnv_watch_file devenv.nix
nix_direnv_watch_file devenv.lock
nix_direnv_watch_file devenv.yaml
if ! use flake . --impure
then
  echo "devenv could not be build. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
# flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
    systems.url = "github:nix-systems/default";
    devenv.url = "github:cachix/devenv";
  };

  outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
    let
      forEachSystem = nixpkgs.lib.genAttrs (import systems);
    in
    {
      devShells = forEachSystem
        (system:
          let
            pkgs = nixpkgs.legacyPackages.${system};
          in
          {
            default = devenv.lib.mkShell {
              inherit inputs pkgs;
              modules = [
                {
                  # https://devenv.sh/reference/options/
                  packages = [ pkgs.hello ];

                  
                  # Adding these three lines will result in an infinite recursion error
                  #####################################################################
                  processes = {
                    anything.exec = "ls";
                  };
                  languages.rust.enable = true;
                  #####################################################################

                  enterShell = ''
                    hello
                  '';
                }
              ];
            };
          });
    };
}

Version
devenv: 0.6.2
nix (Nix) 2.13.3
macOS 13.2.1 BuildVersion 22D68

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