Skip to content

Commit

Permalink
singularity: 3.2.1 -> 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedo authored and ehmry committed Aug 2, 2020
1 parent ea0b3dd commit 6967dc3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
41 changes: 23 additions & 18 deletions pkgs/applications/virtualization/singularity/default.nix
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
{stdenv
, removeReferencesTo
, lib
, fetchFromGitHub
, fetchurl
, utillinux
, gpgme
, openssl
, libuuid
, coreutils
, go
, which
, makeWrapper
, cryptsetup
, squashfsTools
, buildGoPackage}:

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 ];
nativeBuildInputs = [ removeReferencesTo utillinux 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
'';

Expand All @@ -46,28 +47,32 @@ 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=$bin/var
chmod 755 $bin/libexec/singularity/bin/starter-suid
wrapProgram $bin/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|' $bin/etc/singularity/singularity.conf
sed -i 's|^# cryptsetup path =.*$|cryptsetup path = ${stdenv.lib.makeBinPath [cryptsetup]}/cryptsetup|' $bin/etc/singularity/singularity.conf
runHook postInstall
'';

postFixup = ''
find $bin/ -type f -executable -exec remove-references-to -t ${go} '{}' + || true
# These etc scripts shouldn't have their paths patched
cp etc/actions/* $bin/etc/singularity/actions/
find $bin/libexec/ -type f -executable -exec remove-references-to -t ${go} '{}' + || true
'';

meta = with stdenv.lib; {
homepage = http://www.sylabs.io/;
homepage = "http://www.sylabs.io/";
description = "Application containers for linux";
license = licenses.bsd3;
platforms = platforms.linux;
Expand Down
1 change: 1 addition & 0 deletions pkgs/build-support/singularity-tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'');

Expand Down

0 comments on commit 6967dc3

Please sign in to comment.