convert to docker
This commit is contained in:
parent
e8c8d58c0d
commit
6c6007e6d2
1 changed files with 19 additions and 30 deletions
|
@ -4,26 +4,15 @@
|
|||
lib,
|
||||
...
|
||||
}: {
|
||||
# Runtime
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
dockerCompat = true;
|
||||
defaultNetwork.settings = {
|
||||
# Required for container networking to be able to use names.
|
||||
dns_enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable container name DNS for non-default Podman networks.
|
||||
# Enable container name DNS for non-default Docker networks.
|
||||
# https://github.com/NixOS/nixpkgs/issues/226365
|
||||
networking.firewall.interfaces."podman+".allowedUDPPorts = [53];
|
||||
networking.firewall.interfaces."docker+".allowedUDPPorts = [53];
|
||||
|
||||
virtualisation.oci-containers.backend = "podman";
|
||||
virtualisation.oci-containers.backend = "docker";
|
||||
|
||||
# Containers
|
||||
virtualisation.oci-containers.containers."spaceclient-jank" = {
|
||||
image = "localhost/compose2nix/spaceclient-jank";
|
||||
image = "docker.io/compose2nix/spaceclient-jank";
|
||||
ports = [
|
||||
"9780:8080/tcp"
|
||||
];
|
||||
|
@ -33,56 +22,56 @@
|
|||
"--network=spaceclient_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-spaceclient-jank" = {
|
||||
systemd.services."docker-spaceclient-jank" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-spaceclient_default.service"
|
||||
"docker-network-spaceclient_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-spaceclient_default.service"
|
||||
"docker-network-spaceclient_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-spaceclient-root.target"
|
||||
"docker-compose-spaceclient-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-spaceclient-root.target"
|
||||
"docker-compose-spaceclient-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-spaceclient_default" = {
|
||||
path = [pkgs.podman];
|
||||
systemd.services."docker-network-spaceclient_default" = {
|
||||
path = [pkgs.docker];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f spaceclient_default";
|
||||
ExecStop = "docker network rm -f spaceclient_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect spaceclient_default || podman network create spaceclient_default
|
||||
docker network inspect spaceclient_default || docker network create spaceclient_default
|
||||
'';
|
||||
partOf = ["podman-compose-spaceclient-root.target"];
|
||||
wantedBy = ["podman-compose-spaceclient-root.target"];
|
||||
partOf = ["docker-compose-spaceclient-root.target"];
|
||||
wantedBy = ["docker-compose-spaceclient-root.target"];
|
||||
};
|
||||
|
||||
# Builds
|
||||
systemd.services."podman-build-spaceclient-jank" = {
|
||||
path = [pkgs.podman pkgs.git];
|
||||
systemd.services."docker-build-spaceclient-jank" = {
|
||||
path = [pkgs.docker pkgs.git];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
TimeoutSec = 300;
|
||||
};
|
||||
script = ''
|
||||
cd /home/mtgmonkey/spaceclient
|
||||
podman build -t compose2nix/spaceclient-jank .
|
||||
docker build -t compose2nix/spaceclient-jank .
|
||||
'';
|
||||
};
|
||||
|
||||
# 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-spaceclient-root" = {
|
||||
systemd.targets."docker-compose-spaceclient-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue