summaryrefslogtreecommitdiff
path: root/hosts/fscusat/modules/ftpsync/ftpsync.nix
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-02-17 18:31:41 +0530
committersinanmohd <sinan@sinanmohd.com>2024-02-17 21:24:02 +0530
commitbf12a289b2e4c8f22d1be781408a6d1273fd3b04 (patch)
tree6bf2eb88598db2d47119247d92be7bfb7b688b48 /hosts/fscusat/modules/ftpsync/ftpsync.nix
parent60ed7bde534f23be9e3ee5429f72cf63ac8bfff2 (diff)
fscusat/modules/mirror: init
Diffstat (limited to 'hosts/fscusat/modules/ftpsync/ftpsync.nix')
-rw-r--r--hosts/fscusat/modules/ftpsync/ftpsync.nix66
1 files changed, 0 insertions, 66 deletions
diff --git a/hosts/fscusat/modules/ftpsync/ftpsync.nix b/hosts/fscusat/modules/ftpsync/ftpsync.nix
deleted file mode 100644
index 8c1d170..0000000
--- a/hosts/fscusat/modules/ftpsync/ftpsync.nix
+++ /dev/null
@@ -1,66 +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 = {
- DynamicUser = true;
- LogsDirectory = name;
- StateDirectory = name;
-
- ExecStart = "${archvsync}/bin/ftpsync sync:all";
- };
- };
- };
- };
-}