Skip to content
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

[RFC 0132] Meson Builds Nix #132

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from

Conversation

AndersonTorres
Copy link
Member

@AndersonTorres AndersonTorres commented Aug 25, 2022

This RFC proposes to use Meson description files to deploy Nix.

Rendered!

@Ericson2314
Copy link
Member

I would like to shepherd this. I would also recommend @edolstra and @thufschmitt.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/brainstorming-for-rfc-using-meson-to-build-nix-evaluator/21141/8

@AndersonTorres AndersonTorres changed the title Use Meson to build Nix [RFC 0132] Meson Builds Nix Aug 27, 2022
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
@p01arst0rm
Copy link

@AndersonTorres should add that the end goal is to have a nix be capable of building nix too? or is that out of the scope of the RFC

@AndersonTorres
Copy link
Member Author

@AndersonTorres should add that the end goal is to have a nix be capable of building nix too? or is that out of the scope of the RFC

Self-hosting Nix is something that deserves its own soutenance de thèse. I will not pursue it here.

The references on "minimal bloat on the bootstrap route" are enough for now.


Over time, this build system has been modified to keep up with the development needs of Nix projec. However, it has reached a state where the build system became clunky and plastered, hard to understand and modify, consequently making improvements to the project as a whole very difficult.

In particular, many changes have been introduced that impact compatibility outside Linux and NixOS niches. These issues can hinder development on other platforms, including but not limited to Unix-like systems.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide examples to changes that affect compatibility? Are there issues you can link?

Choose a reason for hiding this comment

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

@asymmetric bunch of stuff; some of the issues were to do with hardcoded library dependencies that are set up differently on *BSD, the wrong versions of some headers were included on BSD (sometimes headers have names that differ). there were also issues with locating external components iirc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but I was suggesting these issues could be mentioned in the RFC itself, possibly with references!

Choose a reason for hiding this comment

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

thats a fair point, but more detailed info of these issues would require someone to attempt building nix on multiple different platforms, and take notes. not saying its a bad idea/shouldnt be done but it would take some time

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @asymmetric, this needs some concrete examples for the point to really stand

Choose a reason for hiding this comment

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

NixOS/nix#6991 << example :)

Choose a reason for hiding this comment

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

Yes, and that PR has a very illuminating comment from me:

The first commit is just #5145 and again #6015

Previous efforts that actually used a different tactic include:
#5185
#6005

Issues include:
#5140
#5184
#5781

This issue has been separately discovered by a variety of people building nix for use as a packager manager but not as an OS. Meson would solve the problem for free, as part of providing functionality that Make doesn't have and is apparently needed.

rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
- This particular setting brings concerns about complexifying the bootstrap route.
+ Given that Nix is currently written in C++, we can assume a C++ compiler as part of such a bootstrap route.
+ There are full-featured alternative tools that replace Meson and Ninja.
+ Namely, Muon and Samurai are implementations of Meson and Ninja that require only a C compiler and a set of POSIX standard tools.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would definitely keep this drawback in mind and explore alternatives that don't expand the bootstrap closure.

Maybe you could also mention what the current bootstrap closure is?

Choose a reason for hiding this comment

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

@asymmetric please read the prior PR to read discussions; meson does not increase bootstrap dependencies, it dramatically decreases them. available tools are provided that only require a working c compiler; c --> muon --> samurai --> nix. the benefit & end goal of this is removing gnu userland tools as a requirement of building, dramatically decreasing the amount of tools needed for bootstrapping.

Copy link
Contributor

Choose a reason for hiding this comment

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

please read the prior PR to read discussions

You mean NixOS/nix#3160?

meson does not increase bootstrap dependencies

Didn't you say in the RFC that Meson is in Python? What I wanted to say with my comment is to emphasize the idea that we shouldn't increase the bootstrap closure, and so I approve that you mentioned it and provided alternatives that don't increase it.

But AFAIU Python is not part of the current Nix bootstrap closure, so if we use straight Meson, rather than muon and/or Ninja, we would indeed increase it. Is that correct?

If that's the case, why wouldn't we choose muon directly?

Choose a reason for hiding this comment

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

Who said that muon isn't "directly" chosen?

Maybe the confusion here is that the RFC is to use "Meson" the buildsystem description DSL, but not specifically to bootstrap Nix with "Meson" the reference implementation of "Meson".

What's the goal of this review comment? To rename this RFC to

