4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
76 lines
1.9 KiB
Nix
76 lines
1.9 KiB
Nix
{stdenv
|
|
, lib
|
|
, fetchurl
|
|
, util-linux
|
|
, gpgme
|
|
, openssl
|
|
, libuuid
|
|
, coreutils
|
|
, go
|
|
, which
|
|
, makeWrapper
|
|
, cryptsetup
|
|
, squashfsTools
|
|
, buildGoPackage}:
|
|
|
|
with lib;
|
|
|
|
buildGoPackage rec {
|
|
pname = "singularity";
|
|
version = "3.7.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/hpcng/singularity/releases/download/v${version}/singularity-${version}.tar.gz";
|
|
sha256 = "0y6lm23g6a2ljm78w8iyak7yivxvpj3i55fjbd56m9b2ykssm5pv";
|
|
};
|
|
|
|
goPackagePath = "github.com/sylabs/singularity";
|
|
|
|
buildInputs = [ gpgme openssl libuuid ];
|
|
nativeBuildInputs = [ util-linux which makeWrapper cryptsetup ];
|
|
propagatedBuildInputs = [ coreutils squashfsTools ];
|
|
|
|
postPatch = ''
|
|
substituteInPlace internal/pkg/build/files/copy.go \
|
|
--replace /bin/cp ${coreutils}/bin/cp
|
|
'';
|
|
|
|
postConfigure = ''
|
|
cd go/src/github.com/sylabs/singularity
|
|
|
|
patchShebangs .
|
|
sed -i 's|defaultPath := "[^"]*"|defaultPath := "${stdenv.lib.makeBinPath propagatedBuildInputs}"|' cmd/internal/cli/actions.go
|
|
|
|
./mconfig -V ${version} -p $out --localstatedir=/var
|
|
|
|
# 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
|
|
|
|
# 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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "http://www.sylabs.io/";
|
|
description = "Application containers for linux";
|
|
license = licenses.bsd3;
|
|
platforms = platforms.linux;
|
|
maintainers = [ maintainers.jbedo ];
|
|
};
|
|
}
|