lxd: When lxcfs is enabled, start lxd with explicit LXD_LXC_TEMPLATE_CONFIG

This commit is contained in:
Patryk Wychowaniec 2020-06-05 14:40:02 +02:00
parent 4dee97c43e
commit 6c6924b2eb
No known key found for this signature in database
GPG Key ID: F62547D075E09767

View File

@ -24,6 +24,12 @@ in
containers. Users in the "lxd" group can interact with containers. Users in the "lxd" group can interact with
the daemon (e.g. to start or stop containers) using the the daemon (e.g. to start or stop containers) using the
<command>lxc</command> command line tool, among others. <command>lxc</command> command line tool, among others.
Most of the time, you'll also want to start lxcfs, so
that containers can "see" the limits:
<code>
virtualisation.lxc.lxcfs.enable = true;
</code>
''; '';
}; };
@ -114,6 +120,12 @@ in
LimitNOFILE = "1048576"; LimitNOFILE = "1048576";
LimitNPROC = "infinity"; LimitNPROC = "infinity";
TasksMax = "infinity"; TasksMax = "infinity";
# By default, `lxd` loads configuration files from hard-coded
# `/usr/share/lxc/config` - since this is a no-go for us, we have to
# explicitly tell it where the actual configuration files are
Environment = mkIf (config.virtualisation.lxc.lxcfs.enable)
"LXD_LXC_TEMPLATE_CONFIG=${pkgs.lxcfs}/share/lxc/config";
}; };
}; };