From 4a6045a41b9caff2028a7d37a8d51e25f1aa45f8 Mon Sep 17 00:00:00 2001 From: Tony Zorman Date: Mon, 20 Nov 2023 08:19:40 +0100 Subject: [PATCH] emacs: Use lib.withFeature As discussed in [1], this improves readability. Not all --with options have a corresponding --without (and vice-versa), but Emacs's configure script can endure this. Additionally, this "encodes" the default options in system-configuration-options. [1]: https://github.com/NixOS/nixpkgs/pull/267946#issuecomment-1815394037 --- .../applications/editors/emacs/make-emacs.nix | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 5625dfbb3aa9..c48550f8680a 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -329,15 +329,16 @@ mkDerivation (finalAttrs: { "--with-xml2=yes" ] ++ (lib.optional stdenv.isDarwin (lib.withFeature withNS "ns")) - ++ lib.optional (!withToolkitScrollBars) "--without-toolkit-scroll-bars" - ++ lib.optional withNativeCompilation "--with-native-compilation" - ++ lib.optional withImageMagick "--with-imagemagick" - ++ lib.optional withTreeSitter "--with-tree-sitter" - ++ lib.optional withXinput2 "--with-xinput2" - ++ lib.optional withXwidgets "--with-xwidgets" - ++ lib.optional withSmallJaDic "--with-small-ja-dic" - ++ lib.optional (!withCompressInstall) "--without-compress-install" - ; + ++ [ + (lib.withFeature withCompressInstall "compress-install") + (lib.withFeature withToolkitScrollBars "toolkit-scroll-bars") + (lib.withFeature withNativeCompilation "native-compilation") + (lib.withFeature withImageMagick "imagemagick") + (lib.withFeature withSmallJaDic "small-ja-dic") + (lib.withFeature withTreeSitter "tree-sitter") + (lib.withFeature withXinput2 "xinput2") + (lib.withFeature withXwidgets "xwidgets") + ]; env = lib.optionalAttrs withNativeCompilation { NATIVE_FULL_AOT = "1";