from my phone so i cant see the changes lol
This commit is contained in:
75
modules/containers/cryptpad/container.nix
Normal file
75
modules/containers/cryptpad/container.nix
Normal file
@@ -0,0 +1,75 @@
|
||||
{moduleWithSystem, ...}: {
|
||||
flake.nixosModules.containerCryptpad = moduleWithSystem ({pkgs, ...}: {
|
||||
virtualisation.oci-containers.containers."cryptpad-cryptpad" = {
|
||||
image = "cryptpad/cryptpad:latest";
|
||||
environment = {
|
||||
"CPAD_CONF" = "/cryptpad/config/config.js";
|
||||
"CPAD_INSTALL_ONLYOFFICE" = "yes";
|
||||
"CPAD_MAIN_DOMAIN" = "https://office.voidarc.co.uk";
|
||||
"CPAD_SANDBOX_DOMAIN" = "https://word.voidarc.co.uk";
|
||||
};
|
||||
volumes = [
|
||||
"/containers/cryptpad/config/config.example.js:/cryptpad/config/config.js:rw"
|
||||
"/containers/cryptpad/customize:/cryptpad/customize:rw"
|
||||
"/containers/cryptpad/data/blob:/cryptpad/blob:rw"
|
||||
"/containers/cryptpad/data/block:/cryptpad/block:rw"
|
||||
"/containers/cryptpad/data/data:/cryptpad/data:rw"
|
||||
"/containers/cryptpad/data/files:/cryptpad/datastore:rw"
|
||||
"/containers/cryptpad/onlyoffice-conf:/cryptpad/onlyoffice-conf:rw"
|
||||
"/containers/cryptpad/onlyoffice-dist:/cryptpad/www/common/onlyoffice/dist:rw"
|
||||
];
|
||||
ports = [
|
||||
"3000:3000/tcp"
|
||||
"3003:3003/tcp"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--hostname=cryptpad"
|
||||
"--network-alias=cryptpad"
|
||||
"--network=cryptpad_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-cryptpad-cryptpad" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-cryptpad_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-cryptpad_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-cryptpad-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-cryptpad-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-cryptpad_default" = {
|
||||
path = [pkgs.podman];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f cryptpad_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect cryptpad_default || podman network create cryptpad_default
|
||||
'';
|
||||
partOf = ["podman-compose-cryptpad-root.target"];
|
||||
wantedBy = ["podman-compose-cryptpad-root.target"];
|
||||
};
|
||||
|
||||
# Root service
|
||||
# When started, this will automatically create all resources and start
|
||||
# the containers. When stopped, this will teardown all resources.
|
||||
systemd.targets."podman-compose-cryptpad-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user