Unable to use things installed via Nix in Zed tasks.json

Running devenv up from the project directory works fine from the terminal, so it’s something specific with the Zed setup.

Here’s the error I get:

error:
       … while updating the lock file of flake 'git+file:///home/eric/Projects?ref=refs/heads/main&rev=1f8421d7944060b49e905f5d88626790bb506a73'

       … while updating the flake input 'nixpkgs'

       … while fetching the input 'github:NixOS/nixpkgs/nixpkgs-23.11'

       error:
       error: unable to download 'https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-23.11': HTTP error 422

       response body:

       {
         "message": "No commit found for SHA: nixpkgs-23.11",
         "documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit",
         "status": "422"
       }

✖ Command produced the following output:


Error:   × Command `/nix/store/w5km3c8r67mrgspf03y15jhy8g38dqz9-nix-2.21-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-experimental-
  │ features flakes --option warn-dirty false --option eval-cache false --keep-going --max-jobs 11 eval .#devenv.processes --json` failed with with exit code 1


⏵ Task `Start devenv` finished with non-zero error code: 1

My flake.nix:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/c1be43e8e837b8dbee2b3665a007e761680f0c3d";
    systems.url = "github:nix-systems/default";
    devenv.url = "github:cachix/devenv";
  };

  nixConfig = {
    extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
    extra-substituters = "https://devenv.cachix.org";
  };

  outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
    let
      forEachSystem = nixpkgs.lib.genAttrs (import systems);
    in
    {
      packages = forEachSystem (system: {
        devenv-up = self.devShells.${system}.default.config.procfileScript;
      });

      devShells = forEachSystem
        (system:
          let
            pkgs = nixpkgs.legacyPackages.${system};
          in
          {
            default = devenv.lib.mkShell {
              inherit inputs pkgs;
              modules = [
                (import ./devenv.nix {
                  inherit pkgs;
                  config = self.devShells.${system}.default.config;
                })
              ];
            };
          });
    };
}

My Zed’s tasks.json:

[
  {
    "label": "Start devenv",
    "command": "source /home/eric/.bashrc && echo 'Starting app services...' && cd $ZED_WORKTREE_ROOT && devenv up",
    "allow_concurrent_runs": false,
    "use_new_terminal": true,
    "reveal": "always",
    "hide": "on_success",
    "shell": {
      "with_arguments": {
        "program": "/bin/bash",
        "arguments": ["--login"]
      }
    },
    "env": {}
  }
]
1 Like

Sorry, I don’t know what Zed is, but what I would investigate is where that nixpkgs-23.11 is coming from. I don’t see it in your flake.