From 1f32cee4d41d5602efa74600a6d1146887494bd7 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li <44064051+ShamrockLee@users.noreply.github.com> Date: Wed, 5 Apr 2023 02:33:52 +0800 Subject: [PATCH] apptainer, singularity: add passthru.tests.image-hello-cowsay Add image-building tests with singularity-tools --- .../virtualization/singularity/generic.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/virtualization/singularity/generic.nix b/pkgs/applications/virtualization/singularity/generic.nix index 5312dbdda0ff..3ef3d2bbf9b6 100644 --- a/pkgs/applications/virtualization/singularity/generic.nix +++ b/pkgs/applications/virtualization/singularity/generic.nix @@ -46,6 +46,10 @@ in , openssl , squashfsTools , squashfuse + # Test dependencies +, singularity-tools +, cowsay +, hello # Overridable configurations , enableNvidiaContainerCli ? true # Compile with seccomp support @@ -83,7 +87,7 @@ let ln -s ${lib.escapeShellArg newgidmapPath} "$out/bin/newgidmap" ''); in -buildGoModule { +(buildGoModule { inherit pname version src; # Override vendorHash with the output got from @@ -235,4 +239,14 @@ buildGoModule { maintainers = with maintainers; [ jbedo ShamrockLee ]; mainProgram = projectName; } // extraMeta; -} +}).overrideAttrs (finalAttrs: prevAttrs: { + passthru = prevAttrs.passthru or { } // { + tests = { + image-hello-cowsay = singularity-tools.buildImage { + name = "hello-cowsay"; + contents = [ hello cowsay ]; + singularity = finalAttrs.finalPackage; + }; + }; + }; +})