lol

moodle: Remove due to continued security issues.

-198
-198
nixos/modules/services/web-servers/apache-httpd/moodle.nix
··· 1 - { config, lib, pkgs, serverInfo, php, ... }: 2 - 3 - with lib; 4 - 5 - let 6 - 7 - httpd = serverInfo.serverConfig.package; 8 - 9 - version24 = !versionOlder httpd.version "2.4"; 10 - 11 - allGranted = if version24 then '' 12 - Require all granted 13 - '' else '' 14 - Order allow,deny 15 - Allow from all 16 - ''; 17 - 18 - moodleConfig = pkgs.writeText "config.php" 19 - '' 20 - <?php 21 - unset($CFG); 22 - global $CFG; 23 - $CFG = new stdClass(); 24 - $CFG->dbtype = '${config.dbType}'; 25 - $CFG->dblibrary = 'native'; 26 - $CFG->dbhost = '${config.dbHost}'; 27 - $CFG->dbname = '${config.dbName}'; 28 - $CFG->dbuser = '${config.dbUser}'; 29 - $CFG->dbpass = '${config.dbPassword}'; 30 - $CFG->prefix = '${config.dbPrefix}'; 31 - $CFG->dboptions = array( 32 - 'dbpersist' => false, 33 - 'dbsocket' => false, 34 - 'dbport' => "${config.dbPort}", 35 - ); 36 - $CFG->wwwroot = '${config.wwwRoot}'; 37 - $CFG->dataroot = '${config.dataRoot}'; 38 - $CFG->directorypermissions = 02777; 39 - $CFG->admin = 'admin'; 40 - ${optionalString (config.debug.noEmailEver == true) '' 41 - $CFG->noemailever = true; 42 - ''} 43 - 44 - ${config.extraConfig} 45 - require_once(dirname(__FILE__) . '/lib/setup.php'); // Do not edit 46 - ''; 47 - # Unpack Moodle and put the config file in its root directory. 48 - moodleRoot = pkgs.stdenv.mkDerivation rec { 49 - name= "moodle-2.8.10"; 50 - 51 - src = pkgs.fetchurl { 52 - url = "https://download.moodle.org/stable28/${name}.tgz"; 53 - sha256 = "0c3r5081ipcwc9s6shakllnrkd589y2ln5z5m1q09l4h6a7cy4z2"; 54 - }; 55 - 56 - buildPhase = 57 - '' 58 - ''; 59 - 60 - installPhase = 61 - '' 62 - mkdir -p $out 63 - cp -r * $out 64 - cp ${moodleConfig} $out/config.php 65 - ''; 66 - # Marked as broken due to needing an update for security issues. 67 - # See: https://github.com/NixOS/nixpkgs/issues/18856 68 - meta.broken = true; 69 - 70 - }; 71 - 72 - in 73 - 74 - { 75 - 76 - extraConfig = 77 - '' 78 - # this should be config.urlPrefix instead of / 79 - Alias / ${moodleRoot}/ 80 - <Directory ${moodleRoot}> 81 - DirectoryIndex index.php 82 - </Directory> 83 - ''; 84 - 85 - documentRoot = moodleRoot; # TODO: fix this, should be config.urlPrefix 86 - 87 - enablePHP = true; 88 - 89 - options = { 90 - 91 - id = mkOption { 92 - default = "main"; 93 - description = '' 94 - A unique identifier necessary to keep multiple Moodle server 95 - instances on the same machine apart. 96 - ''; 97 - }; 98 - 99 - dbType = mkOption { 100 - default = "postgres"; 101 - example = "mysql"; 102 - description = "Database type."; 103 - }; 104 - 105 - dbName = mkOption { 106 - default = "moodle"; 107 - description = "Name of the database that holds the Moodle data."; 108 - }; 109 - 110 - dbHost = mkOption { 111 - default = "localhost"; 112 - example = "10.0.2.2"; 113 - description = '' 114 - The location of the database server. 115 - ''; 116 - }; 117 - 118 - dbPort = mkOption { 119 - default = ""; # use the default port 120 - example = "12345"; 121 - description = '' 122 - The port that is used to connect to the database server. 123 - ''; 124 - }; 125 - 126 - dbUser = mkOption { 127 - default = "moodle"; 128 - description = "The user name for accessing the database."; 129 - }; 130 - 131 - dbPassword = mkOption { 132 - default = ""; 133 - example = "password"; 134 - description = '' 135 - The password of the database user. Warning: this is stored in 136 - cleartext in the Nix store! 137 - ''; 138 - }; 139 - 140 - dbPrefix = mkOption { 141 - default = "mdl_"; 142 - example = "my_other_mdl_"; 143 - description = '' 144 - A prefix for each table, if multiple moodles should run in a single database. 145 - ''; 146 - }; 147 - 148 - wwwRoot = mkOption { 149 - type = types.string; 150 - example = "http://my.machine.com/my-moodle"; 151 - description = '' 152 - The full web address where moodle has been installed. 153 - ''; 154 - }; 155 - 156 - dataRoot = mkOption { 157 - default = "/var/lib/moodledata"; 158 - example = "/var/lib/moodledata"; 159 - description = '' 160 - The data directory for moodle. Needs to be writable! 161 - ''; 162 - type = types.path; 163 - }; 164 - 165 - 166 - extraConfig = mkOption { 167 - type = types.lines; 168 - default = ""; 169 - example = 170 - '' 171 - ''; 172 - description = '' 173 - Any additional text to be appended to Moodle's 174 - configuration file. This is a PHP script. 175 - ''; 176 - }; 177 - 178 - debug = { 179 - noEmailEver = mkOption { 180 - default = false; 181 - example = "true"; 182 - description = '' 183 - Set this to true to prevent Moodle from ever sending any email. 184 - ''; 185 - }; 186 - }; 187 - }; 188 - 189 - startupScript = pkgs.writeScript "moodle_startup.sh" '' 190 - echo "Checking for existence of ${config.dataRoot}" 191 - if [ ! -e "${config.dataRoot}" ] 192 - then 193 - mkdir -p "${config.dataRoot}" 194 - chown ${serverInfo.serverConfig.user}.${serverInfo.serverConfig.group} "${config.dataRoot}" 195 - fi 196 - ''; 197 - 198 - }