From 28b3398d7320486ed6881ea88193fdad661d54e3 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 13 Aug 2022 15:25:11 -0700 Subject: [PATCH] btrfs-progs: allow to build without python bindings Python cross-compilation is quite difficult, and doesn't work in several situations, such as: https://github.com/NixOS/nixpkgs/issues/186525 Let's give people the option of cross-compiling `btrfs-progs` to hostPlatforms for which we cannot cross-compile python. Unfortunately btrfs-progs insists on a special configure flag `--disable-python`; simply being unable to find python isn't enough. --- pkgs/tools/filesystems/btrfs-progs/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/filesystems/btrfs-progs/default.nix b/pkgs/tools/filesystems/btrfs-progs/default.nix index 09c1f4475420ce0..4dcf1a7a56ce536 100644 --- a/pkgs/tools/filesystems/btrfs-progs/default.nix +++ b/pkgs/tools/filesystems/btrfs-progs/default.nix @@ -5,6 +5,7 @@ , runCommand, btrfs-progs , gitUpdater , udevSupport ? true +, enablePython ? true }: stdenv.mkDerivation rec { @@ -18,7 +19,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config + ] ++ lib.optionals enablePython [ python3 python3.pkgs.setuptools + ] ++ [ sphinx ]; @@ -32,12 +35,17 @@ stdenv.mkDerivation rec { install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs ''; - configureFlags = lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace" - ++ lib.optional (!udevSupport) "--disable-libudev"; + configureFlags = lib.optionals stdenv.hostPlatform.isMusl [ + "--disable-backtrace" + ] ++ lib.optionals (!enablePython) [ + "--disable-python" + ] ++ lib.optionals (!udevSupport) [ + "--disable-libudev" + ]; makeFlags = [ "udevruledir=$(out)/lib/udev/rules.d" ]; - installFlags = [ "install_python" ]; + installFlags = lib.optionals enablePython [ "install_python" ]; enableParallelBuilding = true;