summaryrefslogtreecommitdiff
path: root/hosts/fscusat/modules
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-03-08 10:50:28 +0530
committersinanmohd <sinan@sinanmohd.com>2024-03-08 10:52:52 +0530
commitcd942d253bda8f511fdb921ea29f69f382a9368e (patch)
tree2c7aac5f66e5b614ecdd0871df23432bae4dc6db /hosts/fscusat/modules
parent2abeb90fbff1d33aadfec37ce80a6bc4d3551661 (diff)
repo: restructure source tree
Diffstat (limited to 'hosts/fscusat/modules')
-rw-r--r--hosts/fscusat/modules/mirror/debian/default.nix22
-rw-r--r--hosts/fscusat/modules/mirror/debian/ftpsync.nix65
-rw-r--r--hosts/fscusat/modules/mirror/default.nix11
-rw-r--r--hosts/fscusat/modules/mirror/www.nix11
-rw-r--r--hosts/fscusat/modules/network.nix18
-rw-r--r--hosts/fscusat/modules/www.nix36
6 files changed, 0 insertions, 163 deletions
diff --git a/hosts/fscusat/modules/mirror/debian/default.nix b/hosts/fscusat/modules/mirror/debian/default.nix
deleted file mode 100644
index da56ade..0000000
--- a/hosts/fscusat/modules/mirror/debian/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ config, ... }: let
- name = config.userdata.user;
- email = config.userdata.email;
-in {
- imports = [ ./ftpsync.nix ];
-
- services.ftpsync = {
- enable = true;
-
- settings = {
- RSYNC_HOST = "ossmirror.mycloud.services";
- RSYNC_PATH = "debian";
- ARCH_INCLUDE = "amd64 riscv64";
-
- INFO_MAINTAINER = "${name} <${email}>";
- INFO_COUNTRY = "IN";
- INFO_LOCATION = "Kochi, Kerala";
- INFO_THROUGHPUT = "1Gb";
- MAILTO = email;
- };
- };
-}
diff --git a/hosts/fscusat/modules/mirror/debian/ftpsync.nix b/hosts/fscusat/modules/mirror/debian/ftpsync.nix
deleted file mode 100644
index 29fb55b..0000000
--- a/hosts/fscusat/modules/mirror/debian/ftpsync.nix
+++ /dev/null
@@ -1,65 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-let
- cfg = config.services.ftpsync;
- archvsync = pkgs.callPackage ../../../pkgs/archvsync {};
-
- formatKeyValue = k: v: '' ${k}="${v}" '';
- configFormat = pkgs.formats.keyValue { mkKeyValue = formatKeyValue; };
- configFile = configFormat.generate "ftpsync.conf" cfg.settings;
-in
-{
- meta.maintainers = with lib.maintainers; [ sinanmohd ];
-
- options.services.ftpsync = {
- enable = lib.mkEnableOption (lib.mdDoc "ftpsync");
-
- settings = lib.mkOption {
- inherit (configFormat) type;
- default = {};
- description = lib.mdDoc ''
- Configuration options for ftpsync.
- See ftpsync.conf(5) man page for available options.
- '';
- };
- };
-
- config = lib.mkIf cfg.enable {
- environment.etc."ftpsync/ftpsync.conf".source = configFile;
- environment.systemPackages = [ archvsync ];
-
- services.ftpsync.settings = {
- TO = lib.mkDefault "$STATE_DIRECTORY";
- LOGDIR = lib.mkDefault "$LOGS_DIRECTORY";
- };
-
- systemd = let
- name = "ftpsync";
- meta = {
- description = "Mirror Debian repositories of packages";
- documentation = [ "man:ftpsync(1)" ];
- };
- in {
- timers.${name} = meta // {
- wantedBy = [ "timers.target" ];
-
- timerConfig = {
- OnCalendar = "*-*-* 00,06,12,18:00:00";
- Unit="%i.service";
- Persistent = true;
- FixedRandomDelay = true;
- RandomizedDelaySec = "6h";
- };
- };
-
- services.${name} = meta // {
- serviceConfig = {
- LogsDirectory = name;
- StateDirectory = name;
-
- ExecStart = "${archvsync}/bin/ftpsync sync:all";
- };
- };
- };
- };
-}
diff --git a/hosts/fscusat/modules/mirror/default.nix b/hosts/fscusat/modules/mirror/default.nix
deleted file mode 100644
index c5fd462..0000000
--- a/hosts/fscusat/modules/mirror/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ ... }: {
- 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
deleted file mode 100644
index ebde425..0000000
--- a/hosts/fscusat/modules/mirror/www.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ ... }:
-
-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/network.nix b/hosts/fscusat/modules/network.nix
deleted file mode 100644
index 53367f8..0000000
--- a/hosts/fscusat/modules/network.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{ ... }:
-
-let
- wan = "ens18";
-in
-{
- networking = {
- interfaces.${wan}.ipv4.addresses = [{
- address = "10.0.8.101";
- prefixLength = 16;
- }];
- defaultGateway = {
- address = "10.0.0.1";
- interface = wan;
- };
- nameservers = [ "10.0.0.2" "10.0.0.3" ];
- };
-}
diff --git a/hosts/fscusat/modules/www.nix b/hosts/fscusat/modules/www.nix
deleted file mode 100644
index 24398da..0000000
--- a/hosts/fscusat/modules/www.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{ config, ... }:
-
-let
- domain = "foss.fscusat.ac.in";
-in
-{
- networking.firewall.allowedTCPPorts = [ 80 443 ];
-
- sops.secrets = let
- opts = {
- owner = config.services.nginx.user;
- group = config.services.nginx.group;
- };
- in{
- "cusat.ac.in/key" = opts;
- "cusat.ac.in/crt" = opts;
- };
-
- services.nginx = {
- enable = true;
- recommendedTlsSettings = true;
- recommendedZstdSettings = true;
- recommendedOptimisation = true;
- recommendedGzipSettings = true;
- recommendedProxySettings = true;
- recommendedBrotliSettings = true;
-
- virtualHosts.${domain} = {
- forceSSL = true;
- sslCertificateKey = config.sops.secrets."cusat.ac.in/key".path;
- sslCertificate = config.sops.secrets."cusat.ac.in/crt".path;
-
- locations."/".extraConfig = "return 307 $scheme://$host/mirror/;";
- };
- };
-}