diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2014-09-21 21:29:15 +0200 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2014-10-18 05:02:39 +0200 |
commit | 2c321bf2963074c9c60355235b4ce95592ecf855 (patch) | |
tree | 443e5f417b16a9c596c2be4b2028e7af5278dd4b /nixos/modules/virtualisation/lxc.nix | |
parent | eff15260d4b30a12d9ef179dbd1dbccad894dac8 (diff) | |
download | nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar.gz nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar.bz2 nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar.lz nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar.xz nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.tar.zst nixpkgs-2c321bf2963074c9c60355235b4ce95592ecf855.zip |
Add support for global LXC config files
Diffstat (limited to 'nixos/modules/virtualisation/lxc.nix')
-rw-r--r-- | nixos/modules/virtualisation/lxc.nix | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/lxc.nix b/nixos/modules/virtualisation/lxc.nix new file mode 100644 index 00000000000..10d3a6575fb --- /dev/null +++ b/nixos/modules/virtualisation/lxc.nix @@ -0,0 +1,75 @@ +# LXC Configuration + +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.virtualisation.lxc; + +in + +{ + ###### interface + + options.virtualisation.lxc = { + enable = + mkOption { + type = types.bool; + default = false; + description = + '' + This enables Linux Containers (LXC), which provides tools + for creating and managing system or application containers + on Linux. + ''; + }; + + systemConfig = + mkOption { + type = types.lines; + default = ""; + description = + '' + This is the system-wide LXC config. See lxc.system.conf(5). + ''; + }; + + defaultConfig = + mkOption { + type = types.lines; + default = ""; + description = + '' + Default config (default.conf) for new containers, i.e. for + network config. See lxc.container.conf(5). + ''; + }; + + usernetConfig = + mkOption { + type = types.lines; + default = ""; + description = + '' + This is the config file for managing unprivileged user network + administration access in LXC. See lxc-user-net(5). + ''; + }; + + }; + + ###### implementation + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.lxc ]; + + environment.etc."lxc/lxc.conf".text = cfg.systemConfig; + environment.etc."lxc/lxc-usernet".text = cfg.usernetConfig; + environment.etc."lxc/default.conf".text = cfg.defaultConfig; + + }; + +} |