about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2022-05-06 01:17:13 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2022-05-06 01:17:13 +0900
commit5df41fd81317983f53f91d5885e032bc0873b708 (patch)
tree5bda0cbac4c8ebb951c5551d37b4b3a249d50986
parenta65ca7b4055fcfa891ae38b9108881b75fb610a8 (diff)
downloadnixos-conf-5df41fd81317983f53f91d5885e032bc0873b708.tar.gz
Abstract user web dir binding
-rw-r--r--configuration.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/configuration.nix b/configuration.nix
index a479d41..0fa2b44 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,21 +1,22 @@
 { config, lib, pkgs, ... }:
 let
   domain = "loang.net";
+  bindUserDirs = sources: target: lib.mapAttrs' (user: dir: {
+    name = "${target}/~${user}";
+    value = {
+      device = "${config.users.users.${user}.home}/${dir}";
+      options = [ "bind" ];
+    };
+  }) sources;
 in {
   environment = {
     enableAllTerminfo = true;
     systemPackages = with pkgs; [ git rsync vim ];
   };
 
-  fileSystems = lib.mapAttrs' (user: dir: {
-    name = "/var/www/${domain}/~${user}";
-    value = {
-      device = "${config.users.users.${user}.home}/${dir}";
-      options = [ "bind" ];
-    };
-  }) {
+  fileSystems = bindUserDirs {
     cnx = "www";
-  };
+  } config.services.nginx.virtualHosts.${domain}.root;
 
   imports = [ ./vpsadminos.nix ];