I’m trying to package lazysql as a nix derivation using pkgs.buildGoMod, but am getting the error X11/Xlib.h: No such file or directory. I tried adding libx11, libx11.dev, and pkgconfig to the nativeBuildInputs option and to buildInputs using overrideModAttrs, but still the same error both times. I can get it to build in a nix shell with the same packages though. any ideas what I could be missing?
I believe you shouldn’t use overrideModAttrs since the error happens during the build in the primary derivation, not in the mod derivation where it fetches the dependencies.
copying that works, thank you for looking for that. I dont really understand how it works though, looking at the source for buildGoModule buildInputs isn’t listed in the args.
{ name ? "${args'.pname}-${args'.version}"
, src
, nativeBuildInputs ? [ ]
, passthru ? { }
, patches ? [ ]
# A function to override the goModules derivation
, overrideModAttrs ? (_oldAttrs: { })
# path to go.mod and go.sum directory
, modRoot ? "./"
# vendorHash is the SRI hash of the vendored dependencies
#
# if vendorHash is null, then we won't fetch any dependencies and
# rely on the vendor folder within the source.
, vendorHash ? args'.vendorSha256 or (throw "buildGoModule: vendorHash is missing")
# Whether to delete the vendor folder supplied with the source.
, deleteVendor ? false
# Whether to fetch (go mod download) and proxy the vendor directory.
# This is useful if your code depends on c code and go mod tidy does not
# include the needed sources to build or if any dependency has case-insensitive
# conflicts which will produce platform dependant `vendorHash` checksums.
, proxyVendor ? false
# We want parallel builds by default
, enableParallelBuilding ? true
# Do not enable this without good reason
# IE: programs coupled with the compiler
, allowGoReference ? false
, CGO_ENABLED ? go.CGO_ENABLED
, meta ? { }
# Not needed with buildGoModule
, goPackagePath ? ""
, ldflags ? [ ]
# needed for buildFlags{,Array} warning
, buildFlags ? ""
, buildFlagsArray ? ""
, ...
}