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,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
# Runtime
|
# Enable container name DNS for non-default Docker networks.
|
||||||
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.
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/226365
|
# 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
|
# Containers
|
||||||
virtualisation.oci-containers.containers."spaceclient-jank" = {
|
virtualisation.oci-containers.containers."spaceclient-jank" = {
|
||||||
image = "localhost/compose2nix/spaceclient-jank";
|
image = "docker.io/compose2nix/spaceclient-jank";
|
||||||
ports = [
|
ports = [
|
||||||
"9780:8080/tcp"
|
"9780:8080/tcp"
|
||||||
];
|
];
|
||||||
|
@ -33,56 +22,56 @@
|
||||||
"--network=spaceclient_default"
|
"--network=spaceclient_default"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
systemd.services."podman-spaceclient-jank" = {
|
systemd.services."docker-spaceclient-jank" = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = lib.mkOverride 90 "always";
|
Restart = lib.mkOverride 90 "always";
|
||||||
};
|
};
|
||||||
after = [
|
after = [
|
||||||
"podman-network-spaceclient_default.service"
|
"docker-network-spaceclient_default.service"
|
||||||
];
|
];
|
||||||
requires = [
|
requires = [
|
||||||
"podman-network-spaceclient_default.service"
|
"docker-network-spaceclient_default.service"
|
||||||
];
|
];
|
||||||
partOf = [
|
partOf = [
|
||||||
"podman-compose-spaceclient-root.target"
|
"docker-compose-spaceclient-root.target"
|
||||||
];
|
];
|
||||||
wantedBy = [
|
wantedBy = [
|
||||||
"podman-compose-spaceclient-root.target"
|
"docker-compose-spaceclient-root.target"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Networks
|
# Networks
|
||||||
systemd.services."podman-network-spaceclient_default" = {
|
systemd.services."docker-network-spaceclient_default" = {
|
||||||
path = [pkgs.podman];
|
path = [pkgs.docker];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
ExecStop = "podman network rm -f spaceclient_default";
|
ExecStop = "docker network rm -f spaceclient_default";
|
||||||
};
|
};
|
||||||
script = ''
|
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"];
|
partOf = ["docker-compose-spaceclient-root.target"];
|
||||||
wantedBy = ["podman-compose-spaceclient-root.target"];
|
wantedBy = ["docker-compose-spaceclient-root.target"];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Builds
|
# Builds
|
||||||
systemd.services."podman-build-spaceclient-jank" = {
|
systemd.services."docker-build-spaceclient-jank" = {
|
||||||
path = [pkgs.podman pkgs.git];
|
path = [pkgs.docker pkgs.git];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
TimeoutSec = 300;
|
TimeoutSec = 300;
|
||||||
};
|
};
|
||||||
script = ''
|
script = ''
|
||||||
cd /home/mtgmonkey/spaceclient
|
cd /home/mtgmonkey/spaceclient
|
||||||
podman build -t compose2nix/spaceclient-jank .
|
docker build -t compose2nix/spaceclient-jank .
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# Root service
|
# Root service
|
||||||
# When started, this will automatically create all resources and start
|
# When started, this will automatically create all resources and start
|
||||||
# the containers. When stopped, this will teardown all resources.
|
# the containers. When stopped, this will teardown all resources.
|
||||||
systemd.targets."podman-compose-spaceclient-root" = {
|
systemd.targets."docker-compose-spaceclient-root" = {
|
||||||
unitConfig = {
|
unitConfig = {
|
||||||
Description = "Root target generated by compose2nix.";
|
Description = "Root target generated by compose2nix.";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue