2021-02-05 17:12:51 +00:00
|
|
|
{ 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
|
|
|
|
, 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";
|
2021-04-13 19:44:15 +00:00
|
|
|
version = "3.7.3";
|
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";
|
2021-04-13 19:44:15 +00:00
|
|
|
sha256 = "sha256-ZmfriHXStm1zUE9AyVa0KxNRdE9IjRZCBDdiFdiF2lw=";
|
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 .
|
2021-01-15 22:18:51 +00:00
|
|
|
sed -i 's|defaultPath := "[^"]*"|defaultPath := "${lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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
|
2021-01-15 22:18:51 +00:00
|
|
|
sed -i 's|^# mksquashfs path =.*$|mksquashfs path = ${lib.makeBinPath [squashfsTools]}/mksquashfs|' $out/etc/singularity/singularity.conf
|
|
|
|
sed -i 's|^# cryptsetup path =.*$|cryptsetup path = ${lib.makeBinPath [cryptsetup]}/cryptsetup|' $out/etc/singularity/singularity.conf
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.sylabs.io/";
|
|
|
|
description = "Application containers for linux";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.jbedo ];
|
|
|
|
};
|
|
|
|
}
|