[RFC 0132] Muon Builds Nix

???

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the confusion here is that the RFC is to use "Meson" the buildsystem description DSL, but not specifically to bootstrap Nix with "Meson" the reference implementation of "Meson".

That was indeed the thing that confused me

Choose a reason for hiding this comment

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

maybe we need a line in the RFC that says "meson the dsl language != meson.py the tool"

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe you could also mention what the current bootstrap closure is?

As far as I know, M4 (the somewhat obscure macro language) and Bash, and whatever autoconf brings.

Copy link

@p01arst0rm p01arst0rm Aug 31, 2022

Choose a reason for hiding this comment

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

some required build programs include

  • flex
  • bison
  • sed
  • tar
  • dot
  • jq
  • bash
  • tar
  • patch
  • gcc (last time i attempted, clang compilation is very sketch)
  • autotools
  • m4

rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
rfcs/0132-meson-builds-nix.md Outdated Show resolved Hide resolved
It is unneeded to make a distinction between Nix language and its
implementation.
projec -> project
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-03-05/40851/1

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-03-19/41829/1

@p01arst0rm
Copy link

@infinisil

Can we get a summary of the state of this RFC? Reminder that RFCs can also go into FCP without fully figuring out all details and committing to Meson in this case.

I believe the things are summarized here:

#132 (comment)

In my humble opinion, this RFC looks ready for FCP. However, two things:

1. I am not the programmer guy, I am merely the public defender. The more technical and practical issues are handled by @p01arst0rm ;

2. The FCP status is solely decided by the shepherd team; they have the last word.

currently working on adding support to build nix-perl, waiting for assistance from @Ericson2314

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-04-02/42643/1

@Ericson2314
Copy link
Member

NixOS/nix#10378 we should use this small PR to decide what we want to do.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-04-16/43512/1

@Ericson2314
Copy link
Member

We finally have some progress! NixOS/nix#10378 is merged -- Nix's Perl bindings are now built with Meson.

This is far from a complete port --- in particular, the most exciting feature Meson provides to me, subprojects, is not yet in use since we have only one single project so far. However, I hope it is sufficient to demonstrate to the Nix team what the overall costs/benefits of Meson are in practice. With that information, I hope we will be able to make a final decision on this RFC.

@GetPsyched
Copy link
Member

Considering that the first step towards this has now been merged, it sounds like this is on a good path. Could the shepherds consider going into FCP?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-05-14/45414/1

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-05-28/46113/1

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-06-10/46817/1

@MMesch
Copy link

MMesch commented Jun 24, 2024

RFCSC: Since there's no progress, we'll mark this as a draft. Feel free to undraft at any time when you're continuing with it.

@MMesch MMesch marked this pull request as draft June 24, 2024 15:23
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rfcsc-meeting-2024-06-24/47589/1

@srd424
Copy link

srd424 commented Jun 24, 2024

I thought I'd seen a fair few meson related commits and merges recently - am I misunderstanding something? Or is that work happening separately to this RFC?

@p01arst0rm
Copy link

I thought I'd seen a fair few meson related commits and merges recently - am I misunderstanding something? Or is that work happening separately to this RFC?

they definitely are related :) im not sure entirely how the RFC process works, im just part of the team.

@AndersonTorres
Copy link
Member Author

Calling the shepherds @Ericson2314 @edolstra @thufschmitt

@Ericson2314
Copy link
Member

Ericson2314 commented Jun 25, 2024

We just sort of kept on discussing it in Nix team meetings, which includes all shepherds. It's agreed upon and its happening so I think we can accept this. :)

The remaining milestone is finishing the conversion and then removing the old build system, the latter of which signifies we are committed.

@AndersonTorres
Copy link
Member Author

@Ericson2314

As I have said before, I am merely the public relations guy here, I will not deal with code (at least not now).
How can the interested coders that appeared on the thread contribute?

@thufschmitt
Copy link
Member

Due to $stuff I will have to recuse myself from shepherding that RFC. Do hope it will get merged though!

Good luck to the authors and shepherds

@asymmetric
Copy link
Contributor

asymmetric commented Sep 18, 2024

AFAIU this was implemented in 2.24, so can this PR be closed?

@AndersonTorres
Copy link
Member Author

I don't know why this was not merged or closed.

@Ericson2314
Copy link
Member

NixOS/nix#11804 Guess we're done here? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.