diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/lvm2/common.nix')
-rw-r--r-- | nixpkgs/pkgs/os-specific/linux/lvm2/common.nix | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/lvm2/common.nix b/nixpkgs/pkgs/os-specific/linux/lvm2/common.nix index 4cb86bf3d8b9..27a160033b11 100644 --- a/nixpkgs/pkgs/os-specific/linux/lvm2/common.nix +++ b/nixpkgs/pkgs/os-specific/linux/lvm2/common.nix @@ -1,7 +1,6 @@ -{ version, sha256 }: +{ version, hash }: { lib, stdenv -, fetchpatch , fetchurl , pkg-config , coreutils @@ -28,8 +27,11 @@ stdenv.mkDerivation rec { inherit version; src = fetchurl { - url = "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${version}.tgz"; - inherit sha256; + urls = [ + "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${version}.tgz" + "ftp://sourceware.org/pub/lvm2/LVM2.${version}.tgz" + ]; + inherit hash; }; nativeBuildInputs = [ pkg-config ]; @@ -49,10 +51,12 @@ stdenv.mkDerivation rec { "--with-default-locking-dir=/run/lock/lvm" "--with-default-run-dir=/run/lvm" "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + "--with-systemd-run=/run/current-system/systemd/bin/systemd-run" ] ++ lib.optionals (!enableCmdlib) [ "--bindir=${placeholder "bin"}/bin" "--sbindir=${placeholder "bin"}/bin" "--libdir=${placeholder "lib"}/lib" + "--with-libexecdir=${placeholder "lib"}/libexec" ] ++ lib.optional enableCmdlib "--enable-cmdlib" ++ lib.optionals enableDmeventd [ "--enable-dmeventd" @@ -64,28 +68,17 @@ stdenv.mkDerivation rec { ] ++ lib.optionals udevSupport [ "--enable-udev_rules" "--enable-udev_sync" + ] ++ lib.optionals enableVDO [ + "--enable-vdo" ] ++ lib.optionals stdenv.hostPlatform.isStatic [ "--enable-static_link" - ] ++ lib.optionals enableVDO [ - "--enable-vdo" ]; preConfigure = '' sed -i /DEFAULT_SYS_DIR/d Makefile.in sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in - '' + lib.optionalString (lib.versionOlder version "2.03.15") '' - substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \ - --replace /usr/bin/udevadm /run/current-system/systemd/bin/udevadm - # https://github.com/lvmteam/lvm2/issues/36 - '' + lib.optionalString (lib.versionOlder version "2.03.14") '' - substituteInPlace udev/69-dm-lvm-metad.rules.in \ - --replace "(BINDIR)/systemd-run" /run/current-system/systemd/bin/systemd-run - '' + lib.optionalString (lib.versionAtLeast version "2.03.14") '' - substituteInPlace udev/69-dm-lvm.rules.in \ - --replace "/usr/bin/systemd-run" /run/current-system/systemd/bin/systemd-run - '' + '' + substituteInPlace make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system" - '' + lib.optionalString (lib.versionAtLeast version "2.03") '' substituteInPlace libdm/make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system" substituteInPlace scripts/blk_availability_systemd_red_hat.service.in \ @@ -96,9 +89,8 @@ stdenv.mkDerivation rec { sed -i 's|^#define LVM_CONFIGURE_LINE.*$|#define LVM_CONFIGURE_LINE "<removed>"|g' ./include/configure.h ''; - patches = lib.optionals (lib.versionAtLeast version "2.03.15") [ + patches = [ # fixes paths to and checks for tools - # TODO: needs backport to LVM 2.02 used by static/musl (substituteAll (let optionalTool = cond: pkg: if cond then pkg else "/run/current-system/sw"; in { @@ -109,22 +101,16 @@ stdenv.mkDerivation rec { multipath_tools = optionalTool enableMultipath multipath-tools; vdo = optionalTool enableVDO vdo; })) - ] ++ lib.optionals (lib.versionOlder version "2.03.15") [ - # Musl fixes from Alpine. + # Musl fix from Alpine ./fix-stdio-usage.patch - (fetchpatch { - name = "mallinfo.patch"; - url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50"; - sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0"; - }) ] ++ lib.optionals stdenv.hostPlatform.isStatic [ - ./no-shared.diff + ./no-shared.patch ]; doCheck = false; # requires root makeFlags = lib.optionals udevSupport [ - "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators" + "SYSTEMD_GENERATOR_DIR=${placeholder "out"}/lib/systemd/system-generators" ] ++ lib.optionals onlyLib [ "libdm.device-mapper" ]; @@ -160,7 +146,10 @@ stdenv.mkDerivation rec { moveToOutput lib/libdevmapper.so $lib ''; - passthru.tests.installer = nixosTests.installer.lvm; + passthru.tests = { + installer = nixosTests.installer.lvm; + lvm2 = nixosTests.lvm2; + }; meta = with lib; { homepage = "http://sourceware.org/lvm2/"; |