2018-11-01 01:21:02 +01:00
|
|
|
{stdenv
|
|
|
|
, lib
|
2020-07-15 14:05:37 +02:00
|
|
|
, fetchurl
|
2020-11-24 16:29:28 +01:00
|
|
|
, util-linux
|
2020-07-15 14:05:37 +02:00
|
|
|
, gpgme
|
2018-11-01 01:21:02 +01:00
|
|
|
, openssl
|
2020-07-15 14:05:37 +02:00
|
|
|
, libuuid
|
2017-11-07 04:47:20 +01:00
|
|
|
, coreutils
|
2018-11-01 01:21:02 +01:00
|
|
|
, go
|
|
|
|
, which
|
2017-11-07 04:47:20 +01:00
|
|
|
, makeWrapper
|
2020-07-15 14:05:37 +02:00
|
|
|
, cryptsetup
|
2017-11-07 04:47:20 +01:00
|
|
|
, squashfsTools
|
2018-11-01 01:21:02 +01:00
|
|
|
, buildGoPackage}:
|
|
|
|
|
|
|
|
with lib;
|
2016-11-14 02:26:59 +01:00
|
|
|
|
2018-11-01 01:21:02 +01:00
|
|
|
buildGoPackage rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "singularity";
|
2020-11-26 21:28:31 +01:00
|
|
|
version = "3.7.0";
|
2018-11-01 01:21:02 +01:00
|
|
|
|
2020-07-15 14:05:37 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/hpcng/singularity/releases/download/v${version}/singularity-${version}.tar.gz";
|
2020-11-26 21:28:31 +01:00
|
|
|
sha256 = "0y6lm23g6a2ljm78w8iyak7yivxvpj3i55fjbd56m9b2ykssm5pv";
|
2018-11-01 01:21:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
goPackagePath = "github.com/sylabs/singularity";
|
|
|
|
|
2020-07-15 14:05:37 +02:00
|
|
|
buildInputs = [ gpgme openssl libuuid ];
|
2020-11-24 16:29:28 +01:00
|
|
|
nativeBuildInputs = [ util-linux which makeWrapper cryptsetup ];
|
2018-11-01 01:21:02 +01:00
|
|
|
propagatedBuildInputs = [ coreutils squashfsTools ];
|
2017-11-07 04:47:20 +01:00
|
|
|
|
2020-07-15 14:05:37 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace internal/pkg/build/files/copy.go \
|
2019-08-25 20:31:17 +02:00
|
|
|
--replace /bin/cp ${coreutils}/bin/cp
|
|
|
|
'';
|
|
|
|
|
2018-11-01 01:21:02 +01:00
|
|
|
postConfigure = ''
|
|
|
|
cd go/src/github.com/sylabs/singularity
|
2017-11-07 04:47:20 +01:00
|
|
|
|
|
|
|
patchShebangs .
|
2021-01-15 06:42:41 +01:00
|
|
|
sed -i 's|defaultPath := "[^"]*"|defaultPath := "${lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go
|
2018-11-01 01:21:02 +01:00
|
|
|
|
2020-04-28 03:50:57 +02:00
|
|
|
./mconfig -V ${version} -p $out --localstatedir=/var
|
2018-11-01 01:21:02 +01:00
|
|
|
|
|
|
|
# Don't install SUID binaries
|
|
|
|
sed -i 's/-m 4755/-m 755/g' builddir/Makefile
|
2017-11-07 04:47:20 +01:00
|
|
|
'';
|
|
|
|
|
2018-11-01 01:21:02 +01:00
|
|
|
buildPhase = ''
|
2020-07-15 14:05:37 +02:00
|
|
|
runHook preBuild
|
2018-11-01 01:21:02 +01:00
|
|
|
make -C builddir
|
2020-07-15 14:05:37 +02:00
|
|
|
runHook postBuild
|
2017-11-07 04:47:20 +01:00
|
|
|
'';
|
2016-11-14 02:26:59 +01:00
|
|
|
|
2018-11-01 01:21:02 +01:00
|
|
|
installPhase = ''
|
2020-07-15 14:05:37 +02:00
|
|
|
runHook preInstall
|
2020-04-28 03:50:57 +02:00
|
|
|
make -C builddir install LOCALSTATEDIR=$out/var
|
|
|
|
chmod 755 $out/libexec/singularity/bin/starter-suid
|
2020-07-15 14:05:37 +02:00
|
|
|
|
|
|
|
# Explicitly configure paths in the config file
|
2021-01-15 06:42:41 +01: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-07-15 14:05:37 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2018-11-01 01:21:02 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.sylabs.io/";
|
2018-11-01 01:21:02 +01:00
|
|
|
description = "Application containers for linux";
|
|
|
|
license = licenses.bsd3;
|
2016-11-14 02:26:59 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.jbedo ];
|
|
|
|
};
|
|
|
|
}
|