singularity: 3.2.1 -> 3.6.1

This commit is contained in:
Justin Bedo 2020-07-15 22:05:37 +10:00
parent dc1c3f3203
commit 712f1ee9aa
No known key found for this signature in database
GPG Key ID: 2C18202C56C182BD
2 changed files with 22 additions and 16 deletions

View File

@ -1,13 +1,16 @@
{stdenv
, removeReferencesTo
, lib
, fetchFromGitHub
, fetchurl
, utillinux
, gpgme
, openssl
, libuuid
, coreutils
, go
, which
, makeWrapper
, cryptsetup
, squashfsTools
, buildGoPackage}:
@ -15,24 +18,22 @@ with lib;
buildGoPackage rec {
pname = "singularity";
version = "3.2.1";
version = "3.6.1";
src = fetchFromGitHub {
owner = "sylabs";
repo = "singularity";
rev = "v${version}";
sha256 = "14lhxwy21s7q081x7kbnvkjsbxgsg2f181qlzmlxcn6n7gfav3kj";
src = fetchurl {
url = "https://github.com/hpcng/singularity/releases/download/v${version}/singularity-${version}.tar.gz";
sha256 = "070jj6kbiw23sd2p4xhvmyb8gd83imwgisdf18ahkwp7dq85db3c";
};
goPackagePath = "github.com/sylabs/singularity";
goDeps = ./deps.nix;
buildInputs = [ openssl utillinux ];
nativeBuildInputs = [ removeReferencesTo which makeWrapper ];
buildInputs = [ gpgme openssl libuuid ];
nativeBuildInputs = [ removeReferencesTo utillinux which makeWrapper cryptsetup ];
propagatedBuildInputs = [ coreutils squashfsTools ];
prePatch = ''
substituteInPlace internal/pkg/build/copy/copy.go \
postPatch = ''
substituteInPlace internal/pkg/build/files/copy.go \
--replace /bin/cp ${coreutils}/bin/cp
'';
@ -46,24 +47,28 @@ buildGoPackage rec {
# Don't install SUID binaries
sed -i 's/-m 4755/-m 755/g' builddir/Makefile
'';
buildPhase = ''
runHook preBuild
make -C builddir
runHook postBuild
'';
installPhase = ''
runHook preInstall
make -C builddir install LOCALSTATEDIR=$out/var
chmod 755 $out/libexec/singularity/bin/starter-suid
wrapProgram $out/bin/singularity --prefix PATH : ${stdenv.lib.makeBinPath propagatedBuildInputs}
# 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
'';
postFixup = ''
find $out/libexec/ -type f -executable -exec remove-references-to -t ${go} '{}' + || true
# These etc scripts shouldn't have their paths patched
cp etc/actions/* $out/etc/singularity/actions/
'';
meta = with stdenv.lib; {

View File

@ -97,6 +97,7 @@ rec {
cd ..
mkdir -p /var/singularity/mnt/{container,final,overlay,session,source}
echo "root:x:0:0:System administrator:/root:/bin/sh" > /etc/passwd
echo > /etc/resolv.conf
TMPDIR=$(pwd -P) singularity build $out ./img
'');