about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/filesystems/nixpart/0.4
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/filesystems/nixpart/0.4')
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix50
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch51
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix38
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix77
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix26
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix76
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix53
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix59
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch12
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix36
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix30
-rw-r--r--nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix42
12 files changed, 550 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix
new file mode 100644
index 000000000000..6ba29cb98d40
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.nix
@@ -0,0 +1,50 @@
+# FIXME: Unify with pkgs/development/python-modules/blivet/default.nix.
+
+{ stdenv, fetchurl, buildPythonApplication, pykickstart, pyparted, pyblock
+, libselinux, cryptsetup, multipath_tools, lsof, utillinux
+, useNixUdev ? true, systemd ? null
+# useNixUdev is here for bw compatibility
+}:
+
+assert useNixUdev -> systemd != null;
+
+buildPythonApplication rec {
+  pname = "blivet";
+  version = "0.17-1";
+
+  src = fetchurl {
+    url = "https://git.fedorahosted.org/cgit/blivet.git/snapshot/"
+        + "${pname}-${version}.tar.bz2";
+    sha256 = "1k3mws2q0ryb7422mml6idmaasz2i2v6ngyvg6d976dx090qnmci";
+  };
+
+  patches = [ ./blivet.patch ];
+
+  postPatch = ''
+    sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \
+      blivet/devicelibs/mpath.py blivet/devices.py
+    sed -i -e '/"wipefs"/ {
+      s|wipefs|${utillinux.bin}/sbin/wipefs|
+      s/-f/--force/
+    }' blivet/formats/__init__.py
+    sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py
+    sed -i -r -e 's|"(u?mount)"|"${utillinux.bin}/bin/\1"|' blivet/util.py
+    sed -i -e '/find_library/,/find_library/ {
+      c libudev = "${stdenv.lib.getLib systemd}/lib/libudev.so.1"
+    }' blivet/pyudev.py
+  '';
+
+  propagatedBuildInputs = [
+    pykickstart pyparted pyblock libselinux cryptsetup
+  ] ++ stdenv.lib.optional useNixUdev systemd;
+
+  # tests are currently _heavily_ broken upstream
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = "https://fedoraproject.org/wiki/Blivet";
+    description = "Module for management of a system's storage configuration";
+    license = with licenses; [ gpl2Plus lgpl21Plus ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch
new file mode 100644
index 000000000000..d53231a84fd6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch
@@ -0,0 +1,51 @@
+diff --git a/blivet/pyudev.py b/blivet/pyudev.py
+index 705b93d..7268d71 100644
+--- a/blivet/pyudev.py
++++ b/blivet/pyudev.py
+@@ -7,9 +7,9 @@ from ctypes import *
+ 
+ 
+ # XXX this one may need some tweaking...
+-def find_library(name, somajor=0):
++def find_library(name):
+     env = os.environ.get("LD_LIBRARY_PATH")
+-    common = ["/lib64", "/lib"]
++    common = ["/lib64", "/lib", "/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]
+ 
+     if env:
+         libdirs = env.split(":") + common
+@@ -19,7 +19,7 @@ def find_library(name, somajor=0):
+     libdirs = filter(os.path.isdir, libdirs)
+ 
+     for dir in libdirs:
+-        files = fnmatch.filter(os.listdir(dir), "lib%s.so.%d" % (name, somajor))
++        files = fnmatch.filter(os.listdir(dir), "lib%s.so.*" % name)
+         files = [os.path.join(dir, file) for file in files]
+ 
+         if files:
+@@ -32,11 +32,10 @@ def find_library(name, somajor=0):
+ 
+ # find the udev library
+ name = "udev"
+-somajor = 1
+-libudev = find_library(name=name, somajor=somajor)
++libudev = find_library(name)
+ 
+ if not libudev or not os.path.exists(libudev):
+-    raise ImportError, "No library named %s.%d" % (name, somajor)
++    raise ImportError, "No library named lib%s.so" % name
+ 
+ # load the udev library
+ libudev = CDLL(libudev)
+diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
+index 705b93d..60f8f32 100644
+--- a/blivet/deviceaction.py
++++ b/blivet/deviceaction.py
+@@ -467,6 +467,7 @@ def execute(self):
+ 
+                 self.device.disk.format.commitToDisk()
+ 
++            self.device.setup()
+             self.device.format.create(device=self.device.path,
+                                       options=self.device.formatArgs)
+ 
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix
new file mode 100644
index 000000000000..88a1716a0e1e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, fetchpatch, lvm2, libgcrypt, libuuid, pkgconfig, popt
+, enablePython ? true, python ? null
+}:
+
+assert enablePython -> python != null;
+
+stdenv.mkDerivation rec {
+  name = "cryptsetup-1.6.3";
+
+  src = fetchurl {
+    url = "http://cryptsetup.googlecode.com/files/${name}.tar.bz2";
+    sha256 = "1n1qk5chyjspbiianrdb55fhb4wl0vfyqz2br05vfb24v4qlgbx2";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryptsetup/files/cryptsetup-1.7.1-sysmacros.patch?id=d72316f97ebcc7fe622b21574442a9ac59b9115f";
+      sha256 = "0xbhazgl44bimqhcrhajk016w9wi7bkrgwyfq13xmrvyrllqvgdx";
+    })
+  ];
+
+  configureFlags = [ "--enable-cryptsetup-reencrypt" ]
+                ++ stdenv.lib.optional enablePython "--enable-python";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ lvm2 libgcrypt libuuid popt ]
+             ++ stdenv.lib.optional enablePython python;
+
+  meta = {
+    homepage = "http://code.google.com/p/cryptsetup/";
+    description = "LUKS for dm-crypt";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix
new file mode 100644
index 000000000000..1f672701d382
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/default.nix
@@ -0,0 +1,77 @@
+{ stdenv, fetchurl, python, buildPythonApplication
+, libselinux
+# Propagated to blivet
+, useNixUdev ? true
+# Needed by NixOps
+, udevSoMajor ? null
+# Propagated dependencies
+, pkgs, urlgrabber
+}:
+
+let
+  blivet = import ./blivet.nix {
+    inherit stdenv fetchurl buildPythonApplication;
+    inherit pykickstart pyparted pyblock cryptsetup libselinux multipath_tools;
+    inherit useNixUdev;
+    inherit (pkgs) lsof utillinux systemd;
+  };
+
+  cryptsetup = import ./cryptsetup.nix {
+    inherit stdenv fetchurl python;
+    inherit (pkgs) fetchpatch pkgconfig libgcrypt libuuid popt lvm2;
+  };
+
+  dmraid = import ./dmraid.nix {
+    inherit stdenv fetchurl lvm2;
+  };
+
+  lvm2 = import ./lvm2.nix {
+    inherit stdenv fetchurl;
+    inherit (pkgs) fetchpatch pkgconfig utillinux systemd coreutils;
+  };
+
+  multipath_tools = import ./multipath-tools.nix {
+    inherit stdenv fetchurl lvm2;
+    inherit (pkgs) fetchpatch readline systemd libaio gzip;
+  };
+
+  parted = import ./parted.nix {
+    inherit stdenv fetchurl;
+    inherit (pkgs) fetchpatch utillinux readline libuuid gettext check lvm2;
+  };
+
+  pyblock = import ./pyblock.nix {
+    inherit stdenv fetchurl python lvm2 dmraid;
+  };
+
+  pykickstart = import ./pykickstart.nix {
+    inherit stdenv fetchurl python buildPythonApplication urlgrabber;
+  };
+
+  pyparted = import ./pyparted.nix {
+    inherit stdenv fetchurl python buildPythonApplication parted;
+    inherit (pkgs) pkgconfig e2fsprogs;
+  };
+
+in buildPythonApplication rec {
+  pname = "nixpart";
+  version = "0.4.1";
+  disabled = python.isPy3k;
+
+  src = fetchurl {
+    url = "https://github.com/NixOS/nixpart/archive/v${version}.tar.gz";
+    sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp";
+  };
+
+  propagatedBuildInputs = [ blivet ];
+
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "NixOS storage manager/partitioner";
+    homepage = "https://github.com/NixOS/nixpart";
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.aszlig ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix
new file mode 100644
index 000000000000..fd6088891023
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, lvm2 }:
+
+stdenv.mkDerivation rec {
+  name = "dmraid-1.0.0.rc15";
+
+  src = fetchurl {
+    url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/${name}.tar.bz2";
+    sha256 = "01bcaq0sc329ghgj7f182xws7jgjpdc41bvris8fsiprnxc7511h";
+  };
+
+  preConfigure = "cd */";
+
+  buildInputs = [ lvm2 ];
+
+  meta = {
+    description = "Old-style RAID configuration utility";
+    longDescription = ''
+      Old RAID configuration utility (still under development, though).
+      It is fully compatible with modern kernels and mdadm recognizes
+      its volumes. May be needed for rescuing an older system or nuking
+      the metadata when reformatting.
+    '';
+    maintainers = [ stdenv.lib.maintainers.raskin ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix
new file mode 100644
index 000000000000..fc0005a14d45
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix
@@ -0,0 +1,76 @@
+{ stdenv, fetchurl, fetchpatch, pkgconfig, systemd, utillinux, coreutils }:
+
+let
+  v = "2.02.106";
+in
+
+stdenv.mkDerivation {
+  name = "lvm2-${v}";
+
+  src = fetchurl {
+    url = "ftp://sources.redhat.com/pub/lvm2/releases/LVM2.${v}.tgz";
+    sha256 = "0nr833bl0q4zq52drjxmmpf7bs6kqxwa5kahwwxm9411khkxz0vc";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://github.com/lvmteam/lvm2/commit/92d5a8441007f578e000b492cecf67d6b8a87405.patch";
+      sha256 = "1yqd6jng0b370k53vks1shg57yhfyribhpmv19km5zsjqf0qqx2d";
+      excludes = [
+        "libdm/libdm-stats.c"
+      ];
+    })
+  ];
+
+  configureFlags = [
+    "--disable-readline"
+    "--enable-udev_rules"
+    "--enable-udev_sync"
+    "--enable-pkgconfig"
+    "--enable-applib"
+  ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ systemd ];
+
+  preConfigure =
+    ''
+      substituteInPlace scripts/lvmdump.sh \
+        --replace /usr/bin/tr ${coreutils}/bin/tr
+      substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \
+        --replace /usr/sbin/lvm $out/sbin/lvm \
+        --replace /usr/bin/udevadm ${systemd}/bin/udevadm
+
+      sed -i /DEFAULT_SYS_DIR/d Makefile.in
+      sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in
+    '';
+
+  enableParallelBuilding = true;
+
+  #patches = [ ./purity.patch ];
+
+  # To prevent make install from failing.
+  installFlags = [ "OWNER=" "GROUP=" "confdir=${placeholder "out"}/etc" ];
+
+  # Install systemd stuff.
+  #installTargets = "install install_systemd_generators install_systemd_units install_tmpfiles_configuration";
+
+  postInstall =
+    ''
+      substituteInPlace $out/lib/udev/rules.d/13-dm-disk.rules \
+        --replace $out/sbin/blkid ${utillinux.bin}/sbin/blkid
+
+      # Systemd stuff
+      mkdir -p $out/etc/systemd/system $out/lib/systemd/system-generators
+      cp scripts/blk_availability_systemd_red_hat.service $out/etc/systemd/system
+      cp scripts/lvm2_activation_generator_systemd_red_hat $out/lib/systemd/system-generators
+    '';
+
+  meta = {
+    homepage = "http://sourceware.org/lvm2/";
+    description = "Tools to support Logical Volume Management (LVM) on Linux";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix
new file mode 100644
index 000000000000..36525e6fa3cd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix
@@ -0,0 +1,53 @@
+# FIXME: unify with pkgs/os-specific/linux/multipath-tools/default.nix.
+
+{ stdenv, fetchurl, fetchpatch, lvm2, libaio, gzip, readline, systemd }:
+
+stdenv.mkDerivation rec {
+  name = "multipath-tools-0.4.9";
+
+  src = fetchurl {
+    url = "http://christophe.varoqui.free.fr/multipath-tools/${name}.tar.bz2";
+    sha256 = "04n7kazp1zrlqfza32phmqla0xkcq4zwn176qff5ida4a60whi4d";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/multipath-tools/files/multipath-tools-0.6.4-sysmacros.patch?id=eb22b954c177b5c1e2b6ed5c7cdd02f40f40d757";
+      sha256 = "1an0cgmz7g03c4qjimhpm9fcf2iswws18lwqxi688k87qm3xb5qd";
+      excludes = [
+        "libmultipath/util.c"
+      ];
+    })
+  ];
+
+  sourceRoot = ".";
+
+  buildInputs = [ lvm2 libaio readline gzip ];
+
+  preBuild =
+    ''
+      makeFlagsArray=(GZIP="-9" prefix=$out mandir=$out/share/man/man8 man5dir=$out/share/man/man5 LIB=lib)
+
+      substituteInPlace multipath/Makefile --replace /etc $out/etc
+      substituteInPlace kpartx/Makefile --replace /etc $out/etc
+
+      substituteInPlace kpartx/kpartx.rules --replace /sbin/kpartx $out/sbin/kpartx
+      substituteInPlace kpartx/kpartx_id --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup
+
+      substituteInPlace libmultipath/defaults.h --replace /lib/udev/scsi_id ${stdenv.lib.getLib systemd}/lib/udev/scsi_id
+      substituteInPlace libmultipath/hwtable.c --replace /lib/udev/scsi_id ${stdenv.lib.getLib systemd}/lib/udev/scsi_id
+
+      sed -i -re '
+         s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
+      ' libmultipath/defaults.h
+
+    '';
+
+  meta = {
+    description = "Tools for the Linux multipathing driver";
+    homepage = "http://christophe.varoqui.free.fr/";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix
new file mode 100644
index 000000000000..16f3a57ea147
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/parted.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchurl, fetchpatch, lvm2, libuuid, gettext, readline
+, utillinux, check, enableStatic ? false }:
+
+stdenv.mkDerivation rec {
+  name = "parted-3.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/parted/${name}.tar.xz";
+    sha256 = "05fa4m1bky9d13hqv91jlnngzlyn7y4rnnyq6d86w0dg3vww372y";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-block/parted/files/parted-3.2-sysmacros.patch?id=8e2414f551c14166f259f9a25a594aec7a5b9ea0";
+      sha256 = "0fdgifjbri7n28hv74zksac05gw72p2czzvyar0jp62b9dnql3mp";
+    })
+  ];
+
+  buildInputs = [ libuuid ]
+    ++ stdenv.lib.optional (readline != null) readline
+    ++ stdenv.lib.optional (gettext != null) gettext
+    ++ stdenv.lib.optional (lvm2 != null) lvm2;
+
+  configureFlags =
+       (if (readline != null)
+        then [ "--with-readline" ]
+        else [ "--without-readline" ])
+    ++ stdenv.lib.optional (lvm2 == null) "--disable-device-mapper"
+    ++ stdenv.lib.optional enableStatic "--enable-static";
+
+  doCheck = true;
+  checkInputs = [ check utillinux ];
+
+  meta = {
+    description = "Create, destroy, resize, check, and copy partitions";
+
+    longDescription = ''
+      GNU Parted is an industrial-strength package for creating, destroying,
+      resizing, checking and copying partitions, and the file systems on
+      them.  This is useful for creating space for new operating systems,
+      reorganising disk usage, copying data on hard disks and disk imaging.
+
+      It contains a library, libparted, and a command-line frontend, parted,
+      which also serves as a sample implementation and script backend.
+    '';
+
+    homepage = "https://www.gnu.org/software/parted/";
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = [
+      # Add your name here!
+    ];
+
+    # GNU Parted requires libuuid, which is part of util-linux-ng.
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch
new file mode 100644
index 000000000000..b8ab7bd53b2b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock-sysmacros.h.patch
@@ -0,0 +1,12 @@
+diff --git a/dm.c b/dm.c
+index 5daa0e5..d5b84c8 100644
+--- a/dm.c
++++ b/dm.c
+@@ -19,6 +19,7 @@
+ #define _GNU_SOURCE
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <stdarg.h>
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix
new file mode 100644
index 000000000000..f087edd853d7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, python, lvm2, dmraid }:
+
+stdenv.mkDerivation rec {
+  pname = "pyblock";
+  version = "0.53";
+  md5_path = "f6d33a8362dee358517d0a9e2ebdd044";
+
+  src = fetchurl {
+    url = "https://src.fedoraproject.org/repo/pkgs/python-pyblock/"
+        + "${pname}-${version}.tar.bz2/${md5_path}/${pname}-${version}.tar.bz2";
+    sha256 = "f6cef88969300a6564498557eeea1d8da58acceae238077852ff261a2cb1d815";
+  };
+
+  patches = [
+    # Fix build with glibc >= 2.28
+    # https://github.com/NixOS/nixpkgs/issues/86403
+    ./pyblock-sysmacros.h.patch
+  ];
+
+  postPatch = ''
+    sed -i -e 's|/usr/include/python|${python}/include/python|' \
+           -e 's/-Werror *//' -e 's|/usr/|'"$out"'/|' Makefile
+  '';
+
+  buildInputs = [ python lvm2 dmraid ];
+
+  makeFlags = [
+    "USESELINUX=0"
+    "SITELIB=$(out)/lib/${python.libPrefix}/site-packages"
+  ];
+
+  meta = {
+    description = "Interface for working with block devices";
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix
new file mode 100644
index 000000000000..0698dcd9ecb7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix
@@ -0,0 +1,30 @@
+{ stdenv, python, buildPythonApplication, fetchurl, urlgrabber }:
+
+buildPythonApplication rec {
+  pname = "pykickstart";
+  version = "1.99.39";
+  md5_path = "d249f60aa89b1b4facd63f776925116d";
+
+  src = fetchurl {
+    url = "https://src.fedoraproject.org/repo/pkgs/pykickstart/"
+        + "${pname}-${version}.tar.gz/${md5_path}/${pname}-${version}.tar.gz";
+    sha256 = "e0d0f98ac4c5607e6a48d5c1fba2d50cc804de1081043f9da68cbfc69cad957a";
+  };
+
+  postPatch = ''
+    sed -i -e "s/for tst in tstList/for tst in sorted(tstList, \
+               key=lambda m: m.__name__)/" tests/baseclass.py
+  '';
+
+  propagatedBuildInputs = [ urlgrabber ];
+
+  checkPhase = ''
+    ${python}/bin/${python.executable} tests/baseclass.py -vv
+  '';
+
+  meta = {
+    homepage = "http://fedoraproject.org/wiki/Pykickstart";
+    description = "Read and write Fedora kickstart files";
+    license = stdenv.lib.licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix
new file mode 100644
index 000000000000..f71e7c3a06db
--- /dev/null
+++ b/nixpkgs/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, pkgconfig, python, buildPythonApplication, parted, e2fsprogs }:
+
+buildPythonApplication rec {
+  pname = "pyparted";
+  version = "3.10";
+
+  src = fetchurl {
+    url = "https://fedorahosted.org/releases/p/y/pyparted/${pname}-${version}.tar.gz";
+    sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv";
+  };
+
+  postPatch = ''
+    sed -i -e 's|/sbin/mke2fs|${e2fsprogs}&|' tests/baseclass.py
+    sed -i -e '
+      s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path|
+    ' tests/test__ped_ped.py
+  '' + stdenv.lib.optionalString stdenv.isi686 ''
+    # remove some integers in this test case which overflow on 32bit systems
+    sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \
+      tests/test__ped_ped.py
+  '';
+
+  preConfigure = ''
+    PATH="${parted}/sbin:$PATH"
+  '';
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  propagatedBuildInputs = [ parted ];
+
+  checkPhase = ''
+    patchShebangs Makefile
+    make test PYTHON=${python.executable}
+  '';
+
+  meta = {
+    homepage = "https://fedorahosted.org/pyparted/";
+    description = "Python interface for libparted";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}