We just merged meson: enable auto_features by default by jtojnar · Pull Request #63493 · NixOS/nixpkgs · GitHub to staging
.
That means we are now passing -Dauto_features=enabled
to Meson, which forcefully enables all project features that are auto-detected by default. Previously we forcefully disabled them, which lead to confusion when a packager added dependencies required by a feature but the project still built without the feature.
You can disable the features you do not want by adding mesonFlags = [ "-Dfeature_name=disabled" ];
to the package expression. The names of features are listed in the meson_options.txt
file in the root of the project. Alternately, you can also add mesonAutoFeatures = "disabled";
to the expression to revert to the previous behaviour.
See also Meson documentation of features
2 Likes
@jtojnar is -Dauto_features=enabled
really what we want? mechanically, it’s equivalent to taking every feature a project declared as “auto” and rewriting it as “enabled”. projects use “auto” to represent optional features or dependencies, but -Dauto_features=enabled
has the effect that failing to provide some optional dependency causes the builder to error instead of building the project without that optional feature.
i can imagine some reasons why this might really be desired, but it’s also a divergence from the behavior of configure
/autotools-based packages where one can tweak the feature set by just adding/removing packages to buildInputs
. for example i ran into this with wireplumber: the nixpkgs expression builds with systemd integration by default: ordinarily i could disable that with just wireplumber.override { systemd = null; }
(or remove systemd from buildInputs) and meson would quietly build without the systemd feature, but because of -Dauto_features=enabled
, the expression to build without systemd is a bit more complicated (too complicated for the nixpkgs maintainer to want to expose).
is this what we want?
1 Like
Yes, the consensus was that we want this. The auto_features
option was introduced for this purpose, and this is also what other distros do (e.g. Arch, Fedora).
I would consider little Autotools does worth following. In this case, we have time and time again seen software losing a feature after an update because dependency requirements for the feature changed (e.g. it suddenly needed a newer version that was not yet packaged). That is pretty easy to overlook and forcing auto_features=enabled
prevents this.
In my understanding, the auto
value is for optional but strongly recommended features, and it is mostly meant for upstream development, to allow contributors building the project without the nuisance of needing to install every possible dependency or passing a ton of disable flags. As a distro, we prefer reliability, and can afford the hassle of having to explicitly disable dependencies we do not want.
4 Likes