Declaring packages for multiple devshells

Hello I am trying to nix for a dev env and for ci. I’d like to declare the common packages just once rather than in each shell. Im just not “getting it” - the flowing error on “infinite recursion encountered” at the with pkgs; [ line.

What is the right way to do this?

{
  inputs.devshell.url = "github:numtide/devshell";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = github:nixos/nixpkgs/nixos-22.11;

  outputs = { self, flake-utils, devshell, nixpkgs }:

    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ devshell.overlay ];
        } // 
        with pkgs; [
          dprint
          nodejs
        ];
        
     in {

      devShells.default = pkgs.devshell.mkShell {
        imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
      };

      devShells.ci = pkgs.devshell.mkShell {
        imports = [ (pkgs.devshell.importTOML ./devshell-ci.toml) ];
      };

    }
    
  );
}

you are defining pkgs by appending pkgs to pkgs to pkgs to pkgs, (hopefully you are seeing the problem here :sweat_smile:)…

If you want a list of shared packages don’t append it, just set it as a separate variable.

I thought I was misunderstanding appends rather than with. Thanks.

… and thought all the packages needed to be in the pkgs var.