Add docker module
This commit is contained in:
		
							parent
							
								
									fec39b2405
								
							
						
					
					
						commit
						a41169c073
					
				
							
								
								
									
										14
									
								
								config/docker/aliases.zsh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								config/docker/aliases.zsh
									
									
									
									
									
										Normal file
									
								
							|  | @ -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}" | ||||||
|  | } | ||||||
|  | @ -3,6 +3,7 @@ | ||||||
| { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     # ./calibre-server.nix |     # ./calibre-server.nix | ||||||
|  |     ./docker.nix | ||||||
|     # ./gitea.nix |     # ./gitea.nix | ||||||
|     # ./jellyfin.nix |     # ./jellyfin.nix | ||||||
|     # ./keybase.nix |     # ./keybase.nix | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								modules/services/docker.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								modules/services/docker.nix
									
									
									
									
									
										Normal file
									
								
							|  | @ -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 <config/docker/aliases.zsh>; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     virtualisation = { | ||||||
|  |       docker = { | ||||||
|  |         enable = true; | ||||||
|  |         autoPrune.enable = true; | ||||||
|  |         enableOnBoot = false; | ||||||
|  |         # listenOptions = []; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
		Reference in a new issue