at 24.05-pre 106 lines 3.2 kB view raw
1{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, perl, docbook2x 2, docbook_xml_dtd_45, python3Packages, pam, fetchpatch 3 4# Optional Dependencies 5, libapparmor ? null, gnutls ? null, libselinux ? null, libseccomp ? null 6, libcap ? null, systemd ? null 7}: 8 9with lib; 10stdenv.mkDerivation rec { 11 pname = "lxc"; 12 version = "4.0.12"; 13 14 src = fetchurl { 15 url = "https://linuxcontainers.org/downloads/lxc/lxc-${version}.tar.gz"; 16 sha256 = "1vyk2j5w9gfyh23w3ar09cycyws16mxh3clbb33yhqzwcs1jy96v"; 17 }; 18 19 nativeBuildInputs = [ 20 autoreconfHook pkg-config perl docbook2x python3Packages.wrapPython 21 ]; 22 buildInputs = [ 23 pam libapparmor gnutls libselinux libseccomp libcap 24 python3Packages.python python3Packages.setuptools systemd 25 ]; 26 27 patches = [ 28 ./support-db2x.patch 29 30 # Backport of https://github.com/lxc/lxc/pull/4179 for glibc-2.36 build 31 (fetchpatch { 32 url = "https://github.com/lxc/lxc/commit/c1115e1503bf955c97f4cf3b925a6a9f619764c3.patch"; 33 sha256 = "sha256-aC1XQesRJfkyQnloB3NvR4p/1WITrqkGYzw50PDxDrs="; 34 excludes = [ "meson.build" ]; 35 }) 36 ]; 37 38 postPatch = '' 39 sed -i '/chmod u+s/d' src/lxc/Makefile.am 40 ''; 41 42 XML_CATALOG_FILES = "${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml"; 43 44 configureFlags = [ 45 "--enable-pam" 46 "--localstatedir=/var" 47 "--sysconfdir=/etc" 48 "--disable-api-docs" 49 "--with-init-script=none" 50 "--with-distro=nixos" # just to be sure it is "unknown" 51 ] ++ optional (libapparmor != null) "--enable-apparmor" 52 ++ optional (libselinux != null) "--enable-selinux" 53 ++ optional (libseccomp != null) "--enable-seccomp" 54 ++ optional (libcap != null) "--enable-capabilities" 55 ++ [ 56 "--disable-examples" 57 "--enable-python" 58 "--disable-lua" 59 "--enable-bash" 60 (if doCheck then "--enable-tests" else "--disable-tests") 61 "--with-rootfs-path=/var/lib/lxc/rootfs" 62 ]; 63 64 doCheck = false; 65 66 installFlags = [ 67 "localstatedir=\${TMPDIR}" 68 "sysconfdir=\${out}/etc" 69 "sysconfigdir=\${out}/etc/default" 70 "bashcompdir=\${out}/share/bash-completion/completions" 71 "READMEdir=\${TMPDIR}/var/lib/lxc/rootfs" 72 "LXCPATH=\${TMPDIR}/var/lib/lxc" 73 ]; 74 75 postInstall = '' 76 wrapPythonPrograms 77 78 completions=( 79 lxc-attach lxc-cgroup lxc-console lxc-destroy lxc-device lxc-execute 80 lxc-freeze lxc-info lxc-monitor lxc-snapshot lxc-stop lxc-unfreeze 81 ) 82 pushd $out/share/bash-completion/completions/ 83 mv lxc lxc-start 84 for completion in ''${completions[@]}; do 85 ln -sfn lxc-start $completion 86 done 87 popd 88 ''; 89 90 meta = { 91 homepage = "https://linuxcontainers.org/"; 92 description = "Userspace tools for Linux Containers, a lightweight virtualization system"; 93 license = licenses.lgpl21Plus; 94 95 longDescription = '' 96 LXC is the userspace control package for Linux Containers, a 97 lightweight virtual system mechanism sometimes described as 98 "chroot on steroids". LXC builds up from chroot to implement 99 complete virtual systems, adding resource management and isolation 100 mechanisms to Linuxs existing process management infrastructure. 101 ''; 102 103 platforms = platforms.linux; 104 maintainers = with maintainers; [ ]; 105 }; 106}