Add docker module

This commit is contained in:
Henrik Lissner 2020-04-22 19:55:22 -04:00
parent fec39b2405
commit a41169c073
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 46 additions and 0 deletions

14
config/docker/aliases.zsh Normal file
View 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}"
}

View file

@ -3,6 +3,7 @@
{
imports = [
# ./calibre-server.nix
./docker.nix
# ./gitea.nix
# ./jellyfin.nix
# ./keybase.nix

View 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 = [];
};
};
};
}