diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-05 18:01:37 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-05 18:01:37 +0900 |
commit | 7042c8b56d851be4bdcf27e4160a1e2dfb30874b (patch) | |
tree | 16b193c3121d3c6beb39844c3e289d65e4faf8b2 /configuration.nix | |
parent | 0d7f0821a347e3f13ad1cc5b5ee9af2bd6f72c2b (diff) | |
download | nixos-conf-7042c8b56d851be4bdcf27e4160a1e2dfb30874b.tar.gz |
Enable user (web) directories
Diffstat (limited to 'configuration.nix')
-rw-r--r-- | configuration.nix | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/configuration.nix b/configuration.nix index 46bebac..91d8904 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,14 +1,26 @@ -{ config, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: +let + domain = "loang.net"; +in { environment = { enableAllTerminfo = true; - systemPackages = with pkgs; [ git vim ]; + 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" ]; + }; + }) { + cnx = "www"; }; imports = [ ./vpsadminos.nix ]; networking = { - domain = "loang.net"; + domain = domain; firewall = { allowedTCPPorts = [ @@ -41,19 +53,10 @@ services = { nginx = { enable = true; - virtualHosts = let - users = config.users.users; - in { - "loang.net" = { - enableACME = true; - forceSSL = true; - root = "/var/www/loang.net"; - }; - "cnx.loang.net" = { - enableACME = true; - forceSSL = true; - root = "${users.cnx.home}/web"; - }; + virtualHosts.${domain} = { + enableACME = true; + forceSSL = true; + root = "/var/www/${domain}"; }; }; |