nix/nixos/common/services/docker.nix
2025-02-24 13:26:23 -08:00

38 lines
934 B
Nix

{ pkgs, ... }: {
# Need to increase this because the number of
# containers I have drive the defaults over the max
boot.kernel.sysctl = {
"fs.inotify.max_user_watches" = 52428800;
"fs.inotify.max_user_instances" = 4096;
};
# Allow Docker containers to access Tailscale network
networking.firewall = {
trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ 41641 ]; # Tailscale port
};
virtualisation.docker = {
enable = true;
enableOnBoot = true;
liveRestore = true;
autoPrune = {
enable = true;
dates = "weekly";
flags = ["--all"];
};
daemon.settings = {
registry-mirrors = [ "https://registry.sysctl.io" ];
};
};
environment.systemPackages = with pkgs; [
docker-compose
ctop
];
# Add the docker telegraf listener
services.telegraf.extraConfig.inputs.docker = {};
users.users.telegraf.extraGroups = [ "docker" ];
}