Merge pull request #20858 from Mic92/lxcfs

lxcfs: init at 2.0.4
This commit is contained in:
Jörg Thalheim 2016-12-04 11:33:07 +01:00 committed by GitHub
commit e00632e200
5 changed files with 115 additions and 0 deletions

View File

@ -483,6 +483,7 @@
./services/security/torify.nix ./services/security/torify.nix
./services/security/tor.nix ./services/security/tor.nix
./services/security/torsocks.nix ./services/security/torsocks.nix
./services/system/cgmanager.nix
./services/system/cloud-init.nix ./services/system/cloud-init.nix
./services/system/dbus.nix ./services/system/dbus.nix
./services/system/kerberos.nix ./services/system/kerberos.nix
@ -617,6 +618,7 @@
./virtualisation/docker.nix ./virtualisation/docker.nix
./virtualisation/libvirtd.nix ./virtualisation/libvirtd.nix
./virtualisation/lxc.nix ./virtualisation/lxc.nix
./virtualisation/lxcfs.nix
./virtualisation/lxd.nix ./virtualisation/lxd.nix
./virtualisation/amazon-options.nix ./virtualisation/amazon-options.nix
./virtualisation/openvswitch.nix ./virtualisation/openvswitch.nix

View File

@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.cgmanager;
in {
meta.maintainers = [ maintainers.mic92 ];
###### interface
options.services.cgmanager.enable = mkEnableOption "cgmanager";
###### implementation
config = mkIf cfg.enable {
systemd.services.cgmanager = {
wantedBy = [ "multi-user.target" ];
after = [ "local-fs.target" ];
description = "Cgroup management daemon";
restartIfChanged = false;
serviceConfig = {
ExecStart = "${pkgs.cgmanager}/bin/cgmanager -m name=systemd";
KillMode = "process";
Restart = "on-failure";
};
};
};
}

View File

@ -0,0 +1,49 @@
# LXC Configuration
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.virtualisation.lxc.lxcfs;
in {
meta.maintainers = [ maintainers.mic92 ];
###### interface
options.virtualisation.lxc.lxcfs = {
enable =
mkOption {
type = types.bool;
default = false;
description = ''
This enables LXCFS, a FUSE filesystem for LXC.
To use lxcfs in include the following configuration in your
container configuration:
<code>
virtualisation.lxc.defaultConfig = "lxc.include = ''${pkgs.lxcfs}/share/lxc/config/common.conf.d/00-lxcfs.conf";
</code>
'';
};
};
###### implementation
config = mkIf cfg.enable {
services.cgmanager.enable = true;
systemd.services.lxcfs = {
description = "FUSE filesystem for LXC";
wantedBy = [ "multi-user.target" ];
requires = [ "cgmanager.service" ];
after = [ "cgmanager.service" ];
before = [ "lxc.service" ];
restartIfChanged = false;
serviceConfig = {
ExecStartPre="${pkgs.coreutils}/bin/mkdir -p /var/lib/lxcfs";
ExecStart="${pkgs.lxcfs}/bin/lxcfs /var/lib/lxcfs";
ExecStopPost="-${pkgs.fuse}/bin/fusermount -u /var/lib/lxcfs";
KillMode="process";
Restart="on-failure";
};
};
};
}

View File

@ -0,0 +1,36 @@
{ stdenv, fetchurl, pkgconfig, help2man, fuse, pam }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "lxcfs-${version}";
version = "2.0.4";
src = fetchurl {
url = "https://linuxcontainers.org/downloads/lxcfs/lxcfs-${version}.tar.gz";
sha256 = "0pfrsn7hqccpcnwg4xk8ds0avb2yc9gyvj7bk2bl90vpwsm35j7y";
};
nativeBuildInputs = [ pkgconfig help2man ];
buildInputs = [ fuse pam ];
configureFlags = [
"--with-init-script=systemd"
"--sysconfdir=/etc"
"--localstatedir=/var"
];
installFlags = [ "SYSTEMD_UNIT_DIR=\${out}/lib/systemd" ];
postFixup = ''
# liblxcfs.so is reloaded with dlopen()
patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
'';
meta = {
homepage = https://linuxcontainers.org/lxcfs;
description = "FUSE filesystem for LXC";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ mic92 ];
};
}

View File

@ -2640,6 +2640,7 @@ in
lshw = callPackage ../tools/system/lshw { }; lshw = callPackage ../tools/system/lshw { };
lxc = callPackage ../os-specific/linux/lxc { }; lxc = callPackage ../os-specific/linux/lxc { };
lxcfs = callPackage ../os-specific/linux/lxcfs { };
lxd = callPackage ../tools/admin/lxd { }; lxd = callPackage ../tools/admin/lxd { };
lzfse = callPackage ../tools/compression/lzfse { }; lzfse = callPackage ../tools/compression/lzfse { };