From cd85fd9d2f4ac043d27f9bc7c2b1be108e0c8ed7 Mon Sep 17 00:00:00 2001
From: Ruben Maher <r@rkm.id.au>
Date: Sun, 19 Nov 2017 07:08:26 +1030
Subject: [PATCH] s/vmailUIDStart/vmailUID/g

The name vmailUIDStart is not consistent with how it is being used (as the UID
of the vmail user).
---
 default.nix           | 7 ++++---
 mail-server/users.nix | 4 ++--
 tests/intern.nix      | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/default.nix b/default.nix
index 7982035..8bcb85f 100644
--- a/default.nix
+++ b/default.nix
@@ -100,12 +100,13 @@ in
       default = {};
     };
 
-    vmailUIDStart = mkOption {
+    vmailUID = mkOption {
       type = types.int;
       default = 5000;
       description = ''
-        The unix UID where the loginAccounts are created. 5000 means that the first
-        user will get 5000, the second 5001, ...
+        The unix UID of the virtual mail user.  Be mindful that if this is
+        changed, you will need to manually adjust the permissions of
+        mailDirectory.
       '';
     };
 
diff --git a/mail-server/users.nix b/mail-server/users.nix
index f49be1f..b05b10e 100644
--- a/mail-server/users.nix
+++ b/mail-server/users.nix
@@ -22,7 +22,7 @@ let
   vmail_user = {
     name = vmailUserName;
     isNormalUser = false;
-    uid = vmailUIDStart;
+    uid = vmailUID;
     home = mailDirectory;
     createHome = true;
     group = vmailGroupName;
@@ -46,7 +46,7 @@ in
   config = lib.mkIf enable {
     # set the vmail gid to a specific value
     users.groups = {
-      "${vmailGroupName}" = { gid = vmailUIDStart; };
+      "${vmailGroupName}" = { gid = vmailUID; };
     };
 
     # define all users
diff --git a/tests/intern.nix b/tests/intern.nix
index bcfce2a..3d49c15 100644
--- a/tests/intern.nix
+++ b/tests/intern.nix
@@ -35,7 +35,7 @@ import <nixpkgs/nixos/tests/make-test.nix> {
           };
 
           vmailGroupName = "vmail";
-          vmailUIDStart = 5000;
+          vmailUID = 5000;
         };
     };