I’m trying to build binary and provision it as a NixOS package, but official NixPkgs documentation only includes way of building Go modules, which means that Go code has to have go.mod inside, and vendoring set up. But in my case, I have just regular repository, which, imperatively I would have built, like this:
go build -o $BIN_PATH
Is there’s a way to build GoLang source code in NixOS, without it being a Go module?
Nix interpreter returns error error: attribute 'nginx-mail-auth-http' missing
How do I make it appear in the NixOS environment. I’ve already did simillar thing with scripts, created with writeScriptBin function, but I think, overlays are not suitable there. Or, am I wrong?
Yeah, sorry. Forgot about that question. I’m using server on NixOS, in production environment, but I rather new to it, that’s why I have to ask many questions to handle server administration
Yes, I need to get this package into ${pkgs}. I was able to get scripts, I write, into ${pkgs} using:
It works exactly the same, you can even use the same overlay.
Though you shouldn’t use pkgs within the overlay, as the overlay modifies it. That’s prone to infinite recursion.
As a rule of thumb, refer to packages from super and functions from self. As self is roughly to describe as the package set after all modifications and at the same time what will become pkgs eventually, and that is actually why your snippet does not infinitely recurse.
To get your attributes into pkgs eventually, adding the following attribute should suffice: