nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 coreutils,
6 cryptsetup,
7 mount,
8 systemd,
9 umount,
10}:
11
12buildGoModule rec {
13 pname = "interlock";
14 version = "2020.03.05";
15
16 src = fetchFromGitHub {
17 owner = "usbarmory";
18 repo = "interlock";
19 rev = "v${version}";
20 sha256 = "sha256-YXa4vErt3YnomTKAXCv8yUVhcc0ST47n9waW5E8QZzY=";
21 };
22
23 vendorHash = "sha256-OL6I95IpyTIc8wCwD9nWxVUTrmZH6COhsd/YwNTyvN0=";
24
25 ldflags = [
26 "-s"
27 "-w"
28 ];
29
30 postPatch = ''
31 grep -lr '/s\?bin/' | xargs sed -i \
32 -e 's|/bin/mount|${mount}/bin/mount|' \
33 -e 's|/bin/umount|${umount}/bin/umount|' \
34 -e 's|/bin/cp|${coreutils}/bin/cp|' \
35 -e 's|/bin/mv|${coreutils}/bin/mv|' \
36 -e 's|/bin/chown|${coreutils}/bin/chown|' \
37 -e 's|/bin/date|${coreutils}/bin/date|' \
38 -e 's|/sbin/poweroff|${systemd}/sbin/poweroff|' \
39 -e 's|/usr/bin/sudo|/run/wrappers/bin/sudo|' \
40 -e 's|/sbin/cryptsetup|${cryptsetup}/bin/cryptsetup|'
41 '';
42
43 postInstall = ''
44 mkdir -p $out/share
45 cp -R $src/static $out/share
46 '';
47
48 # Tests are broken due to an error during key generation.
49 doCheck = false;
50
51 meta = {
52 homepage = "https://github.com/usbarmory/interlock";
53 description = "File encryption tool and an HSM frontend";
54 mainProgram = "interlock";
55 license = lib.licenses.gpl3Plus;
56 platforms = lib.platforms.linux;
57 };
58}