-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
add flake for easier build support #694
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,58 @@ | ||||||
{ | ||||||
description = "Next generation distributed, event-driven, parallel config management!"; | ||||||
inputs = { | ||||||
flake-utils.url = "github:numtide/flake-utils"; | ||||||
nixpkgs.url = "github:urandom2/nixpkgs/mgmt"; | ||||||
}; | ||||||
outputs = { | ||||||
flake-utils, | ||||||
nixpkgs, | ||||||
self, | ||||||
}: | ||||||
flake-utils.lib.eachDefaultSystem (system: let | ||||||
buildInputs = with pkgs; [ | ||||||
augeas | ||||||
libvirt | ||||||
libxml2 | ||||||
]; | ||||||
nativeBuildInputs = with pkgs; [ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are dependencies that are called during the build process explicitly |
||||||
gotools | ||||||
nex | ||||||
pkg-config | ||||||
ragel | ||||||
]; | ||||||
pkgs = nixpkgs.legacyPackages.${system}; | ||||||
in { | ||||||
devShells.default = pkgs.mkShell { | ||||||
inherit buildInputs nativeBuildInputs; | ||||||
packages = [pkgs.go]; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if there is anything I missed that is useful for testing/debugging/development, we should add it here |
||||||
}; | ||||||
packages.default = let | ||||||
pname = "mgmt"; | ||||||
version = "0.0.22"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unfortunately, flakes cannot consume version strings from vcs, so you will be required to manually update the string before releases, or just leave the flake as something like
Suggested change
|
||||||
in | ||||||
pkgs.buildGoModule { | ||||||
inherit pname version buildInputs nativeBuildInputs; | ||||||
ldflags = [ | ||||||
"-X main.program=${pname}" | ||||||
"-X main.version=${version}" | ||||||
]; | ||||||
meta = { | ||||||
description = "Next generation distributed, event-driven, parallel config management!"; | ||||||
homepage = "https://mgmtconfig.com"; | ||||||
license = pkgs.lib.licenses.gpl3; | ||||||
}; | ||||||
preBuild = '' | ||||||
substituteInPlace Makefile --replace "/usr/bin/env " "" | ||||||
substituteInPlace lang/Makefile --replace "/usr/bin/env " "" | ||||||
substituteInPlace lang/types/Makefile --replace "/usr/bin/env " "" | ||||||
Comment on lines
+46
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these execute the same change I would suggest: use |
||||||
substituteInPlace lang/types/Makefile --replace "unset GOCACHE &&" "" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reviewed the linked upstream bug, golang/go#31843, and it is both stale/closed, and I could not trigger it during testing; can we consider it resolved and remove the override? |
||||||
patchShebangs . | ||||||
make lang funcgen | ||||||
''; | ||||||
src = ./.; | ||||||
subPackages = ["."]; | ||||||
vendorHash = "sha256-Dtqy4TILN+7JXiHKHDdjzRTsT8jZYG5sPudxhd8znXY="; | ||||||
}; | ||||||
}); | ||||||
} |
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.
these are dependencies that are linked against, think shared libraries