Can't build nix derivation on NixOS, missing config.nix.package.out

I was trying to package tiny-irc and it worked well on WSL. However when I tried to use it on my NixOS machine it stoped building with this error message:

$ nix-build -A tiny
building Nix…
error: attribute ‘config’ in selection path ‘tiny.config.nix.package.out’ not found
building the system configuration…
error: attribute ‘config’ in selection path ‘tiny.config.system.build.toplevel’ not found

I haven’t managed to find any thing even remotely like this, any help would be very appreciated : )

Here’s the derivation expression:

{
  lib,
  rustPlatform,
  fetchFromGitHub,
}:
rustPlatform.buildRustPackage rec {
  pname = "tinyirc";
  version = "0.13.0";
  owner = "osa1";
  repo = "tiny";

  src = fetchFromGitHub {
    inherit owner repo;
    rev = "v${version}";
    sha256 = "lbG07IlBhvY1vFP0aU6mInbiVC60Y9RRAj15tCPlUVM=";
  };

  # This patch downgrades the Cargo.lock version from 4 to 3.
  # I've done this because the cargo version of buildRustPackage
  # isn't recent enough. Cargo.lock version 4 was added in 1.78, the compiler is on 1.77
  cargoPatches = [
    ./downgrade-Cargo.lock-version.patch # Cargo.lock version 4 -> 3
  ];

  cargoHash = "sha256-YDDkYBsg/ORFLgvYf6A/xzgFPAaL5PfzCutLop8v+R8=";

  meta = with lib; {
    description = "A terminal IRC client built in rust";
    homepage = "https://github.com/${owner}/${repo}";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ ];
  };
}

I can still run nix-build with sudo, but then some other errors occour that are related to cargo, not necessarily nix.

Thanks in advance : )

My NixOS version 24.11.717484.26245db0cb55 (Vicuna)

Are you sure you’re using nix-build and not nixos-rebuild? The latter is for building NixOS systems, not simple package derivations. This error especially:

error: attribute ‘config’ in selection path ‘tiny.config.system.build.toplevel’ not found

is something nixos-rebuild would throw, because it looks for that attribute.

1 Like

Oh that was very stupid of me

I’ve made an alias for it and forgot about it!

Thank you so very much :smiley: