at 18.03-beta 98 lines 3.2 kB view raw
1{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, perl, docbook2x 2, docbook_xml_dtd_45, python3Packages 3 4# Optional Dependencies 5, libapparmor ? null, gnutls ? null, libselinux ? null, libseccomp ? null 6, cgmanager ? null, libnih ? null, dbus ? null, libcap ? null, systemd ? null 7}: 8 9let 10 enableCgmanager = cgmanager != null && libnih != null && dbus != null; 11in 12with stdenv.lib; 13stdenv.mkDerivation rec { 14 name = "lxc-${version}"; 15 version = "2.1.1"; 16 17 src = fetchurl { 18 url = "https://linuxcontainers.org/downloads/lxc/lxc-${version}.tar.gz"; 19 sha256 = "1xpghrinxhm2072fwmn42pxhjwh7qx6cbsipw4s6g38a8mkklrk8"; 20 }; 21 22 nativeBuildInputs = [ 23 autoreconfHook pkgconfig perl docbook2x python3Packages.wrapPython 24 ]; 25 buildInputs = [ 26 libapparmor gnutls libselinux libseccomp cgmanager libnih dbus libcap 27 python3Packages.python python3Packages.setuptools systemd 28 ]; 29 30 patches = [ 31 ./support-db2x.patch 32 ]; 33 34 postPatch = '' 35 sed -i '/chmod u+s/d' src/lxc/Makefile.am 36 ''; 37 38 XML_CATALOG_FILES = "${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml"; 39 40 # FIXME 41 # glibc 2.25 moved major()/minor() to <sys/sysmacros.h>. 42 # this commit should detect this: https://github.com/lxc/lxc/pull/1388/commits/af6824fce9c9536fbcabef8d5547f6c486f55fdf 43 # However autotools checks if mkdev is still defined in <sys/types.h> runs before 44 # checking if major()/minor() is defined there. The mkdev check succeeds with 45 # a warning and the check which should set MAJOR_IN_SYSMACROS is skipped. 46 NIX_CFLAGS_COMPILE = [ "-DMAJOR_IN_SYSMACROS" ]; 47 48 configureFlags = [ 49 "--localstatedir=/var" 50 "--sysconfdir=/etc" 51 "--disable-api-docs" 52 "--with-init-script=none" 53 "--with-distro=nixos" # just to be sure it is "unknown" 54 ] ++ optional (libapparmor != null) "--enable-apparmor" 55 ++ optional (libselinux != null) "--enable-selinux" 56 ++ optional (libseccomp != null) "--enable-seccomp" 57 ++ optional (libcap != null) "--enable-capabilities" 58 ++ [ 59 "--disable-examples" 60 "--enable-python" 61 "--disable-lua" 62 "--enable-bash" 63 (if doCheck then "--enable-tests" else "--disable-tests") 64 "--with-rootfs-path=/var/lib/lxc/rootfs" 65 ]; 66 67 doCheck = false; 68 69 installFlags = [ 70 "localstatedir=\${TMPDIR}" 71 "sysconfdir=\${out}/etc" 72 "sysconfigdir=\${out}/etc/default" 73 "bashcompdir=\${out}/share/bash-completion/completions" 74 "READMEdir=\${TMPDIR}/var/lib/lxc/rootfs" 75 "LXCPATH=\${TMPDIR}/var/lib/lxc" 76 ]; 77 78 postInstall = '' 79 wrapPythonPrograms 80 ''; 81 82 meta = { 83 homepage = https://linuxcontainers.org/; 84 description = "Userspace tools for Linux Containers, a lightweight virtualization system"; 85 license = licenses.lgpl21Plus; 86 87 longDescription = '' 88 LXC is the userspace control package for Linux Containers, a 89 lightweight virtual system mechanism sometimes described as 90 "chroot on steroids". LXC builds up from chroot to implement 91 complete virtual systems, adding resource management and isolation 92 mechanisms to Linuxs existing process management infrastructure. 93 ''; 94 95 platforms = platforms.linux; 96 maintainers = with maintainers; [ wkennington globin fpletz ]; 97 }; 98}