about summary refs log tree commit diff
path: root/pkgs/tools/security/age-plugin-tpm/default.nix
blob: 89291096db9b60093e45f41ccdabed07507f61f7 (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 rec {
  pname = "age-plugin-tpm";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "Foxboron";
    repo = "age-plugin-tpm";
    rev = "v${version}";
    hash = "sha256-Gp7n2/+vgQbsm/En6PQ1to/W6lvFam4Wh3LHdCZnafc=";
  };

  vendorHash = "sha256-oZni/n2J0N3ZxNhf+RlUWyWeOFwL4+6KUIk6DQF8YpA=";

  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 (This software is experimental, use it at your own risk)";
    homepage = "https://github.com/Foxboron/age-plugin-tpm";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [ kranzes ];
  };
}