2020-04-24 23:36:52 +00:00
|
|
|
{stdenv
|
|
|
|
, lib
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchurl
|
2020-11-24 20:58:05 +00:00
|
|
|
, util-linux
|
2020-08-20 17:08:02 +00:00
|
|
|
, gpgme
|
2020-04-24 23:36:52 +00:00
|
|
|
, openssl
|
2020-08-20 17:08:02 +00:00
|
|
|
, libuuid
|
2020-04-24 23:36:52 +00:00
|
|
|
, coreutils
|
|
|
|
, go
|
|
|
|
, which
|
|
|
|
, makeWrapper
|
2020-08-20 17:08:02 +00:00
|
|
|
, cryptsetup
|
2020-04-24 23:36:52 +00:00
|
|
|
, squashfsTools
|
|
|
|
, buildGoPackage}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
buildGoPackage rec {
|
|
|
|
pname = "singularity";
|
2020-11-30 08:33:03 +00:00
|
|
|
version = "3.7.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/hpcng/singularity/releases/download/v${version}/singularity-${version}.tar.gz";
|
2020-11-30 08:33:03 +00:00
|
|
|
sha256 = "0y6lm23g6a2ljm78w8iyak7yivxvpj3i55fjbd56m9b2ykssm5pv";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
goPackagePath = "github.com/sylabs/singularity";
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
buildInputs = [ gpgme openssl libuuid ];
|
2020-11-24 20:58:05 +00:00
|
|
|
nativeBuildInputs = [ util-linux which makeWrapper cryptsetup ];
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [ coreutils squashfsTools ];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace internal/pkg/build/files/copy.go \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace /bin/cp ${coreutils}/bin/cp
|
|
|
|
'';
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
cd go/src/github.com/sylabs/singularity
|
|
|
|
|
|
|
|
patchShebangs .
|
|
|
|
sed -i 's|defaultPath := "[^"]*"|defaultPath := "${stdenv.lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
./mconfig -V ${version} -p $out --localstatedir=/var
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Don't install SUID binaries
|
|
|
|
sed -i 's/-m 4755/-m 755/g' builddir/Makefile
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2020-08-20 17:08:02 +00:00
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
make -C builddir
|
2020-08-20 17:08:02 +00:00
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2020-08-20 17:08:02 +00:00
|
|
|
runHook preInstall
|
2020-05-15 21:57:56 +00:00
|
|
|
make -C builddir install LOCALSTATEDIR=$out/var
|
|
|
|
chmod 755 $out/libexec/singularity/bin/starter-suid
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
# Explicitly configure paths in the config file
|
|
|
|
sed -i 's|^# mksquashfs path =.*$|mksquashfs path = ${stdenv.lib.makeBinPath [squashfsTools]}/mksquashfs|' $out/etc/singularity/singularity.conf
|
|
|
|
sed -i 's|^# cryptsetup path =.*$|cryptsetup path = ${stdenv.lib.makeBinPath [cryptsetup]}/cryptsetup|' $out/etc/singularity/singularity.conf
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "http://www.sylabs.io/";
|
|
|
|
description = "Application containers for linux";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.jbedo ];
|
|
|
|
};
|
|
|
|
}
|