1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00

podman: added volume, image, and build quadlets (#6137)

Added support for build, image, and volume quadlets
Resolved test failures due to podman 5.3.0 upgrade
Replaced several instances of pkgs.podman with services.podman.package
This commit is contained in:
bamhm182 2025-03-10 00:02:05 -04:00 committed by GitHub
parent f8bb0ba6de
commit ce9cb2496c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 1000 additions and 54 deletions

View file

@ -1,29 +1,69 @@
{ pkgs, ... }:
{
imports = [ ./podman-stubs.nix ];
services.podman = {
enable = true;
containers."my-container" = {
image = "docker.io/alpine:latest";
network = [ "my-net" "externalnet" ];
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"; };
};
images."my-img" = { image = "docker.io/alpine:latest"; };
networks."my-net" = {
gateway = "192.168.123.1";
subnet = "192.168.123.0/24";
};
volumes."my-vol" = {
device = "tmpfs";
preserve = false;
type = "tmpfs";
};
};
nmt.script = ''
configPath=home-files/.config/systemd/user
buildFile=$configPath/podman-my-bld-build.service
containerFile=$configPath/podman-my-container.service
containerBldFile=$configPath/podman-my-container-bld.service
imageFile=$configPath/podman-my-img-image.service
networkFile=$configPath/podman-my-net-network.service
volumeFile=$configPath/podman-my-vol-volume.service
assertFileExists $buildFile
assertFileExists $containerFile
assertFileExists $containerBldFile
assertFileExists $imageFile
assertFileExists $networkFile
assertFileExists $volumeFile
buildFile=$(normalizeStorePaths $buildFile)
containerFile=$(normalizeStorePaths $containerFile)
containerBldFile=$(normalizeStorePaths $containerBldFile)
imageFile=$(normalizeStorePaths $imageFile)
networkFile=$(normalizeStorePaths $networkFile)
volumeFile=$(normalizeStorePaths $volumeFile)
assertFileContent $buildFile ${./integration-build-expected.service}
assertFileContent $containerFile ${./integration-container-expected.service}
assertFileContent $containerBldFile ${
./integration-container-bld-expected.service
}
assertFileContent $imageFile ${./integration-image-expected.service}
assertFileContent $networkFile ${./integration-network-expected.service}
assertFileContent $volumeFile ${./integration-volume-expected.service}
'';
}