summary refs log tree commit diff
path: root/pkgs/os-specific/solo5/default.nix
blob: 828b55fbba2fcb6e27c42328dc735f6dd123906d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ lib, stdenv, fetchurl, pkg-config, libseccomp }:

let version = "0.6.7";
in stdenv.mkDerivation {
  pname = "solo5";
  inherit version;

  nativeBuildInputs = [ pkg-config ];
  buildInputs = lib.optional (stdenv.hostPlatform.isLinux) libseccomp;

  src = fetchurl {
    url =
      "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
    sha256 = "05k9adg3440zk5baa6ry8z5dj8d8r8hvzafh2469pdgcnr6h45gr";
  };

  hardeningEnable = [ "pie" ];

  configurePhase = ''
    runHook preConfigure
    sh configure.sh
    runHook postConfigure
  '';

  enableParallelBuilding = true;

  installPhase = ''
    runHook preInstall
    export DESTDIR=$out
    export PREFIX=$out
    make install-tools
    ${lib.optionalString stdenv.hostPlatform.isLinux "make ${
      (lib.concatMapStringsSep " " (x: "install-opam-${x}") [ "hvt" "spt" ])
    }"}
    runHook postInstall
  '';

  doCheck = true;
  checkPhase = if stdenv.hostPlatform.isLinux then
    ''
    patchShebangs tests
    ./tests/bats-core/bats ./tests/tests.bats
    ''
  else
    null;

  meta = with lib; {
    description = "Sandboxed execution environment";
    homepage = "https://github.com/solo5/solo5";
    license = licenses.isc;
    maintainers = [ maintainers.ehmry ];
    platforms = lib.crossLists (arch: os: "${arch}-${os}") [
      [ "aarch64" "x86_64" ]
      [ "freebsd" "genode" "linux" "openbsd" ]
    ];
  };

}