Fix the fucking “—show-trace” thing folks. Seriously.
IIRC debugger comes with nix 2.9 and nixpkgs for 22.05 still has 2.8.x.
Of course running with the debugger flag resulted in an unintelligible error message and no debugger.
buildInputs = [ nixpkgs.gcc ];
but it complains that nixpkgs.gcc does not exist. There's nothing helpful. I remember fixing this issue a month ago, and I have no recollection on how I did it. buildInputs = [ nixpkgs.legacyPackages."x64_64-linux".gcc ];
In practice, it usually looks something like this: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in stdenv.mkDerivation {
...
buildInputs = [ pkgs.gcc ];
...
}You can do this up top by hand, e.g. P = inputs.nixpkgs { inherit system; }, but more commonly you would use a library like ‘flake-utils’ or ‘flake-utils-plus’ to issue system configuration for all supported packages to all your packages/derivations/devShells.
I have this or that nitpick with FL and FLP but overall it’s very solid stuff. FLP is a little more “magical”, and that’s not always the best starting out, but you really can’t go wrong with either.
To correct your coffee snippet: nativeBuildInputs = [ pkgs.gcc ];
I strongly encourage the Nix community to embrace a mainstream Q&A platform like StackOverflow or GitHub Issues.
Nix is “weird” enough for beginners already, the kind of janky interface and uneven moderation/quality on discourse is IMHO self-defeating for Nix.
Maybe I'm holding it wrong, but I almost never get useful error messages from Nix (NixOS and NixOps). Almost every error is deep within some module with no trace to the option I set. Just nix barfing its 300-line eval traceback where my own code doesn't even appear.