-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
305 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
all: | ||
image: nginx:latest | ||
command: ["ls", "-la"] | ||
entrypoint: | ||
["nginx", "-g", "daemon off;", "-c", "/etc/config/nginx/conf/nginx.conf"] | ||
empty-command: | ||
image: nginx:latest | ||
command: [] | ||
empty-entrypoint: | ||
image: nginx:latest | ||
entrypoint: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ pkgs, lib, ... }: | ||
|
||
{ | ||
# Runtime | ||
virtualisation.docker = { | ||
enable = true; | ||
autoPrune.enable = true; | ||
}; | ||
virtualisation.oci-containers.backend = "docker"; | ||
|
||
# Containers | ||
virtualisation.oci-containers.containers."test-all" = { | ||
image = "nginx:latest"; | ||
cmd = [ "ls" "-la" ]; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--entrypoint=["nginx", "-g", "daemon off;", "-c", "/etc/config/nginx/conf/nginx.conf"]" | ||
"--network-alias=all" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."docker-test-all" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"docker-network-test_default.service" | ||
]; | ||
requires = [ | ||
"docker-network-test_default.service" | ||
]; | ||
}; | ||
virtualisation.oci-containers.containers."test-empty-command" = { | ||
image = "nginx:latest"; | ||
cmd = [ ]; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--network-alias=empty-command" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."docker-test-empty-command" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"docker-network-test_default.service" | ||
]; | ||
requires = [ | ||
"docker-network-test_default.service" | ||
]; | ||
}; | ||
virtualisation.oci-containers.containers."test-empty-entrypoint" = { | ||
image = "nginx:latest"; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--entrypoint=[]" | ||
"--network-alias=empty-entrypoint" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."docker-test-empty-entrypoint" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"docker-network-test_default.service" | ||
]; | ||
requires = [ | ||
"docker-network-test_default.service" | ||
]; | ||
}; | ||
# Networks | ||
systemd.services."docker-network-test_default" = { | ||
path = [ pkgs.docker ]; | ||
serviceConfig = { | ||
Type = "oneshot"; | ||
RemainAfterExit = true; | ||
ExecStop = "docker network rm -f test_default"; | ||
}; | ||
script = '' | ||
docker network inspect test_default || docker network create test_default | ||
''; | ||
partOf = [ "docker-compose-test-root.target" ]; | ||
wantedBy = [ "docker-compose-test-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."docker-compose-test-root" = { | ||
unitConfig = { | ||
Description = "Root target generated by compose2nix."; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ pkgs, 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; | ||
}; | ||
}; | ||
virtualisation.oci-containers.backend = "podman"; | ||
|
||
# Containers | ||
virtualisation.oci-containers.containers."test-all" = { | ||
image = "nginx:latest"; | ||
cmd = [ "ls" "-la" ]; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--entrypoint=["nginx", "-g", "daemon off;", "-c", "/etc/config/nginx/conf/nginx.conf"]" | ||
"--network-alias=all" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."podman-test-all" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"podman-network-test_default.service" | ||
]; | ||
requires = [ | ||
"podman-network-test_default.service" | ||
]; | ||
}; | ||
virtualisation.oci-containers.containers."test-empty-command" = { | ||
image = "nginx:latest"; | ||
cmd = [ ]; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--network-alias=empty-command" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."podman-test-empty-command" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"podman-network-test_default.service" | ||
]; | ||
requires = [ | ||
"podman-network-test_default.service" | ||
]; | ||
}; | ||
virtualisation.oci-containers.containers."test-empty-entrypoint" = { | ||
image = "nginx:latest"; | ||
log-driver = "journald"; | ||
autoStart = false; | ||
extraOptions = [ | ||
"--entrypoint=[]" | ||
"--network-alias=empty-entrypoint" | ||
"--network=test_default" | ||
]; | ||
}; | ||
systemd.services."podman-test-empty-entrypoint" = { | ||
serviceConfig = { | ||
Restart = lib.mkOverride 90 "no"; | ||
}; | ||
after = [ | ||
"podman-network-test_default.service" | ||
]; | ||
requires = [ | ||
"podman-network-test_default.service" | ||
]; | ||
}; | ||
# Networks | ||
systemd.services."podman-network-test_default" = { | ||
path = [ pkgs.podman ]; | ||
serviceConfig = { | ||
Type = "oneshot"; | ||
RemainAfterExit = true; | ||
ExecStop = "podman network rm -f test_default"; | ||
}; | ||
script = '' | ||
podman network inspect test_default || podman network create test_default | ||
''; | ||
partOf = [ "podman-compose-test-root.target" ]; | ||
wantedBy = [ "podman-compose-test-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-test-root" = { | ||
unitConfig = { | ||
Description = "Root target generated by compose2nix."; | ||
}; | ||
}; | ||
} |