nixos-config/modules/docker/default.nix
2021-11-22 18:56:59 +01:00

41 lines
993 B
Nix

{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.eboskma.docker;
matrixClientConfig = pkgs.writeText "element-web.json" (builtins.readFile ./element-web.json);
in
{
options.eboskma.docker = { enable = mkEnableOption "activate docker"; };
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ docker-compose ];
virtualisation.docker = {
enable = true;
autoPrune = {
enable = true;
dates = "weekly";
};
};
# docker run -d --restart=always --name element-web -p 8888:80 -v $PWD/element-web.json:/app/config.json vectorim/element-web
virtualisation.oci-containers.containers = {
element-web = {
autoStart = true;
image = "vectorim/element-web";
ports = [
"8888:80"
];
volumes = [
"${matrixClientConfig}:/app/config.json"
];
};
};
users.extraUsers.${config.eboskma.var.mainUser}.extraGroups =
[ "docker" ];
};
}