nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

python3Packages.btrfsutil: build separately from btrfs-progs

btrfs-progs was installing its Python bindings as an egg, which doesn't work
with Nix. It turns out that there is no real benefit to building the Python
bindings as part of the btrfs-progs package. Instead, we can just package them
separately, and use nixpkgs' normal Python packaging support to install them as
a wheel. This fixes the bindings and reduces closure sizes.

+33 -11
+26
pkgs/development/python-modules/btrfsutil/default.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , btrfs-progs 4 + }: 5 + buildPythonPackage { 6 + pname = "btrfsutil"; 7 + inherit (btrfs-progs) version src; 8 + format = "setuptools"; 9 + 10 + buildInputs = [ btrfs-progs ]; 11 + 12 + preConfigure = '' 13 + cd libbtrfsutil/python 14 + ''; 15 + 16 + # No tests 17 + doCheck = false; 18 + pythonImportsCheck = [ "btrfsutil" ]; 19 + 20 + meta = with lib; { 21 + description = "Library for managing Btrfs filesystems"; 22 + homepage = "https://btrfs.wiki.kernel.org/"; 23 + license = licenses.lgpl21Plus; 24 + maintainers = with maintainers; [ raskin lopsided98 ]; 25 + }; 26 + }
+6 -10
pkgs/tools/filesystems/btrfs-progs/default.nix
··· 1 1 { lib, stdenv, fetchurl 2 - , pkg-config, python3, sphinx 2 + , pkg-config, sphinx 3 3 , zstd 4 4 , acl, attr, e2fsprogs, libuuid, lzo, udev, zlib 5 5 , runCommand, btrfs-progs 6 6 , gitUpdater 7 7 , udevSupport ? true 8 - , enablePython ? true 9 8 }: 10 9 11 10 stdenv.mkDerivation rec { ··· 18 19 19 20 nativeBuildInputs = [ 20 21 pkg-config 21 - ] ++ lib.optionals enablePython [ 22 - python3 python3.pkgs.setuptools 23 22 ] ++ [ 24 23 sphinx 25 24 ]; 26 25 27 - buildInputs = [ acl attr e2fsprogs libuuid lzo python3 udev zlib zstd ]; 26 + buildInputs = [ acl attr e2fsprogs libuuid lzo udev zlib zstd ]; 28 27 29 28 # gcc bug with -O1 on ARM with gcc 4.8 30 29 # This should be fine on all platforms so apply universally ··· 32 35 install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs 33 36 ''; 34 37 35 - configureFlags = lib.optionals stdenv.hostPlatform.isMusl [ 36 - "--disable-backtrace" 37 - ] ++ lib.optionals (!enablePython) [ 38 + configureFlags = [ 39 + # Built separately, see python3Packages.btrfsutil 38 40 "--disable-python" 41 + ] ++ lib.optionals stdenv.hostPlatform.isMusl [ 42 + "--disable-backtrace" 39 43 ] ++ lib.optionals (!udevSupport) [ 40 44 "--disable-libudev" 41 45 ]; 42 46 43 47 makeFlags = [ "udevruledir=$(out)/lib/udev/rules.d" ]; 44 - 45 - installFlags = lib.optionals enablePython [ "install_python" ]; 46 48 47 49 enableParallelBuilding = true; 48 50
+1 -1
pkgs/top-level/python-packages.nix
··· 1430 1430 1431 1431 btrfs = callPackage ../development/python-modules/btrfs { }; 1432 1432 1433 - btrfsutil = toPythonModule (pkgs.btrfs-progs.override { python3 = self.python; }); 1433 + btrfsutil = callPackage ../development/python-modules/btrfsutil { }; 1434 1434 1435 1435 btsocket = callPackage ../development/python-modules/btsocket { }; 1436 1436