New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
packr: init at 2.1.0 #59054
packr: init at 2.1.0 #59054
Conversation
3de00f9
to
62a64da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test it out locally by EOD.
version = "2.1.0"; | ||
in | ||
buildGoModule rec { | ||
name = "${pname}-${version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildGoModule
does support pname, so you may skip setting the name
all together.
@@ -10,6 +10,8 @@ | |||
# modSha256 is the sha256 of the vendored dependencies | |||
, modSha256 | |||
|
|||
, modAttrs ? {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a description of what modAttrs is to help other people reading the expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the interface is the part I think could be improved. As is, it's a set of attributes to add to the mkDerviation
call. Something closer to .override
and .overrideAttrs
would make it more consistent with the rest of nixpkgs.
The naive way to do this is to pass those two functions as attributes, and then apply them to go-modules
like so:
{
# ...
, modOverrides ? {}
, modAttrOverrides ? attrs: {}
}:
# ...
let go-modules' = (go-modules.override modOverrides).overrideAttrs modAttrOverrides;
in ...
But maybe there's a cleaner way where the go-modules
are an optional attribute to the main builder.
let defaultBuildGoModules = attrs: buildGoModules {
inherit (attrs) src sourceRoot;
sha256 = attrs.modSha256;
};
in
{
# ...
go-modules ? defaultBuildGoModules attrs
}@attrs:
in which case the caller can use
let
src = fetchFromGitHub {};
sourceRoot = "source/v2";
in
buildGoModule {
inherit src sourceRoot;
go-modules = buildGoModules {
inherit src sourceRoot;
sha256 = "...";
postBuild = "...";
};
}
Since there's a space to put postBuild
in the buildGoModules
call, .override
and .overrideAttrs
aren't required. Since the call is explicit, they're still available if necessary.
The other direction to go, is to assert that the modules build step should be kept simple, and instead only offer an extra modPostBuild
attribute, a bit like fetchurl
only offering a postFetch
hook.
Do any of these seem like better options to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer modAttrs
to be honest. Although allowing the users to provide their own go-modules derivation is quite powerful, it does add unnecessary complexity to a fairly simple build process.
62a64da
to
e1cd234
Compare
packr was added by #63886 |
Motivation for this change
New package, and a build dependency for the current version of the Circle CI command line package
circleci-cli
.This requires some changes to
buildGoModule
, but I don't think what I have here is a very nice expression of that (help wanted).I also could not make
go mod download
actually download all required modules.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)