about summary refs log tree commit diff
path: root/pkgs/tools/security/age-plugin-tpm/default.nix
blob: d79f8805c9431a6780d8b9dc96ee335762321a15 (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
{ lib
, buildGoModule
, fetchFromGitHub
, swtpm
}:

buildGoModule {
  pname = "age-plugin-tpm";
  version = "unstable-2023-05-02";

  src = fetchFromGitHub {
    owner = "Foxboron";
    repo = "age-plugin-tpm";
    rev = "c570739b05c067087c44f651efce6890eedc0647";
    hash = "sha256-xlJtyNAYi/6vBWLsjymFLGfr30w80OplwG2xGTEB118=";
  };

  vendorHash = "sha256-S9wSxw0ZMibCOspgGt5vjzFhPL+bZncjTdIX2mkX5vE=";

  postConfigure = ''
    substituteInPlace vendor/github.com/foxboron/swtpm_test/swtpm.go \
      --replace "/usr/share/swtpm/swtpm-create-user-config-files" "${swtpm}/share/swtpm/swtpm-create-user-config-files"
  '';

  nativeCheckInputs = [
    swtpm
  ];

  ldflags = [
    "-s"
    "-w"
  ];

  meta = with lib; {
    description = "TPM 2.0 plugin for age";
    homepage = "https://github.com/Foxboron/age-plugin-tpm";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [ kranzes ];
  };
}