<commit_before>{config, pkgs, serverInfo}:

let

  inherit (pkgs.lib) mkOption;

  urlPrefix = config.urlPrefix;
  dbDir = "${config.dataDir}/db";
  reposDir = "${config.dataDir}/repos";
  backupsDir = "${config.dataDir}/backup";
  distsDir = "${config.dataDir}/dist";
  tmpDir = "${config.dataDir}/tmp";
  logDir = "${config.dataDir}/log";
  idString = if config.id == "" then "" else "${config.id}-";
  postCommitHook = "/var/run/current-system/sw/bin/svn-server-${idString}post-commit-hook";
  fsType = "fsfs";
  adminAddr = serverInfo.adminAddr;
  


  # Build a Subversion instance with Apache modules and Swig/Python bindings.
  subversion = pkgs.subversion15.override (origArgs: {
    bdbSupport = true;
    httpServer = true;
    sslSupport = true;
    compressionSupport = true;
    pythonBindings = true;
  });


  # Build the maintenance scripts and commit hooks.
  scripts = substituteInAll {
    name = "svn-server-scripts";
    src = pkgs.lib.cleanSource ../../../services/subversion/src/scripts;

    # The variables to substitute:
    
    inherit reposDir dbDir logDir distsDir backupsDir tmpDir
      urlPrefix adminAddr fsType subversion postCommitHook;
    inherit (config) notificationSender userCreationDomain;
    orgUrl = config.organisation.url;
    orgLogoUrl = config.organisation.logo;
    orgName = config.organisation.name;
      
    perl = "${pkgs.perl}/bin/perl";

    sendmail = "${pkgs.ssmtp}/sbin/sendmail";
    
    inherit (pkgs) libxslt enscript db4 coreutils bzip2;

    inherit (serverInfo) canonicalName;

    inherit (serverInfo.serverConfig) user group;    
    
    # Urgh, most of these are dependencies of Email::Send, should figure them out automatically.
    perlFlags = map (x: "-I${x}/lib/site_perl") [
      pkgs.perlPackages.BerkeleyDB pkgs.perlPackages.EmailSend
      pkgs.perlPackages.EmailSimple pkgs.perlPackages.ModulePluggable
      pkgs.perlPackages.ReturnValue pkgs.perlPackages.EmailAddress
      pkgs.perlPackages.CryptPasswordMD5
      pkgs.perlPackages.StringMkPasswd
    ];

    # Do a syntax check on the generated file.
    postInstall = ''
      $perl -c -T $out/cgi-bin/repoman.pl
      $perl -c $out/bin/svn-server-create-user.pl
      if test -n "${config.id}"; then
        for i in $(cd $out/bin && echo *); do
          mv "$out/bin/$i" "$out/bin/$(echo $i | sed s^svn-server-^svn-server-${config.id}-^)"
        done<commit_msg>* Use the default Subversion (1.6).<commit_after>{config, pkgs, serverInfo}:

let

  inherit (pkgs.lib) mkOption;

  urlPrefix = config.urlPrefix;
  dbDir = "${config.dataDir}/db";
  reposDir = "${config.dataDir}/repos";
  backupsDir = "${config.dataDir}/backup";
  distsDir = "${config.dataDir}/dist";
  tmpDir = "${config.dataDir}/tmp";
  logDir = "${config.dataDir}/log";
  idString = if config.id == "" then "" else "${config.id}-";
  postCommitHook = "/var/run/current-system/sw/bin/svn-server-${idString}post-commit-hook";
  fsType = "fsfs";
  adminAddr = serverInfo.adminAddr;
  


  # Build a Subversion instance with Apache modules and Swig/Python bindings.
  subversion = pkgs.subversion.override (origArgs: {
    bdbSupport = true;
    httpServer = true;
    sslSupport = true;
    compressionSupport = true;
    pythonBindings = true;
  });


  # Build the maintenance scripts and commit hooks.
  scripts = substituteInAll {
    name = "svn-server-scripts";
    src = pkgs.lib.cleanSource ../../../services/subversion/src/scripts;

    # The variables to substitute:
    
    inherit reposDir dbDir logDir distsDir backupsDir tmpDir
      urlPrefix adminAddr fsType subversion postCommitHook;
    inherit (config) notificationSender userCreationDomain;
    orgUrl = config.organisation.url;
    orgLogoUrl = config.organisation.logo;
    orgName = config.organisation.name;
      
    perl = "${pkgs.perl}/bin/perl";

    sendmail = "${pkgs.ssmtp}/sbin/sendmail";
    
    inherit (pkgs) libxslt enscript db4 coreutils bzip2;

    inherit (serverInfo) canonicalName;

    inherit (serverInfo.serverConfig) user group;    
    
    # Urgh, most of these are dependencies of Email::Send, should figure them out automatically.
    perlFlags = map (x: "-I${x}/lib/perl5/site_perl") [
      pkgs.perlPackages.BerkeleyDB pkgs.perlPackages.EmailSend
      pkgs.perlPackages.EmailSimple pkgs.perlPackages.ModulePluggable
      pkgs.perlPackages.ReturnValue pkgs.perlPackages.EmailAddress
      pkgs.perlPackages.CryptPasswordMD5
      pkgs.perlPackages.StringMkPasswd
    ];

    # Do a syntax check on the generated file.
    postInstall = ''
      $perl -c -T $out/cgi-bin/repoman.pl
      $perl -c $out/bin/svn-server-create-user.pl
      if test -n "${config.id}"; then
        for i in $(cd $out/bin && echo *); do
          mv "$out/bin/$i" "$out/bin/$(echo $i | sed s^svn-server-^svn-server-${config.id}-^)"
        done
{'fraction_non_alphanumeric': 0.1294458229942101, 'fraction_numerical': 0.002274607113316791, 'mean_word_length': 3.1806395851339673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1873661', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1552, 'n_words': 352}