about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-07 16:00:40 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-07 16:00:40 -0700
commitb4fcf4bef44e6f3ccd4fcc5363f61f4f22ae23fe (patch)
treeba0959d3bf0e7651c83ea878a0571510c36ed7de
parentcmd: add a command to update fcuny.xyz (diff)
downloadworld-b4fcf4bef44e6f3ccd4fcc5363f61f4f22ae23fe.tar.gz
nix: add a command `dnsupdate` to update the DNS
Running `nix run .#dnsupdate` will execute the program to ensure the
configuration is correct.
-rw-r--r--flake.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index ae89d70..fb00e4a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -52,7 +52,17 @@
         pkgs = import inputs.nixpkgs { inherit system; };
         home-manager = inputs.home-manager.defaultPackage."${system}";
       in {
-        packages = pkgs // { inherit home-manager; };
+        packages = pkgs // {
+          inherit home-manager;
+
+          # nix run .#dnsupdate
+          dnsupdate = pkgs.writers.writeBashBin "dnsupdate" ''
+            #!/usr/bin/env bash
+            export TS_API_KEY=$(pass api/api.tailscale.com)
+            export GOOGLE_APPLICATION_CREDENTIALS=/run/agenix/gcloud/world-nix
+            go run ./cmd/dnsupdate/
+          '';
+        };
 
         checks = {
           pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
@@ -70,6 +80,8 @@
             rnix-lsp
             home-manager
             git
+            go
+            gopls
           ];
         };
       });