diff options
Diffstat (limited to 'modules/nixos/docker.nix')
-rw-r--r-- | modules/nixos/docker.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/nixos/docker.nix b/modules/nixos/docker.nix new file mode 100644 index 0000000..e642030 --- /dev/null +++ b/modules/nixos/docker.nix @@ -0,0 +1,41 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.nixfiles.modules.docker; +in { + options.nixfiles.modules.docker.enable = mkEnableOption "Docker"; + + config = mkIf cfg.enable { + assertions = [ + { + assertion = !config.nixfiles.modules.podman.enable; + message = "Pick only one!"; + } + ]; + + secrets.containers-auth = { + file = "${inputs.self}/secrets/containers-auth"; + path = "${config.my.home}/.docker/config.json"; + owner = my.username; + inherit (config.my) group; + }; + + virtualisation.docker.enable = true; + + environment.systemPackages = with pkgs; [docker-compose]; + + my.extraGroups = ["docker"]; + + hm.programs.bash = { + shellAliases.d = "${pkgs.docker}/bin/docker"; + initExtra = mkAfter '' + _complete_alias d _docker docker + ''; + }; + }; +} |