Merge pull request #224683 from ShamrockLee/apptainer-update

apptainer: 1.1.5 -> 1.1.7, singularity: 3.10.4 -> 3.11.1 and add test image-hello-cowsay
This commit is contained in:
Justin Bedő 2023-04-19 17:44:34 +10:00 committed by GitHub
commit fbad1e56f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 14 deletions

View File

@ -36,7 +36,9 @@ in
, conmon
, coreutils
, cryptsetup
, e2fsprogs
, fakeroot
, fuse2fs ? e2fsprogs.fuse2fs
, go
, gpgme
, libseccomp
@ -46,6 +48,10 @@ in
, openssl
, squashfsTools
, squashfuse
# Test dependencies
, singularity-tools
, cowsay
, hello
# Overridable configurations
, enableNvidiaContainerCli ? true
# Compile with seccomp support
@ -83,7 +89,7 @@ let
ln -s ${lib.escapeShellArg newgidmapPath} "$out/bin/newgidmap"
'');
in
buildGoModule {
(buildGoModule {
inherit pname version src;
# Override vendorHash with the output got from
@ -113,6 +119,12 @@ buildGoModule {
which
];
# Search inside the project sources
# and see the `control` file of the Debian package from upstream repos
# for build-time dependencies and run-time utilities
# apptainer/apptainer: https://github.com/apptainer/apptainer/blob/main/dist/debian/control
# sylabs/singularity: https://github.com/sylabs/singularity/blob/main/debian/control
buildInputs = [
bash # To patch /bin/sh shebangs.
conmon
@ -120,8 +132,7 @@ buildGoModule {
gpgme
libuuid
openssl
squashfsTools
squashfuse
squashfsTools # Required at build time by SingularityCE
]
++ lib.optional enableNvidiaContainerCli nvidia-docker
++ lib.optional enableSeccomp libseccomp
@ -144,6 +155,8 @@ buildGoModule {
bash
coreutils
cryptsetup # cryptsetup
fakeroot
fuse2fs # Mount ext3 filesystems
go
privileged-un-utils
squashfsTools # mksquashfs unsquashfs # Make / unpack squashfs image
@ -191,10 +204,7 @@ buildGoModule {
substituteInPlace "$out/bin/run-singularity" \
--replace "/usr/bin/env ${projectName}" "$out/bin/${projectName}"
wrapProgram "$out/bin/${projectName}" \
--prefix PATH : "${lib.makeBinPath [
fakeroot
squashfsTools # Singularity (but not Apptainer) expects unsquashfs from the host PATH
]}"
--prefix PATH : "''${defaultPathInputs// /\/bin:}"
# Make changes in the config file
${lib.optionalString enableNvidiaContainerCli ''
substituteInPlace "$out/etc/${projectName}/${projectName}.conf" \
@ -235,4 +245,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;
};
};
};
})

View File

@ -7,20 +7,20 @@ let
apptainer = callPackage
(import ./generic.nix rec {
pname = "apptainer";
version = "1.1.5";
version = "1.1.7";
projectName = "apptainer";
src = fetchFromGitHub {
owner = "apptainer";
repo = "apptainer";
rev = "v${version}";
hash = "sha256-onJkpHJNsO0cQO2m+TmdMuMkuvH178mDhOeX41bYFic=";
hash = "sha256-3F8qwP27IXcnnEYMnLzkCOxQDx7yej6QIZ40Wb5pk34=";
};
# Update by running
# nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).go-modules"
# at the root directory of the Nixpkgs repository
vendorHash = "sha256-tAnh7A8Lw5KtY7hq+sqHMEUlgXvgeeCKKIfRZFoRtug=";
vendorHash = "sha256-PfFubgR/W1WBXIsRO+Kg7hA6ebeAcRiJlTlAZbnl19A=";
extraDescription = " (previously known as Singularity)";
extraMeta.homepage = "https://apptainer.org";
@ -38,20 +38,20 @@ let
singularity = callPackage
(import ./generic.nix rec {
pname = "singularity-ce";
version = "3.10.4";
version = "3.11.1";
projectName = "singularity";
src = fetchFromGitHub {
owner = "sylabs";
repo = "singularity";
rev = "v${version}";
hash = "sha256-bUnQXQVwaVA3Lkw3X9TBWqNBgiPxAVCHnkq0vc+CIsM=";
hash = "sha256-gdgg6VN3Ily+2Remz6dZBhhfWIxyaBa4bIlFcgrA/uY=";
};
# Update by running
# nix-prefetch -E "{ sha256 }: ((import ./. { }).singularity.override { vendorHash = sha256; }).go-modules"
# at the root directory of the Nixpkgs repository
vendorHash = "sha256-K8helLcOuz3E4LzBE9y3pnZqwdwhO/iMPTN1o22ipVg=";
vendorHash = "sha256-mBhlH6LSmcJuc6HbU/3Q9ii7vJkW9jcikBWCl8oeMOk=";
# Do not build conmon from the Git submodule source,
# Use Nixpkgs provided version