from my phone so i cant see the changes lol
This commit is contained in:
70
modules/containers/copyparty/container.nix
Normal file
70
modules/containers/copyparty/container.nix
Normal file
@@ -0,0 +1,70 @@
|
||||
{moduleWithSystem, ...}: {
|
||||
flake.nixosModules.containerCopyparty = moduleWithSystem ({pkgs, ...}: {
|
||||
virtualisation.oci-containers.containers."copyparty" = {
|
||||
image = "copyparty/ac:latest";
|
||||
environment = {
|
||||
"LD_PRELOAD" = "/usr/lib/libmimalloc-secure.so.NOPE";
|
||||
};
|
||||
volumes = [
|
||||
"/containers/copyparty:/cfg:rw,z"
|
||||
"/mnt/storage:/w:rw,z"
|
||||
];
|
||||
ports = [
|
||||
"8001:3923/tcp"
|
||||
];
|
||||
user = "0:0";
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--health-cmd=wget --spider -q 127.0.0.1:3923/?reset=/._"
|
||||
"--health-interval=1m0s"
|
||||
"--health-retries=5"
|
||||
"--health-start-period=15s"
|
||||
"--health-timeout=2s"
|
||||
"--network-alias=copyparty"
|
||||
"--network=copyparty_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-copyparty" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-copyparty_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-copyparty_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-copyparty-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-copyparty-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-copyparty_default" = {
|
||||
path = [pkgs.podman];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f copyparty_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect copyparty_default || podman network create copyparty_default
|
||||
'';
|
||||
partOf = ["podman-compose-copyparty-root.target"];
|
||||
wantedBy = ["podman-compose-copyparty-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-copyparty-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user