diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-02-17 18:31:41 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-02-17 21:24:02 +0530 |
commit | bf12a289b2e4c8f22d1be781408a6d1273fd3b04 (patch) | |
tree | 6bf2eb88598db2d47119247d92be7bfb7b688b48 | |
parent | 60ed7bde534f23be9e3ee5429f72cf63ac8bfff2 (diff) |
fscusat/modules/mirror: init
-rw-r--r-- | hosts/fscusat/configuration.nix | 2 | ||||
-rw-r--r-- | hosts/fscusat/modules/mirror/debian/default.nix (renamed from hosts/fscusat/modules/ftpsync/default.nix) | 3 | ||||
-rw-r--r-- | hosts/fscusat/modules/mirror/debian/ftpsync.nix (renamed from hosts/fscusat/modules/ftpsync/ftpsync.nix) | 3 | ||||
-rw-r--r-- | hosts/fscusat/modules/mirror/default.nix | 11 | ||||
-rw-r--r-- | hosts/fscusat/modules/mirror/www.nix | 11 | ||||
-rw-r--r-- | hosts/fscusat/modules/www.nix | 5 |
6 files changed, 27 insertions, 8 deletions
diff --git a/hosts/fscusat/configuration.nix b/hosts/fscusat/configuration.nix index 72e8e04..779f0ec 100644 --- a/hosts/fscusat/configuration.nix +++ b/hosts/fscusat/configuration.nix @@ -5,7 +5,7 @@ ./hardware-configuration.nix ./modules/network.nix ./modules/www.nix - ./modules/ftpsync + ./modules/mirror ../../common.nix ]; diff --git a/hosts/fscusat/modules/ftpsync/default.nix b/hosts/fscusat/modules/mirror/debian/default.nix index aa214ac..da56ade 100644 --- a/hosts/fscusat/modules/ftpsync/default.nix +++ b/hosts/fscusat/modules/mirror/debian/default.nix @@ -12,10 +12,11 @@ in { RSYNC_PATH = "debian"; ARCH_INCLUDE = "amd64 riscv64"; - INFO_MAINTAINER="${name} <${email}>"; + INFO_MAINTAINER = "${name} <${email}>"; INFO_COUNTRY = "IN"; INFO_LOCATION = "Kochi, Kerala"; INFO_THROUGHPUT = "1Gb"; + MAILTO = email; }; }; } diff --git a/hosts/fscusat/modules/ftpsync/ftpsync.nix b/hosts/fscusat/modules/mirror/debian/ftpsync.nix index 8c1d170..29fb55b 100644 --- a/hosts/fscusat/modules/ftpsync/ftpsync.nix +++ b/hosts/fscusat/modules/mirror/debian/ftpsync.nix @@ -2,7 +2,7 @@ let cfg = config.services.ftpsync; - archvsync = pkgs.callPackage ../../pkgs/archvsync {}; + archvsync = pkgs.callPackage ../../../pkgs/archvsync {}; formatKeyValue = k: v: '' ${k}="${v}" ''; configFormat = pkgs.formats.keyValue { mkKeyValue = formatKeyValue; }; @@ -54,7 +54,6 @@ in services.${name} = meta // { serviceConfig = { - DynamicUser = true; LogsDirectory = name; StateDirectory = name; diff --git a/hosts/fscusat/modules/mirror/default.nix b/hosts/fscusat/modules/mirror/default.nix new file mode 100644 index 0000000..c5fd462 --- /dev/null +++ b/hosts/fscusat/modules/mirror/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./debian + ./www.nix + ]; + + systemd.tmpfiles.rules = [ + "d /var/cache/mirror/ 0755 root root" + "L /var/cache/mirror/debian - - - - /var/lib/ftpsync/" + ]; +} diff --git a/hosts/fscusat/modules/mirror/www.nix b/hosts/fscusat/modules/mirror/www.nix new file mode 100644 index 0000000..ebde425 --- /dev/null +++ b/hosts/fscusat/modules/mirror/www.nix @@ -0,0 +1,11 @@ +{ ... }: + +let + domain = "foss.fscusat.ac.in"; +in +{ + services.nginx.virtualHosts.${domain}.locations."/mirror/" = { + alias = "/var/cache/mirror/"; + extraConfig = "autoindex on;"; + }; +} diff --git a/hosts/fscusat/modules/www.nix b/hosts/fscusat/modules/www.nix index 464aaa6..24398da 100644 --- a/hosts/fscusat/modules/www.nix +++ b/hosts/fscusat/modules/www.nix @@ -30,10 +30,7 @@ in sslCertificateKey = config.sops.secrets."cusat.ac.in/key".path; sslCertificate = config.sops.secrets."cusat.ac.in/crt".path; - locations."/" = { - return = "200 '<h1>under construction</h1>'"; - extraConfig = "add_header Content-Type text/html;"; - }; + locations."/".extraConfig = "return 307 $scheme://$host/mirror/;"; }; }; } |