Skip to content

Instantly share code, notes, and snippets.

@PedroHLC
Created March 22, 2023 14:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PedroHLC/6634f606100296628a5adb8f79da2e01 to your computer and use it in GitHub Desktop.
Save PedroHLC/6634f606100296628a5adb8f79da2e01 to your computer and use it in GitHub Desktop.
Returns dnsname-cni to nixpkgs' podman
{ pkgs, ... }:
{
environment.etc."cni/net.d/87-podman-bridge.conflist".source =
let
cfgExtraPlugins = [{
type = "dnsname";
domainName = "dns.podman";
capabilities.aliases = true;
}];
cfgPackage = pkgs.podman;
in
pkgs.runCommand "87-podman-bridge.conflist"
{
nativeBuildInputs = [ pkgs.jq ];
extraPlugins = builtins.toJSON cfgExtraPlugins;
jqScript = ''
. + { "plugins": (.plugins + $extraPlugins) }
'';
} ''
jq <${cfgPackage.src}/cni/87-podman-bridge.conflist \
--argjson extraPlugins "$extraPlugins" \
"$jqScript" \
>$out
'';
virtualisation.containers.containersConf.cniPlugins = [ pkgs.dnsname-cni ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment