# Zon2Nix & ZigDeps: unable to connect to server: NameServerFailure

**URL:** https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082
**Category:** Help
**Created:** [September 14, 2026, 3:40am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082 "2026-09-14T03:40:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![OulipianSummer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/oulipiansummer/32/32031_2.png) [@OulipianSummer](https://discourse.nixos.org/u/OulipianSummer)
#### Post date: [September 14, 2026, 3:40am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082/1 "2026-09-14T03:40:11Z")

</div>

I’m trying to package up [rhine](https://codeberg.org/sivecano/rhine) for the new [river compositor](https://search.nixos.org/packages?channel=26.05&query=river#show=river) and I’m running into an issue trying to pull zig dependencies from Codeberg.

No matter what method I use, either [zon2nix](https://github.com/nix-community/zon2nix) or [zig.deps](https://github.com/NixOS/nixpkgs/blob/c2c46e4dba17c167b7b892df46813863e0d10ae1/pkgs/by-name/fa/fast-cli-zig/package.nix#L19-L28), I end up getting the exact same build errors

```auto
error: builder for '/nix/store/y3hsr67y7awsvsh6xf36hsw3z3gs6w7q-rhine-0.3.0.drv' failed with exit code 1;
       last 19 log lines:
       > Using versionCheckHook
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/jvd75z1h0ys2rd4b7xw7jqiblii7cida-source
       > source root is source
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running phase: buildPhase
       > zig build flags: -j16 -Dcpu=baseline --release=safe
       > /build/source/build.zig.zon:8:20: error: unable to connect to server: NameServerFailure
       > .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.6.0.tar.gz",
       > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > /build/source/build.zig.zon:12:20: error: unable to connect to server: NameServerFailure
       > .url = "https://codeberg.org/Games-by-Mason/mr_tween/archive/v0.1.0.tar.gz",
       > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > /build/source/build.zig.zon:16:20: error: unable to discover remote git server capabilities: NameServerFailure
       > .url = "git+https://codeberg.org/Sivecano/libtributary#ad5ee12ecae34c6aac55c55eeffce50f85cb3856",
       > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > 
       For full logs, run:
          nix log /nix/store/y3hsr67y7awsvsh6xf36hsw3z3gs6w7q-rhine-0.3.0.drv

```

Here’s my (very rough) package.nix

```nix
{
  lib,
  pkgs,
  ...
}:

pkgs.stdenv.mkDerivation (finalAttrs: {
  pname = "rhine";
  version = "0.3.0";
  strictDeps = true;

  src = pkgs.fetchFromCodeberg {
    #url = "https://codeberg.org/Sivecano/rhine/archive/${finalAttrs.version}.tar.gz";
    #hash = "sha256-1urSOudD12Ge/hy3mGFfGNQAKLjqvuyV+cO1T4HloYs=";
    owner = "Sivecano";
    repo = "rhine";
    tag = finalAttrs.version;
    hash = "sha256-1urSOudD12Ge/hy3mGFfGNQAKLjqvuyV+cO1T4HloYs=";
  };

  nativeBuildInputs = with pkgs; [
    zig_0_16
    pkg-config
  ];

  buildInputs = with pkgs; [
    wayland-scanner
    river
    libxkbcommon
    wayland
    dbus
    wayland-protocols
  ];
  
  zigDeps = pkgs.zig_0_16.fetchDeps {
    inherit (finalAttrs) src pname version;
    hash = "sha256-wvnECiDfK17uKGySe2SYEkpHL0RdRQTlS+b8zGw2F9g=";
  };

  postConfigure = ''
    ln -s ${finalAttrs.zigDeps} $ZIG_GLOBAL_CACHE_DIR/p
  '';

  nativeInstallCheckInputs = with pkgs; [versionCheckHook];
  versionCheckProgramArg = "-version";

  postInstall = ''
    install rhine.desktop -Dt $out/share/wayland-sessions
  '';

  doCheck = true;
  doInstallCheck = true;
})

```

And, although this exact package doesn’t utilize it, this is what my `build.zon.nix` file looks like when I decide to use zon2nix

```nix
# generated by zon2nix (https://github.com/nix-community/zon2nix)

{ linkFarm, fetchzip, fetchgit }:

linkFarm "zig-packages" [
  {
    name = "mr_tween-0.1.0-WbH78YcBAQD3RF4QfCYFF6EJCYzAzdIU4BHCj0pFI5yq";
    path = fetchzip {
      url = "https://codeberg.org/Games-by-Mason/mr_tween/archive/v0.1.0.tar.gz";
      hash = "sha256-+f3klYdTikb7qoggebyOET+xHH9IuZt78MQTfpJOZjM=";
      extension = "tar.gz";
    };
  }
  {
    name = "tributary-0.4.0-tqCfW5fFAAC_PBxqMMwGJRlbwU8XThn9b2zIieRvQgDX";
    path = fetchgit {
      url = "https://codeberg.org/Sivecano/libtributary";
      rev = "ad5ee12ecae34c6aac55c55eeffce50f85cb3856";
      hash = "sha256-PKtVtnUbfjOkAkYOaUCaMgAT/2rplMxFESgKNL9DFJk=";
    };
  }
  {
    name = "wayland-0.6.0-lQa1kqz8AQADQmdNJsNhLoNHcnEGEUjrOaPV-dtEnEmX";
    path = fetchzip {
      url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.6.0.tar.gz";
      hash = "sha256-3m/ITNhZUJ/5uD/Tqm+0uZSktGoYgWF5oldOqOCUkIE=";
      extension = "tar.gz";
    };
  }
]

```

I tacked on the `extension` key for the zip archives after reading though [this issue](https://github.com/nix-community/zon2nix/issues/62) which also cued me into `zig.fetchDeps`. I also read [this discourse thread](https://discourse.nixos.org/t/how-should-we-package-zig-software/77409) discussing the current packaging workflow for zig, which gave me the resources for trying a few different dependency management methods, neither of which have worked.

After researching, I’m thoroughly convinced that this is a Codeberg issue (maybe too much bot prevention?). Am I missing something here that would make fetching these tarballs simply impossible using my current setup? Any help is appreciated.

---

<div class="post-metadata">

### Author: ![RossComputerGuy](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rosscomputerguy/32/7194_2.png) [@RossComputerGuy](https://discourse.nixos.org/u/RossComputerGuy)
#### Post date: [September 14, 2026, 3:44am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082/2 "2026-09-14T03:44:33Z")

</div>

I do recommend using fetchDeps, though you’re missing the preConfigure hook.

```nix
postConfigure = ''
  ln -s $zigDeps $ZIG_GLOBAL_CACHE_DIR/p
'';

```

Also you don’t need to specify `.hook` since the hook will automatically be loaded in.

---

<div class="post-metadata">

### Author: ![OulipianSummer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/oulipiansummer/32/32031_2.png) [@OulipianSummer](https://discourse.nixos.org/u/OulipianSummer)
#### Post date: [September 14, 2026, 4:15am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082/3 "2026-09-14T04:15:22Z")

</div>

Ok, that’s certainly changed things as I’m getting different errors now. I must have had some typos the last time I tried this. I’ve also updated my horribly hacked up package.nix to reflect the file I’m using now.

```auto
b1kfzlvqiwbcpw4sd2j3v63vqab3vg-zig-0.16.0/lib/zig/ --listen=-
       > install -C .zig-cache/o/33324a2b19574f0b2ea007a5d237ff02/rhine /build/source/zig-out/bin/rhine
       > buildPhase completed in 1 minutes 31 seconds
       > Running phase: checkPhase
       > zig check flags: -j16 -Dcpu=baseline --release=safe
       > pkg-config --variable=pkgdatadir wayland-scanner
       > pkg-config --variable=pkgdatadir wayland-protocols
       > pkg-config river-protocols --variable=pkgdatadir
       > info: access the help menu with "zig build -h"
       > error: no step named 'test'
       > error: the following build command failed with exit code 1:
       > .zig-cache/o/976000f9880524155d01cbf72ded8392/build /nix/store/kbb1kfzlvqiwbcpw4sd2j3v63vqab3vg-zig-0.16.0/bin/zig /nix/store/kbb1kfzlvqiwbcpw4sd2j3v63vqab3vg-zig-0.16.0/lib/zig /build/source .zig-cache /build/tmp.fQEaZFXn3A --seed 0x1c25174f -Z7908611a75f81679 test -j16 -Dcpu=baseline --release=safe --verbose
       For full logs, run:
         nix log /nix/store/1iqqsf6bfy9invi4jgfdadad4np4kdq4-rhine-0.3.0.drv

```

---

<div class="post-metadata">

### Author: ![RossComputerGuy](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rosscomputerguy/32/7194_2.png) [@RossComputerGuy](https://discourse.nixos.org/u/RossComputerGuy)
#### Post date: [September 14, 2026, 4:17am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082/4 "2026-09-14T04:17:13Z")

</div>

Ah yeah, there’s no unit tests so just `doCheck = false`.

---

<div class="post-metadata">

### Author: ![OulipianSummer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/oulipiansummer/32/32031_2.png) [@OulipianSummer](https://discourse.nixos.org/u/OulipianSummer)
#### Post date: [September 14, 2026, 4:20am UTC](https://discourse.nixos.org/t/zon2nix-zigdeps-unable-to-connect-to-server-nameserverfailure/80082/5 "2026-09-14T04:20:59Z")

</div>

Oof. It’s been a long day. Of _course_ that’s the fix.

Ok. I got a successful build off of this, so I’m marking it solved. Thanks for your help!
