about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/podman/default.nix
blob: a96dcb330a7cfd44e78a9a555a9c653b8b178b9b (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
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, pkgconfig
, go, gpgme, lvm2, btrfs-progs, libseccomp
}:

with lib;

stdenv.mkDerivation rec {
  name = "podman-${version}";
  version = "0.11.1.1";
  src = fetchFromGitHub {
    owner = "containers";
    repo = "libpod";
    rev = "v${version}";
    sha256 = "18r7jasaf18cbraf5v2fl96hs47d3ivjq82pivw9knbwafsscg64";
  };
  
  # Optimizations break compilation of libseccomp c bindings
  hardeningDisable = [ "fortify" ];
  nativeBuildInputs = [ pkgconfig removeReferencesTo ];
  
  buildInputs = [
    go btrfs-progs libseccomp gpgme lvm2
  ];

  patches = [ ./0001-No-need-to-use-i-in-go-build-with-go-1.10-and-above.patch ];

  buildPhase = ''
    patchShebangs .
    mkdir -p .gopath/src/github.com/containers
    ln -sf $PWD .gopath/src/github.com/containers/libpod
    ln -sf $PWD/vendor/github.com/varlink .gopath/src/github.com/varlink
    export GOPATH="$PWD/.gopath:$GOPATH"
    make binaries
  '';
  
  installPhase = ''
    install -Dm555 bin/podman $out/bin/podman
  '';
  
  preFixup = ''
    find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} -t ${stdenv.glibc.dev} '{}' +
  '';

  meta = {
    homepage = https://podman.io/;
    description = "A program for managing pods, containers and container images";
    license = licenses.asl20;
    maintainers = with maintainers; [ vdemeester ];
    platforms = platforms.linux;
  };
}