nixpkgs/pkgs/servers/web-apps/moodle/default.nix

41 lines
966 B
Nix
Raw Normal View History

2019-06-19 10:23:43 +00:00
{ stdenv, fetchurl, writeText }:
let
2019-09-10 12:55:28 +00:00
version = "3.7.2";
2019-06-19 10:23:43 +00:00
stableVersion = builtins.substring 0 2 (builtins.replaceStrings ["."] [""] version);
in
stdenv.mkDerivation rec {
pname = "moodle";
inherit version;
src = fetchurl {
url = "https://download.moodle.org/stable${stableVersion}/${pname}-${version}.tgz";
2019-09-10 12:55:28 +00:00
sha256 = "1mvrmpqkcz7m7yplqi0lwgnal79n747f7nwcgd2nfrvz7jv3s8ir";
2019-06-19 10:23:43 +00:00
};
phpConfig = writeText "config.php" ''
<?php
return require(getenv('MOODLE_CONFIG'));
?>
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/moodle
cp -r . $out/share/moodle
cp ${phpConfig} $out/share/moodle/config.php
runHook postInstall
'';
meta = with stdenv.lib; {
description = "Free and open-source learning management system (LMS) written in PHP";
license = licenses.gpl3Plus;
homepage = "https://moodle.org/";
maintainers = with maintainers; [ aanderse ];
platforms = platforms.all;
};
}