Merge pull request #20858 from Mic92/lxcfs

lxcfs: init at 2.0.4

authored by

Jörg Thalheim and committed by
GitHub
e00632e2 cb2c5f4a

+115
+2
nixos/modules/module-list.nix
··· 483 ./services/security/torify.nix 484 ./services/security/tor.nix 485 ./services/security/torsocks.nix 486 ./services/system/cloud-init.nix 487 ./services/system/dbus.nix 488 ./services/system/kerberos.nix ··· 617 ./virtualisation/docker.nix 618 ./virtualisation/libvirtd.nix 619 ./virtualisation/lxc.nix 620 ./virtualisation/lxd.nix 621 ./virtualisation/amazon-options.nix 622 ./virtualisation/openvswitch.nix
··· 483 ./services/security/torify.nix 484 ./services/security/tor.nix 485 ./services/security/torsocks.nix 486 + ./services/system/cgmanager.nix 487 ./services/system/cloud-init.nix 488 ./services/system/dbus.nix 489 ./services/system/kerberos.nix ··· 618 ./virtualisation/docker.nix 619 ./virtualisation/libvirtd.nix 620 ./virtualisation/lxc.nix 621 + ./virtualisation/lxcfs.nix 622 ./virtualisation/lxd.nix 623 ./virtualisation/amazon-options.nix 624 ./virtualisation/openvswitch.nix
+27
nixos/modules/services/system/cgmanager.nix
···
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.services.cgmanager; 7 + in { 8 + meta.maintainers = [ maintainers.mic92 ]; 9 + 10 + ###### interface 11 + options.services.cgmanager.enable = mkEnableOption "cgmanager"; 12 + 13 + ###### implementation 14 + config = mkIf cfg.enable { 15 + systemd.services.cgmanager = { 16 + wantedBy = [ "multi-user.target" ]; 17 + after = [ "local-fs.target" ]; 18 + description = "Cgroup management daemon"; 19 + restartIfChanged = false; 20 + serviceConfig = { 21 + ExecStart = "${pkgs.cgmanager}/bin/cgmanager -m name=systemd"; 22 + KillMode = "process"; 23 + Restart = "on-failure"; 24 + }; 25 + }; 26 + }; 27 + }
+49
nixos/modules/virtualisation/lxcfs.nix
···
··· 1 + # LXC Configuration 2 + 3 + { config, lib, pkgs, ... }: 4 + 5 + with lib; 6 + 7 + let 8 + cfg = config.virtualisation.lxc.lxcfs; 9 + in { 10 + meta.maintainers = [ maintainers.mic92 ]; 11 + 12 + ###### interface 13 + options.virtualisation.lxc.lxcfs = { 14 + enable = 15 + mkOption { 16 + type = types.bool; 17 + default = false; 18 + description = '' 19 + This enables LXCFS, a FUSE filesystem for LXC. 20 + To use lxcfs in include the following configuration in your 21 + container configuration: 22 + <code> 23 + virtualisation.lxc.defaultConfig = "lxc.include = ''${pkgs.lxcfs}/share/lxc/config/common.conf.d/00-lxcfs.conf"; 24 + </code> 25 + ''; 26 + }; 27 + }; 28 + 29 + ###### implementation 30 + config = mkIf cfg.enable { 31 + services.cgmanager.enable = true; 32 + 33 + systemd.services.lxcfs = { 34 + description = "FUSE filesystem for LXC"; 35 + wantedBy = [ "multi-user.target" ]; 36 + requires = [ "cgmanager.service" ]; 37 + after = [ "cgmanager.service" ]; 38 + before = [ "lxc.service" ]; 39 + restartIfChanged = false; 40 + serviceConfig = { 41 + ExecStartPre="${pkgs.coreutils}/bin/mkdir -p /var/lib/lxcfs"; 42 + ExecStart="${pkgs.lxcfs}/bin/lxcfs /var/lib/lxcfs"; 43 + ExecStopPost="-${pkgs.fuse}/bin/fusermount -u /var/lib/lxcfs"; 44 + KillMode="process"; 45 + Restart="on-failure"; 46 + }; 47 + }; 48 + }; 49 + }
+36
pkgs/os-specific/linux/lxcfs/default.nix
···
··· 1 + { stdenv, fetchurl, pkgconfig, help2man, fuse, pam }: 2 + 3 + with stdenv.lib; 4 + stdenv.mkDerivation rec { 5 + name = "lxcfs-${version}"; 6 + version = "2.0.4"; 7 + 8 + src = fetchurl { 9 + url = "https://linuxcontainers.org/downloads/lxcfs/lxcfs-${version}.tar.gz"; 10 + sha256 = "0pfrsn7hqccpcnwg4xk8ds0avb2yc9gyvj7bk2bl90vpwsm35j7y"; 11 + }; 12 + 13 + nativeBuildInputs = [ pkgconfig help2man ]; 14 + buildInputs = [ fuse pam ]; 15 + 16 + configureFlags = [ 17 + "--with-init-script=systemd" 18 + "--sysconfdir=/etc" 19 + "--localstatedir=/var" 20 + ]; 21 + 22 + installFlags = [ "SYSTEMD_UNIT_DIR=\${out}/lib/systemd" ]; 23 + 24 + postFixup = '' 25 + # liblxcfs.so is reloaded with dlopen() 26 + patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs" 27 + ''; 28 + 29 + meta = { 30 + homepage = https://linuxcontainers.org/lxcfs; 31 + description = "FUSE filesystem for LXC"; 32 + license = licenses.asl20; 33 + platforms = platforms.linux; 34 + maintainers = with maintainers; [ mic92 ]; 35 + }; 36 + }
+1
pkgs/top-level/all-packages.nix
··· 2640 lshw = callPackage ../tools/system/lshw { }; 2641 2642 lxc = callPackage ../os-specific/linux/lxc { }; 2643 lxd = callPackage ../tools/admin/lxd { }; 2644 2645 lzfse = callPackage ../tools/compression/lzfse { };
··· 2640 lshw = callPackage ../tools/system/lshw { }; 2641 2642 lxc = callPackage ../os-specific/linux/lxc { }; 2643 + lxcfs = callPackage ../os-specific/linux/lxcfs { }; 2644 lxd = callPackage ../tools/admin/lxd { }; 2645 2646 lzfse = callPackage ../tools/compression/lzfse { };