diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-06 01:17:13 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-06 01:17:13 +0900 |
commit | 5df41fd81317983f53f91d5885e032bc0873b708 (patch) | |
tree | 5bda0cbac4c8ebb951c5551d37b4b3a249d50986 | |
parent | a65ca7b4055fcfa891ae38b9108881b75fb610a8 (diff) | |
download | nixos-conf-5df41fd81317983f53f91d5885e032bc0873b708.tar.gz |
Abstract user web dir binding
-rw-r--r-- | configuration.nix | 17 |
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 ]; |