diff --git a/config/docker/aliases.zsh b/config/docker/aliases.zsh new file mode 100644 index 00000000..2c026a79 --- /dev/null +++ b/config/docker/aliases.zsh @@ -0,0 +1,14 @@ +alias dk=docker +alias dkc=docker-compose +alias dkm=docker-machine +alias dkl='dk logs' +alias dkcl='dkc logs' + +dkclr() { + dk stop $(docker ps -a -q) + dk rm $(docker ps -a -q) +} + +dke() { + dk exec -it "$1" "${@:1}" +} diff --git a/modules/services/default.nix b/modules/services/default.nix index 6be1194a..e16514d1 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -3,6 +3,7 @@ { imports = [ # ./calibre-server.nix + ./docker.nix # ./gitea.nix # ./jellyfin.nix # ./keybase.nix diff --git a/modules/services/docker.nix b/modules/services/docker.nix new file mode 100644 index 00000000..a38caac4 --- /dev/null +++ b/modules/services/docker.nix @@ -0,0 +1,31 @@ +{ config, options, pkgs, lib, ... }: +with lib; +{ + options.modules.services.docker = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + + config = mkIf config.modules.services.docker.enable { + my = { + packages = with pkgs; [ docker docker-compose ]; + + env.DOCKER_CONFIG = "$XDG_CONFIG_HOME/docker"; + env.MACHINE_STORAGE_PATH = "$XDG_DATA_HOME/docker/machine"; + + user.extraGroups = [ "docker" ]; + zsh.rc = lib.readFile ; + }; + + virtualisation = { + docker = { + enable = true; + autoPrune.enable = true; + enableOnBoot = false; + # listenOptions = []; + }; + }; + }; +}