1{ lib
2, buildGoModule
3, fetchFromGitHub
4, installShellFiles
5, asciidoc
6, databasePath ? "/etc/secureboot"
7}:
8
9buildGoModule rec {
10 pname = "sbctl";
11 version = "0.12";
12
13 src = fetchFromGitHub {
14 owner = "Foxboron";
15 repo = pname;
16 rev = version;
17 hash = "sha256-1dA+a8GS4teaLmclatJNKt+OjhabLO4j/+p4Q95yG/s=";
18 };
19
20 vendorHash = "sha256-kVXzHTONPCE1UeAnUiULjubJeZFD0DAxIk+w8/Dqs6c=";
21
22 ldflags = [ "-s" "-w" "-X github.com/foxboron/sbctl.DatabasePath=${databasePath}" ];
23
24 nativeBuildInputs = [ installShellFiles asciidoc ];
25
26 postBuild = ''
27 make docs/sbctl.8
28 '';
29
30 postInstall = ''
31 installManPage docs/sbctl.8
32
33 installShellCompletion --cmd sbctl \
34 --bash <($out/bin/sbctl completion bash) \
35 --fish <($out/bin/sbctl completion fish) \
36 --zsh <($out/bin/sbctl completion zsh)
37 '';
38
39 meta = with lib; {
40 description = "Secure Boot key manager";
41 homepage = "https://github.com/Foxboron/sbctl";
42 license = licenses.mit;
43 maintainers = with maintainers; [ raitobezarius ];
44 # go-uefi do not support darwin at the moment:
45 # see upstream on https://github.com/Foxboron/go-uefi/issues/13
46 platforms = platforms.linux;
47 };
48}