-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-config.nix
41 lines (41 loc) · 1.03 KB
/
docker-config.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.virtualisation.docker;
daemonConfigJson = builtins.toJSON cfg.daemonConfig;
daemonConfigFile = pkgs.writeText "daemon.json" daemonConfigJson;
in
{
options.virtualisation.docker = {
daemonConfig = mkOption {
type = types.anything;
default = { };
example = {
ipv6 = true;
"fixed-cidr-v6" = "fd00::/80";
};
description = ''
Configuration for docker daemon. The attributes are serialized to JSON used as daemon.conf as-is.
Note that /etc/docker/daemon.conf will not be available anymore.
'';
};
ipv6 = mkOption {
type = types.bool;
default = config.networking.enableIPv6;
defaultText = "config.networking.enableIPv6";
description = "Whether to use IPv6.";
};
};
config = {
virtualisation.docker.daemonConfig = mkIf cfg.ipv6 {
ipv6 = true;
"fixed-cidr-v6" = "fd00::/80";
};
virtualisation.docker.extraOptions = "--config-file=${daemonConfigFile}";
};
}