mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 12:29:02 +02:00
nixos/moodle: add plugins
This commit is contained in:
parent
951e2175c3
commit
7561a3dc4a
|
@ -1,23 +1,23 @@
|
||||||
{ stdenv, fetchurl, writeText }:
|
{ lib, stdenv, fetchurl, writeText, plugins ? [ ] }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "3.9.1";
|
version = "3.9.1";
|
||||||
stableVersion = builtins.substring 0 2 (builtins.replaceStrings ["."] [""] version);
|
stableVersion = builtins.substring 0 2 (builtins.replaceStrings ["."] [""] version);
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
pname = "moodle";
|
pname = "moodle";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://download.moodle.org/stable${stableVersion}/${pname}-${version}.tgz";
|
url =
|
||||||
sha256 = "1ysnrk013gmc21ml3jwijvl16rx3p478a4vriy6h8hfli48460p9";
|
"https://download.moodle.org/stable${stableVersion}/${pname}-${version}.tgz";
|
||||||
|
sha256 = "dffe8c1ac68938f50a987b46b0bfc74f01235d0198ac96fb4fc4f1df5bd7f4ea";
|
||||||
};
|
};
|
||||||
|
|
||||||
phpConfig = writeText "config.php" ''
|
phpConfig = writeText "config.php" ''
|
||||||
<?php
|
<?php
|
||||||
return require(getenv('MOODLE_CONFIG'));
|
return require(getenv('MOODLE_CONFIG'));
|
||||||
?>
|
?>
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -27,11 +27,34 @@ stdenv.mkDerivation rec {
|
||||||
cp -r . $out/share/moodle
|
cp -r . $out/share/moodle
|
||||||
cp ${phpConfig} $out/share/moodle/config.php
|
cp ${phpConfig} $out/share/moodle/config.php
|
||||||
|
|
||||||
|
${lib.concatStringsSep "\n" (map (p:
|
||||||
|
let
|
||||||
|
dir = if p.pluginType == "mod" then
|
||||||
|
"mod"
|
||||||
|
else if p.pluginType == "theme" then
|
||||||
|
"theme"
|
||||||
|
else if p.pluginType == "block" then
|
||||||
|
"blocks"
|
||||||
|
else if p.pluginType == "question" then
|
||||||
|
"question/type"
|
||||||
|
else if p.pluginType == "course" then
|
||||||
|
"course/format"
|
||||||
|
else if p.pluginType == "report" then
|
||||||
|
"admin/report"
|
||||||
|
else
|
||||||
|
throw "unknown moodle plugin type";
|
||||||
|
# we have to copy it, because the plugins have refrences to .. inside
|
||||||
|
in ''
|
||||||
|
mkdir -p $out/share/moodle/${dir}/${p.name}
|
||||||
|
cp -r ${p}/* $out/share/moodle/${dir}/${p.name}/
|
||||||
|
'') plugins)}
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Free and open-source learning management system (LMS) written in PHP";
|
description =
|
||||||
|
"Free and open-source learning management system (LMS) written in PHP";
|
||||||
license = licenses.gpl3Plus;
|
license = licenses.gpl3Plus;
|
||||||
homepage = "https://moodle.org/";
|
homepage = "https://moodle.org/";
|
||||||
maintainers = with maintainers; [ aanderse ];
|
maintainers = with maintainers; [ aanderse ];
|
||||||
|
|
32
pkgs/servers/web-apps/moodle/moodle-utils.nix
Normal file
32
pkgs/servers/web-apps/moodle/moodle-utils.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ stdenv, unzip, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
buildMoodlePlugin = a@{
|
||||||
|
name,
|
||||||
|
src,
|
||||||
|
pluginType,
|
||||||
|
configuraPhase ? ":",
|
||||||
|
buildPhase ? ":",
|
||||||
|
buildInputs ? [ ],
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation (a // {
|
||||||
|
name = name;
|
||||||
|
|
||||||
|
inherit pluginType;
|
||||||
|
inherit configuraPhase buildPhase;
|
||||||
|
|
||||||
|
buildInputs = [ unzip ] ++ buildInputs;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
mv * $out/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
inherit buildMoodlePlugin;
|
||||||
|
}
|
|
@ -16074,6 +16074,8 @@ in
|
||||||
|
|
||||||
moodle = callPackage ../servers/web-apps/moodle { };
|
moodle = callPackage ../servers/web-apps/moodle { };
|
||||||
|
|
||||||
|
moodle-utils = callPackage ../servers/web-apps/moodle/moodle-utils.nix { };
|
||||||
|
|
||||||
morty = callPackage ../servers/web-apps/morty { };
|
morty = callPackage ../servers/web-apps/morty { };
|
||||||
|
|
||||||
mullvad-vpn = callPackage ../applications/networking/mullvad-vpn { };
|
mullvad-vpn = callPackage ../applications/networking/mullvad-vpn { };
|
||||||
|
|
Loading…
Reference in a new issue