about summary refs log tree commit diff
path: root/pkgs/applications/networking/dnscontrol
diff options
context:
space:
mode:
authorMészáros Gergely <maetveis@gmail.com>2024-06-05 12:16:33 +0000
committerMészáros Gergely <maetveis@gmail.com>2024-06-05 12:24:34 +0000
commit9aeb7ee0696eebd7daa24d560b425e4598b5c2ed (patch)
treeb93331e1c4f66faded16217b9126e0fbcdc9541d /pkgs/applications/networking/dnscontrol
parent65949ff1c89d3b481f75f1065b21ab605e2498b6 (diff)
dnscontrol: install shell completions
DNSControl has built-in shell completions as described
in [1]. They can be installed on disk and will be loaded by bash-completion
or zsh.

[1]: https://docs.dnscontrol.org/getting-started/getting-started#id-1.1.-shell-completion
Diffstat (limited to 'pkgs/applications/networking/dnscontrol')
-rw-r--r--pkgs/applications/networking/dnscontrol/default.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/applications/networking/dnscontrol/default.nix b/pkgs/applications/networking/dnscontrol/default.nix
index 58051120cc340..f69b869835e9b 100644
--- a/pkgs/applications/networking/dnscontrol/default.nix
+++ b/pkgs/applications/networking/dnscontrol/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildGoModule, fetchFromGitHub, testers, dnscontrol }:
+{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, dnscontrol }:
 
 buildGoModule rec {
   pname = "dnscontrol";
@@ -13,10 +13,18 @@ buildGoModule rec {
 
   vendorHash = "sha256-kmnV1W0HGlxFZYYUeUd9D/zOabUhM5kDoTZTnRYJ2sM=";
 
+  nativeBuildInputs = [ installShellFiles ];
+
   subPackages = [ "." ];
 
   ldflags = [ "-s" "-w" "-X=main.version=${version}" ];
 
+  postInstall = ''
+    installShellCompletion --cmd dnscontrol \
+      --bash <($out/bin/dnscontrol shell-completion bash) \
+      --zsh <($out/bin/dnscontrol shell-completion zsh)
+  '';
+
   preCheck = ''
     # requires network
     rm pkg/spflib/flatten_test.go pkg/spflib/parse_test.go