]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/ftp.nix
Write peertube flake
[perso/Immae/Config/Nix.git] / modules / private / ftp.nix
index 9b6a98f3b21bc318ca7661ddb8f956430839b077..233031a05ed335534dca26303e82927da2602b18 100644 (file)
@@ -1,4 +1,4 @@
-{ lib, pkgs, config, myconfig, ... }:
+{ lib, pkgs, config, ... }:
 let
   package = pkgs.pure-ftpd.override { ldapFtpId = "immaeFtp"; };
 in
@@ -16,6 +16,7 @@ in
   config = lib.mkIf config.services.pure-ftpd.enable {
     services.duplyBackup.profiles.ftp = {
       rootDir = "/var/lib/ftp";
+      remotes = [ "eriomem" "ovh" ];
     };
     security.acme.certs."ftp" = config.myServices.certificates.certConfig // {
       domain = "eldiron.immae.eu";
@@ -32,16 +33,13 @@ in
       };
     };
 
-    users.users = [
-      {
-        name = "ftp";
-        uid = config.ids.uids.ftp; # 8
-        group = "ftp";
-        description = "Anonymous FTP user";
-        home = "/homeless-shelter";
-        extraGroups = [ "keys" ];
-      }
-    ];
+    users.users.ftp = {
+      uid = config.ids.uids.ftp; # 8
+      group = "ftp";
+      description = "Anonymous FTP user";
+      home = "/homeless-shelter";
+      extraGroups = [ "keys" ];
+    };
 
     users.groups.ftp.gid = config.ids.gids.ftp;
 
@@ -55,17 +53,17 @@ in
       user = "ftp";
       group = "ftp";
       text = ''
-        LDAPServer          ${myconfig.env.ftp.ldap.host}
+        LDAPServer          ${config.myEnv.ftp.ldap.host}
         LDAPPort            389
         LDAPUseTLS          True
-        LDAPBaseDN          ${myconfig.env.ftp.ldap.base}
-        LDAPBindDN          ${myconfig.env.ftp.ldap.dn}
-        LDAPBindPW          ${myconfig.env.ftp.ldap.password}
+        LDAPBaseDN          ${config.myEnv.ftp.ldap.base}
+        LDAPBindDN          ${config.myEnv.ftp.ldap.dn}
+        LDAPBindPW          ${config.myEnv.ftp.ldap.password}
         LDAPDefaultUID      500
         LDAPForceDefaultUID False
         LDAPDefaultGID      100
         LDAPForceDefaultGID False
-        LDAPFilter          ${myconfig.env.ftp.ldap.filter}
+        LDAPFilter          ${config.myEnv.ftp.ldap.filter}
 
         LDAPAuthMethod      BIND
 
@@ -113,7 +111,7 @@ in
         MaxDiskUsage                 99
         CustomerProof                yes
         TLS                          1
-        CertFile                     ${config.security.acme.directory}/ftp/full.pem
+        CertFile                     ${config.security.acme.certs.ftp.directory}/full.pem
         '';
     in {
       description = "Pure-FTPd server";