2025-03-10 00:02:05 -04:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2023-12-22 10:54:18 +10:30
|
|
|
{
|
2025-01-31 21:24:47 +01:00
|
|
|
imports = [ ./podman-stubs.nix ];
|
|
|
|
|
2023-12-22 10:54:18 +10:30
|
|
|
services.podman = {
|
|
|
|
enable = true;
|
2025-03-10 00:02:05 -04:00
|
|
|
builds."my-bld" = {
|
|
|
|
file = let
|
|
|
|
containerFile = pkgs.writeTextFile {
|
|
|
|
name = "Containerfile";
|
|
|
|
text = ''
|
|
|
|
FROM docker.io/alpine:latest
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in "${containerFile}";
|
|
|
|
};
|
|
|
|
containers = {
|
|
|
|
"my-container" = {
|
|
|
|
image = "my-img";
|
|
|
|
network = [ "my-net" "externalnet" ];
|
|
|
|
volumes = [ "my-vol:/data" ];
|
|
|
|
};
|
|
|
|
"my-container-bld" = { image = "my-bld"; };
|
2023-12-22 10:54:18 +10:30
|
|
|
};
|
2025-03-10 00:02:05 -04:00
|
|
|
images."my-img" = { image = "docker.io/alpine:latest"; };
|
2023-12-22 10:54:18 +10:30
|
|
|
networks."my-net" = {
|
|
|
|
gateway = "192.168.123.1";
|
|
|
|
subnet = "192.168.123.0/24";
|
|
|
|
};
|
2025-03-10 00:02:05 -04:00
|
|
|
volumes."my-vol" = {
|
|
|
|
device = "tmpfs";
|
|
|
|
preserve = false;
|
|
|
|
type = "tmpfs";
|
|
|
|
};
|
2023-12-22 10:54:18 +10:30
|
|
|
};
|
|
|
|
|
|
|
|
nmt.script = ''
|
|
|
|
configPath=home-files/.config/systemd/user
|
2025-03-10 00:02:05 -04:00
|
|
|
buildFile=$configPath/podman-my-bld-build.service
|
2023-12-22 10:54:18 +10:30
|
|
|
containerFile=$configPath/podman-my-container.service
|
2025-03-10 00:02:05 -04:00
|
|
|
containerBldFile=$configPath/podman-my-container-bld.service
|
|
|
|
imageFile=$configPath/podman-my-img-image.service
|
2023-12-22 10:54:18 +10:30
|
|
|
networkFile=$configPath/podman-my-net-network.service
|
2025-03-10 00:02:05 -04:00
|
|
|
volumeFile=$configPath/podman-my-vol-volume.service
|
|
|
|
assertFileExists $buildFile
|
2023-12-22 10:54:18 +10:30
|
|
|
assertFileExists $containerFile
|
2025-03-10 00:02:05 -04:00
|
|
|
assertFileExists $containerBldFile
|
|
|
|
assertFileExists $imageFile
|
2023-12-22 10:54:18 +10:30
|
|
|
assertFileExists $networkFile
|
2025-03-10 00:02:05 -04:00
|
|
|
assertFileExists $volumeFile
|
2023-12-22 10:54:18 +10:30
|
|
|
|
2025-03-10 00:02:05 -04:00
|
|
|
buildFile=$(normalizeStorePaths $buildFile)
|
2023-12-22 10:54:18 +10:30
|
|
|
containerFile=$(normalizeStorePaths $containerFile)
|
2025-03-10 00:02:05 -04:00
|
|
|
containerBldFile=$(normalizeStorePaths $containerBldFile)
|
|
|
|
imageFile=$(normalizeStorePaths $imageFile)
|
2023-12-22 10:54:18 +10:30
|
|
|
networkFile=$(normalizeStorePaths $networkFile)
|
2025-03-10 00:02:05 -04:00
|
|
|
volumeFile=$(normalizeStorePaths $volumeFile)
|
2023-12-22 10:54:18 +10:30
|
|
|
|
2025-03-10 00:02:05 -04:00
|
|
|
assertFileContent $buildFile ${./integration-build-expected.service}
|
2023-12-22 10:54:18 +10:30
|
|
|
assertFileContent $containerFile ${./integration-container-expected.service}
|
2025-03-10 00:02:05 -04:00
|
|
|
assertFileContent $containerBldFile ${
|
|
|
|
./integration-container-bld-expected.service
|
|
|
|
}
|
|
|
|
assertFileContent $imageFile ${./integration-image-expected.service}
|
2023-12-22 10:54:18 +10:30
|
|
|
assertFileContent $networkFile ${./integration-network-expected.service}
|
2025-03-10 00:02:05 -04:00
|
|
|
assertFileContent $volumeFile ${./integration-volume-expected.service}
|
2023-12-22 10:54:18 +10:30
|
|
|
'';
|
|
|
|
}
|