Caannot connect devices in local network from dev shell

so i can ping the host 192.168.1.3 but i cant connect to it from the dev shell. But when running a shell with this command nix-shell -p go vips pkg-config everything works fine. In the shell i want my go application to connect to a ftp server. I am developing on an M1 Mac.

outside of the shell:

❯ nc -zv 192.168.1.3 21

192.168.1.3 21 (ftp) open

inside of the shell:

❯ nc -zv 192.168.1.3 21

Error: Couldn't create connection (err=-5): No route to host

my flake:

{
  description = "Flake for Go-Backend";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        pkgs = import nixpkgs {
          inherit system;
        };
      in {
        devShells.default = pkgs.mkShell {
          nativeBuildInputs = with pkgs; [
            go
            gopls
            vips
            pkg-config
          ];
          CGO_CFLAGS_ALLOW="-Xpreprocessor";
        };
      }
    );
  
}
1 Like