about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-11T21·00+0000
committerVincent Ambo <tazjin@google.com>2020-02-11T21·00+0000
commitb4c0292753bf06663ea5a10b3575817b0077c02e (patch)
treef255792d36683868b5c16f91ec40768ce3c4de19 /nix
parent675fed2dcada78613d5cfad036f1bebd65dd542c (diff)
fix(nix/tailscale): Fix incorrect Tailscale ACL config type r/543
Diffstat (limited to 'nix')
-rw-r--r--nix/tailscale/default.nix17
1 files changed, 14 insertions, 3 deletions
diff --git a/nix/tailscale/default.nix b/nix/tailscale/default.nix
index 4f533f6d61..d836850aa1 100644
--- a/nix/tailscale/default.nix
+++ b/nix/tailscale/default.nix
@@ -9,11 +9,22 @@ with pkgs.nix.yants;
 let
   inherit (builtins) toFile toJSON;
 
-  entry = struct "aclEntry" {
+  acl = struct "acl" {
     Action = enum [ "accept" "reject" ];
     Users = list string;
     Ports = list string;
   };
 
-  acl = list entry;
-in entries: toFile "tailscale-acl.json" (toJSON (acl entries))
+  acls = list entry;
+
+  aclConfig = struct "aclConfig" {
+    # Static group mappings from group names to lists of users
+    Groups = option (attrs (list string));
+
+    # Hostname aliases to use in place of IPs
+    Hosts = option (attrs string);
+
+    # Actual ACL entries
+    ACLs = list acl;
+  };
+in config: toFile "tailscale-acl.json" (toJSON (aclConfig config))