Skip to content

zigHook: init#242397

Merged
AndersonTorres merged 3 commits intoNixOS:masterfrom
atorres1985-contrib:zig
Aug 1, 2023
Merged

zigHook: init#242397
AndersonTorres merged 3 commits intoNixOS:masterfrom
atorres1985-contrib:zig

Conversation

@AndersonTorres
Copy link
Member

@AndersonTorres AndersonTorres commented Jul 9, 2023

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@AndersonTorres
Copy link
Member Author

P.S.: Zig eats a lot of memory!

@AndersonTorres AndersonTorres mentioned this pull request Jul 9, 2023
12 tasks
@ofborg ofborg bot requested review from aiotter, andrewrk and dit7ya July 9, 2023 03:39
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jul 9, 2023
@AndersonTorres AndersonTorres marked this pull request as ready for review July 9, 2023 03:44
@AndersonTorres AndersonTorres marked this pull request as draft July 9, 2023 03:45
@IogaMaster
Copy link
Contributor

+1

@AndersonTorres
Copy link
Member Author

AndersonTorres commented Jul 9, 2023

Now I am a bit more confident of splitting this!
I will open a new PR for the packages that uses Zig.

@AndersonTorres AndersonTorres marked this pull request as ready for review July 9, 2023 23:32
@ofborg ofborg bot added the ofborg-internal-error Ofborg encountered an error label Jul 9, 2023
@AndersonTorres AndersonTorres removed the ofborg-internal-error Ofborg encountered an error label Jul 10, 2023
@ofborg ofborg bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Jul 10, 2023
@AndersonTorres
Copy link
Member Author

@RaitoBezarius @figsoda ping (because you both gave the initial ideas).

@IogaMaster
Copy link
Contributor

@AndersonTorres how would use this in #241741?

@AndersonTorres
Copy link
Member Author

AndersonTorres commented Jul 11, 2023

Seriously speaking, these hooks are very independent and self-contained, obviating the buildZigPackage framework.

On the other hand, it is too dependent on Bash.
Not a problem, given that Bash is the plumbing of Nixpkgs.

Copy link
Member

@figsoda figsoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as previously suggested, we should include the conversion of some packages (1 or 2 is fine), and documentation

Comment on lines 31 to 33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be able to do something like this

Suggested change
echo "zig build flags: $zigBuildFlags ${zigBuildFlagsArray[@]}"
zig build $zigBuildFlags "${zigBuildFlagsArray[@]}"
(set -x; zig build $zigBuildFlags "${zigBuildFlagsArray[@]}")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you switched to echoCmd, did this approach not work?

Copy link
Member Author

@AndersonTorres AndersonTorres Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it worked, however I preferred the traditional approach, because it escapes the quotes and whitespaces

@AndersonTorres
Copy link
Member Author

as previously suggested, we should include the conversion of some packages (1 or 2 is fine), and documentation

Conversion is here:

#242565

@IogaMaster
Copy link
Contributor

IogaMaster commented Jul 14, 2023

Seriously speaking, these hooks are very independent and self-contained, obviating the buildZigPackage framework.

I will close my pr if merged

@RaitoBezarius
Copy link
Member

RaitoBezarius commented Jul 14, 2023

Seriously speaking, these hooks are very independent and self-contained, obviating the buildZigPackage framework.

I will close my pr if merged

I'm sorry you went through that effort, I think we should write documentation when people want to build new in-tree builders like those to give them proper direction on the good way to do it.

@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Jul 15, 2023
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jul 15, 2023
@AndersonTorres AndersonTorres changed the title Zig: setup hook zigHook: init Jul 15, 2023
@AndersonTorres
Copy link
Member Author

@figsoda any hints about the documentation and its new format?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewrk is there any rationale for this, specifically? Some flags use the format --x=y but others insist on --x y.

Copy link
Member

@figsoda figsoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm, there are still some design decisions I'm unsure about, but I don't have a strong opinion on any of them

@AndersonTorres
Copy link
Member Author

Another round and it will be ready to merge.

@AndersonTorres
Copy link
Member Author

Let's wait arm darwin, then.

@AndersonTorres
Copy link
Member Author

One full day? I will not wait, sorry.

A setup hook for using the Zig compiler in Nixpkgs.

*Warning*: the setup-hook shell script was linted with shellcheck!
Because zig itself doesn't set it by default.
A somewhat short documentation about zigHook.
@AndersonTorres AndersonTorres merged commit 130d2fa into NixOS:master Aug 1, 2023
@figsoda figsoda added the 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants