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
Draft
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9714f41
Use Meson to build Nix
AndersonTorres Aug 25, 2022
85759af
Modify feature attribute
AndersonTorres Aug 26, 2022
003393e
Small clarification
AndersonTorres Aug 26, 2022
3e0be88
Reformulates the alternatives section
AndersonTorres Aug 26, 2022
d4497fd
Answer new drawback
AndersonTorres Aug 26, 2022
18c732d
Typo
AndersonTorres Aug 26, 2022
a843fb1
Rewording
AndersonTorres Aug 26, 2022
0bf382d
Unfill the paragraphs
AndersonTorres Aug 26, 2022
6c3f5d2
Rename RFC file
AndersonTorres Aug 26, 2022
bd4bfe9
Small punctuation fixes
AndersonTorres Aug 27, 2022
e1a0620
Rewording
AndersonTorres Aug 27, 2022
0060937
Add usage example
AndersonTorres Aug 27, 2022
265020c
Add references
AndersonTorres Aug 27, 2022
b7b859b
Improvements on the wording
AndersonTorres Aug 27, 2022
3eea629
Reword the reference to Nix
AndersonTorres Aug 31, 2022
8650a36
Typo
AndersonTorres Aug 31, 2022
ab2dec1
Typo
AndersonTorres Aug 31, 2022
6980048
Reword a paragraph
AndersonTorres Aug 31, 2022
b58c8b6
Reword the detailed design
AndersonTorres Aug 31, 2022
17069b6
Reword the examples
AndersonTorres Aug 31, 2022
9821ad2
Add a paragraph about the current (quasi-) autotools
AndersonTorres Aug 31, 2022
ab42c2f
Reword commentary about transition
AndersonTorres Aug 31, 2022
3111e49
Reword alternatives
AndersonTorres Aug 31, 2022
9d89692
Reword commentary about Cmake
AndersonTorres Aug 31, 2022
dca9276
Remove commentary about backport
AndersonTorres Aug 31, 2022
38f3c44
Bring more items to future work
AndersonTorres Aug 31, 2022
714457b
Add references
AndersonTorres Aug 31, 2022
894946b
Reorder references
AndersonTorres Sep 1, 2022
72dec20
Reword motivation section
AndersonTorres Sep 1, 2022
6d8f6bd
Reword paragraph
AndersonTorres Sep 1, 2022
94eb5c7
Rework examples and interactions
AndersonTorres Sep 1, 2022
934555d
Rework drawbacks
AndersonTorres Sep 1, 2022
16e2033
Rework alternatives
AndersonTorres Sep 1, 2022
8dadf6a
Some fixups
AndersonTorres Sep 5, 2022
587d349
Include some more examples of build systems
AndersonTorres Sep 9, 2022
86bc4bc
Reorder references
AndersonTorres Sep 9, 2022
9ad0874
Reword cmake subsection
AndersonTorres Sep 9, 2022
5e621af
Move paragraphs about Meson and Ninja to detailed design section
AndersonTorres Sep 9, 2022
3de1372
Remove unneeded paragraph
AndersonTorres Sep 10, 2022
c5a9e48
Include Bazel as alternative
AndersonTorres Sep 10, 2022
3f1182c
Reword paragraph
AndersonTorres Sep 10, 2022
e361407
Punctuation
AndersonTorres Sep 10, 2022
a228c6f
More references
AndersonTorres Sep 10, 2022
aef0827
Reword
AndersonTorres Sep 11, 2022
212bf63
Typo
AndersonTorres Sep 11, 2022
4df4944
Reword
AndersonTorres Sep 11, 2022
0a41323
A bit more about Bazel
AndersonTorres Sep 11, 2022
e071944
add feature: out-of-source build
AndersonTorres Oct 6, 2022
d8904e9
Typos, typos and more typos
AndersonTorres Nov 11, 2022
680e6b8
Link to the now free-as-in-beer book from the creator of Meson
AndersonTorres Nov 11, 2022
0430b71
Another typo
AndersonTorres Nov 11, 2022
61ad7c4
Add shepherds
edolstra Nov 17, 2022
afca581
add cross-compilation support to the criteria of evaluation of altern…
AndersonTorres Aug 12, 2023
9bb63e0
Typo
AndersonTorres Feb 25, 2024
e6b4e05
Reword examples
AndersonTorres Feb 25, 2024
719562c
Add some more advantages for Bazel
AndersonTorres Feb 25, 2024
e4715c4
Reword and add more disadvantages for Bazel
AndersonTorres Feb 25, 2024
f37cedd
More references
AndersonTorres Feb 25, 2024
5b0a734
Reword Google company name
AndersonTorres Feb 25, 2024
56c86fa
Add Prior Art section
AndersonTorres Feb 25, 2024
b03e5b6
Rewords and comparisons
AndersonTorres Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions rfcs/0132-use-meson-to-build-nix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
feature: use_meson_to_build_nix
start-date: 2022-08-25
author: Anderson Torres
co-authors: @p01arst0rm
shepherd-team:
shepherd-leader:
related-issues:
---

