summary refs log tree commit diff
path: root/pkgs/servers/interlock/default.nix
blob: a0b59d332a3f3ebb95ad7aced281140dabbaa64e (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
{ stdenv, lib, sudo, utillinux, coreutils, systemd, cryptsetup,
  buildGoPackage, fetchFromGitHub }:

buildGoPackage rec {
  name = "interlock-${version}";
  version = "2016.04.13";
  rev = "v${version}";

  goPackagePath = "github.com/inversepath/interlock";

  subPackages = [ "./cmd/interlock" ];

  src = fetchFromGitHub {
    inherit rev;
    owner = "inversepath";
    repo = "interlock";
    sha256 = "06aqx3jy744yx29xyg8ips0dw16186hfqbxdv3hfrmwxmaxhl4lz";
  };

  goDeps = ./deps.nix;

  nativeBuildInputs = [ sudo ];
  buildFlags = [ "-tags textsecure" ];
  postPatch = ''
    grep -lr '/s\?bin/' | xargs sed -i \
      -e 's|/bin/mount|${utillinux}/bin/mount|' \
      -e 's|/bin/umount|${utillinux}/bin/umount|' \
      -e 's|/bin/cp|${coreutils}/bin/cp|' \
      -e 's|/bin/mv|${coreutils}/bin/mv|' \
      -e 's|/bin/chown|${coreutils}/bin/chown|' \
      -e 's|/bin/date|${coreutils}/bin/date|' \
      -e 's|/sbin/poweroff|${systemd}/sbin/poweroff|' \
      -e 's|/usr/bin/sudo|/run/wrappers/bin/sudo|' \
      -e 's|/sbin/cryptsetup|${cryptsetup}/bin/cryptsetup|'
  '';
}