at 22.05-pre 73 lines 2.0 kB view raw
1{ lib 2, fetchurl 3, util-linux 4, gpgme 5, openssl 6, libuuid 7, coreutils 8, which 9, makeWrapper 10, cryptsetup 11, squashfsTools 12, buildGoPackage}: 13 14with lib; 15 16buildGoPackage rec { 17 pname = "singularity"; 18 version = "3.8.4"; 19 20 src = fetchurl { 21 url = "https://github.com/hpcng/singularity/releases/download/v${version}/singularity-${version}.tar.gz"; 22 sha256 = "sha256-y5Xm1osNIPK4fWDyOjv3B7fT6HzuDdSqQ4D49IGlfrw="; 23 }; 24 25 goPackagePath = "github.com/sylabs/singularity"; 26 27 buildInputs = [ gpgme openssl libuuid ]; 28 nativeBuildInputs = [ util-linux which makeWrapper cryptsetup ]; 29 propagatedBuildInputs = [ coreutils squashfsTools ]; 30 31 postPatch = '' 32 substituteInPlace internal/pkg/build/files/copy.go \ 33 --replace /bin/cp ${coreutils}/bin/cp 34 ''; 35 36 postConfigure = '' 37 cd go/src/github.com/sylabs/singularity 38 39 patchShebangs . 40 sed -i 's|defaultPath := "[^"]*"|defaultPath := "${lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go 41 42 ./mconfig -V ${version} -p $out --localstatedir=/var 43 44 # Don't install SUID binaries 45 sed -i 's/-m 4755/-m 755/g' builddir/Makefile 46 ''; 47 48 buildPhase = '' 49 runHook preBuild 50 make -C builddir 51 runHook postBuild 52 ''; 53 54 installPhase = '' 55 runHook preInstall 56 make -C builddir install LOCALSTATEDIR=$out/var 57 chmod 755 $out/libexec/singularity/bin/starter-suid 58 59 # Explicitly configure paths in the config file 60 sed -i 's|^# mksquashfs path =.*$|mksquashfs path = ${lib.makeBinPath [squashfsTools]}/mksquashfs|' $out/etc/singularity/singularity.conf 61 sed -i 's|^# cryptsetup path =.*$|cryptsetup path = ${lib.makeBinPath [cryptsetup]}/cryptsetup|' $out/etc/singularity/singularity.conf 62 63 runHook postInstall 64 ''; 65 66 meta = with lib; { 67 homepage = "http://www.sylabs.io/"; 68 description = "Application containers for linux"; 69 license = licenses.bsd3; 70 platforms = platforms.linux; 71 maintainers = [ maintainers.jbedo ]; 72 }; 73}