# Summary
[summary]: #summary

Use meson as an alternative build system for the reference implementation of
Nix.

# Motivation
[motivation]: #motivation

Currently, the reference implementation of Nix evaluator and its companion
toolset generated from the Nix source tree are built using an autotools-like
script.
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved

This quasi-autotools script became clunky and plastered, and consequently hard
to understand, modify, improve and port to other systems besides Linux.
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved

Such state of things hinders development, specially outside the Linux and NixOS
niches.

In light of this, we propose a novel, from-scratch alternative build
infrastructure.

We expect to accomplish, among other goals,

- better code structuring
- improved cross-platform support, especially in other programming environments,
including but not limited to Unix-like operating systems;
- shorter build times;
- an overall improved user experience.

# Detailed design
[design]: #detailed-design

A carefully crafted set of files written in Meson should be included in the Nix
repository, in order to describe how to deploy the Nix repository, generating
all the expected artifacts (command line tools, libraries, configuration files
etc.)

This novel build infrastructure should be able to provide at least all the
features already present on the current quasi-autotools implementation, possibly
with a different user interface.

# Examples and Interactions
[examples-and-interactions]: #examples-and-interactions

Currently @p01arst0rm is writing an implementation from scratch.

# Drawbacks
[drawbacks]: #drawbacks

Some possible drawbacks:

- A new build system would require changes on the code
+ On the other hand, such changes are likely to improve the code base.

- A new build system requires the developers become familiarized with it
- Specially when this build system uses its own description language
+ However, the Meson language is easy to grasp, specially for those
familiarized with Python, besides being well documented.

- A new build system indirectly brings its own dependencies to the Nix project
- In particular, the reference implementation of Meson is written in Python.
- Further, this reference implementation generates script files meant to be
consumed by Ninja, a tool written in C++ that acts like a Make replacement.
- 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.

- A new build system would require new strategies from the end users
- In particular, package managers that deploy Nix for their respective
platforms
+ However, Meson is nowadays a widespread tool, used in many open source
projects ranging from DOSBox Staging and mpv to GNOME and Xorg; therefore it
is already included in many package managers' databases

# Alternatives
[alternatives]: #alternatives

The alternatives are

- Doing nothing

It would keep the current code confusing and harder to work with.

- Other building systems (cmake, waf, scons etc.)
- Their strenghts and weaknesses should be evaluated.
- Tools like waf and scons are strongly discouraged, because they are tied
to other programming languages, bringing the bootstrap concerns already
discussed above.

AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved
# Unresolved questions
[unresolved]: #unresolved-questions

Questions that deserve furtehr inquiry:
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved

- Unexpected interactions with Meson and Ninja
- Specially, vendoring and reproducibility.
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved
- Smooth the transition between the old and new build systems
- A wrapper script, maybe?
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved

# Future work
[future]: #future-work

- Deprecate the quasi-autotools script set
- Backport the new build system to Nix 2.3
- It was the latest release without Flakes support; it is important to
bring such a deep modification to it.