nixpkgs/pkgs/applications/virtualization/singularity/default.nix

72 lines
1.7 KiB
Nix
Raw Normal View History

2018-11-01 00:21:02 +00:00
{stdenv
, removeReferencesTo
, lib
2016-11-14 01:26:59 +00:00
, fetchFromGitHub
2018-11-01 00:21:02 +00:00
, utillinux
, openssl
2017-11-07 03:47:20 +00:00
, coreutils
2018-11-01 00:21:02 +00:00
, go
, which
2017-11-07 03:47:20 +00:00
, makeWrapper
, squashfsTools
2018-11-01 00:21:02 +00:00
, buildGoPackage}:
with lib;
2016-11-14 01:26:59 +00:00
2018-11-01 00:21:02 +00:00
buildGoPackage rec {
2016-11-14 01:26:59 +00:00
name = "singularity-${version}";
2019-06-18 03:05:42 +01:00
version = "3.2.1";
2018-11-01 00:21:02 +00:00
src = fetchFromGitHub {
owner = "sylabs";
repo = "singularity";
rev = "v${version}";
2019-06-18 03:05:42 +01:00
sha256 = "14lhxwy21s7q081x7kbnvkjsbxgsg2f181qlzmlxcn6n7gfav3kj";
2018-11-01 00:21:02 +00:00
};
goPackagePath = "github.com/sylabs/singularity";
goDeps = ./deps.nix;
buildInputs = [ openssl ];
nativeBuildInputs = [ removeReferencesTo utillinux which makeWrapper ];
propagatedBuildInputs = [ coreutils squashfsTools ];
2017-11-07 03:47:20 +00:00
2018-11-01 00:21:02 +00:00
postConfigure = ''
cd go/src/github.com/sylabs/singularity
2017-11-07 03:47:20 +00:00
patchShebangs .
2019-06-18 03:05:42 +01:00
sed -i 's|defaultPath := "[^"]*"|defaultPath := "${stdenv.lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go
2018-11-01 00:21:02 +00:00
./mconfig -V ${version} -p $bin --localstatedir=/var
# Don't install SUID binaries
sed -i 's/-m 4755/-m 755/g' builddir/Makefile
2017-11-07 03:47:20 +00:00
'';
2018-11-01 00:21:02 +00:00
buildPhase = ''
make -C builddir
2017-11-07 03:47:20 +00:00
'';
2016-11-14 01:26:59 +00:00
2018-11-01 00:21:02 +00:00
installPhase = ''
make -C builddir install LOCALSTATEDIR=$bin/var
chmod 755 $bin/libexec/singularity/bin/starter-suid
2019-06-18 03:05:42 +01:00
wrapProgram $bin/bin/singularity --prefix PATH : ${stdenv.lib.makeBinPath propagatedBuildInputs}
2018-11-01 00:21:02 +00:00
'';
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/
'';
2016-11-14 01:26:59 +00:00
meta = with stdenv.lib; {
2018-11-01 00:21:02 +00:00
homepage = http://www.sylabs.io/;
description = "Application containers for linux";
license = licenses.bsd3;
2016-11-14 01:26:59 +00:00
platforms = platforms.linux;
maintainers = [ maintainers.jbedo ];
};
}