summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/virtualization/singularity/default.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-11-01 11:21:02 +1100
committerJustin Bedo <cu@cua0.org>2019-01-31 09:21:18 +1100
commit5611397f336dae7a2f05511e4951a8c76268545f (patch)
tree332ac09652e8feb4708edab4e01aebd243096412 /pkgs/applications/virtualization/singularity/default.nix
parent654f3c467cbb9caf09432ae4ef590ea0783e764c (diff)
singularity: 2.6.0 -> 3.0.1
Diffstat (limited to 'pkgs/applications/virtualization/singularity/default.nix')
-rw-r--r--pkgs/applications/virtualization/singularity/default.nix100
1 files changed, 58 insertions, 42 deletions
diff --git a/pkgs/applications/virtualization/singularity/default.nix b/pkgs/applications/virtualization/singularity/default.nix
index cc543d2e94a1..819d0aed73ed 100644
--- a/pkgs/applications/virtualization/singularity/default.nix
+++ b/pkgs/applications/virtualization/singularity/default.nix
@@ -1,62 +1,78 @@
-{ stdenv
+{stdenv
+, removeReferencesTo
+, lib
+, fetchgit
, fetchFromGitHub
-, autoreconfHook
-, gnutar
-, which
-, gnugrep
+, utillinux
+, openssl
, coreutils
-, python
-, e2fsprogs
+, gawk
+, go
+, which
, makeWrapper
, squashfsTools
-, gzip
-, gnused
-, curl
-, utillinux
-, libarchive
-, file
- }:
+, buildGoPackage}:
+
+with lib;
-stdenv.mkDerivation rec {
+buildGoPackage rec {
name = "singularity-${version}";
- version = "2.6.0";
+ version = "3.0.1";
+
+ src = fetchFromGitHub {
+ owner = "sylabs";
+ repo = "singularity";
+ rev = "v${version}";
+ sha256 = "1wpsd0il2ipa2n5cnbj8dzs095jycdryq2rx62kikbq7ahzz4fsi";
+ };
+
+ goPackagePath = "github.com/sylabs/singularity";
+ goDeps = ./deps.nix;
+
+ buildInputs = [ openssl ];
+ nativeBuildInputs = [ removeReferencesTo utillinux which makeWrapper ];
+ propagatedBuildInputs = [ coreutils squashfsTools ];
- enableParallelBuilding = true;
+ postConfigure = ''
+ find . -name vendor -type d -print0 | xargs -0 rm -rf
- patches = [ ./env.patch ];
+ cd go/src/github.com/sylabs/singularity
- preConfigure = ''
- sed -i 's/-static//g' src/Makefile.am
patchShebangs .
+ sed -i 's|defaultEnv := "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"|defaultEnv := "${stdenv.lib.makeBinPath propagatedBuildInputs}"|' src/cmd/singularity/cli/singularity.go
+
+ ./mconfig -V ${version} -p $bin --localstatedir=/var
+ touch builddir/.dep-done
+ touch builddir/vendors-done
+
+ # Don't install SUID binaries
+ sed -i 's/-m 4755/-m 755/g' builddir/Makefile
+
+ # Point to base gopath
+ sed -i "s|^cni_vendor_GOPATH :=.*\$|cni_vendor_GOPATH := $NIX_BUILD_TOP/go/src/github.com/containernetworking/plugins/plugins|" builddir/Makefile
'';
- configureFlags = [ "--localstatedir=/var" ];
- installFlags = "CONTAINER_MOUNTDIR=dummy CONTAINER_FINALDIR=dummy CONTAINER_OVERLAY=dummy SESSIONDIR=dummy";
-
- fixupPhase = ''
- patchShebangs $out
- for f in $out/libexec/singularity/helpers/help.sh $out/libexec/singularity/cli/*.exec $out/libexec/singularity/bootstrap-scripts/*.sh ; do
- chmod a+x $f
- sed -i 's| /sbin/| |g' $f
- sed -i 's| /bin/bash| ${stdenv.shell}|g' $f
- wrapProgram $f --prefix PATH : ${stdenv.lib.makeBinPath buildInputs}
- done
+ buildPhase = ''
+ make -C builddir
'';
- src = fetchFromGitHub {
- owner = "singularityware";
- repo = "singularity";
- rev = version;
- sha256 = "0bi7acgppbkfbra8r29s1ldq02lazdww0z2h1rfvv8spr8dzzi94";
- };
+ installPhase = ''
+ make -C builddir install LOCALSTATEDIR=$bin/var
+ chmod 755 $bin/libexec/singularity/bin/starter-suid
+ '';
+
+ 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/
+ '';
- nativeBuildInputs = [ autoreconfHook makeWrapper ];
- buildInputs = [ coreutils gnugrep python e2fsprogs which gnutar squashfsTools gzip gnused curl utillinux libarchive file ];
meta = with stdenv.lib; {
- homepage = http://singularity.lbl.gov/;
- description = "Designed around the notion of extreme mobility of compute and reproducible science, Singularity enables users to have full control of their operating system environment";
- license = "BSD license with 2 modifications";
+ homepage = http://www.sylabs.io/;
+ description = "Application containers for linux";
+ license = licenses.bsd3;
platforms = platforms.linux;
maintainers = [ maintainers.jbedo ];
};