summary refs log tree commit diff
path: root/nixos/modules/virtualisation/podman/dnsname.nix
blob: beef19755079c604422c5c685fe034afd38d6bba (plain) (blame)
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
{ config, lib, pkgs, ... }:
let
  inherit (lib)
    mkOption
    mkIf
    types
    ;

  cfg = config.virtualisation.podman;

in
{
  options = {
    virtualisation.podman = {

      defaultNetwork.dnsname.enable = mkOption {
        type = types.bool;
        default = false;
        description = ''
          Enable DNS resolution in the default podman network.
        '';
      };

    };
  };

  config = {
    virtualisation.containers.containersConf.cniPlugins = mkIf cfg.defaultNetwork.dnsname.enable [ pkgs.dnsname-cni ];
    virtualisation.podman.defaultNetwork.extraPlugins =
      lib.optional cfg.defaultNetwork.dnsname.enable {
        type = "dnsname";
        domainName = "dns.podman";
        capabilities.aliases = true;
      };
  };
}