Move all flakes into modules/ and sep't, create deploy script for a1d2

Change-Id: Ie4d50fb8f16da193195beb139922a366b72b0b0a
diff --git a/modules/common/home-manager-users.nix b/modules/common/home-manager-users.nix
new file mode 100644
index 0000000..fe1c15d
--- /dev/null
+++ b/modules/common/home-manager-users.nix
@@ -0,0 +1,39 @@
+# Home manager is used separately from this deploy, but we still need to create
+# user accounts in the system config
+{ base, pkgs, lib, config, ... }:
+let
+  mkUser = username:
+    {
+      isSystemUser = true;
+      linger = true;
+      createHome = true;
+      home = "/services/${username}";
+      group = "clicks";
+      shell = pkgs.bashInteractive;
+    } // (if builtins.pathExists "${../../services}/${username}/system.nix" then
+      import "${../../services}/${username}/system.nix"
+    else
+      { });
+in {
+  users.users = lib.pipe ../../services [
+    builtins.readDir
+    (lib.filterAttrs (_name: value: value == "directory"))
+    builtins.attrNames
+    (map (name: {
+      inherit name;
+      value = mkUser name;
+    }))
+    builtins.listToAttrs
+  ];
+} // (if (base != null) then
+  {
+    /* users.groups = lib.mapAttrs'
+       (_: user: {
+         name = user.group;
+         value = { };
+       })
+       base.config.users.users;
+    */
+  }
+else
+  { })