Merge pull request #305598 from shyim/add-adminerevo

adminerevo: init at 4.8.6

authored by Pol Dellaiera and committed by GitHub f2d7a289 77ad8be7

+108
+35
pkgs/by-name/ad/adminerevo/index.php
···
··· 1 + <?php 2 + 3 + namespace nixos { 4 + function adminer_object() { 5 + require_once(__DIR__ . '/plugins/plugin.php'); 6 + 7 + $plugins = []; 8 + if (file_exists(__DIR__ . '/plugins.json')) { 9 + $names = json_decode(file_get_contents(__DIR__ . '/plugins.json'), true); 10 + 11 + foreach ($names as $name) { 12 + $plugin = __DIR__ . '/plugins/' . $name . '.php'; 13 + if (is_readable($plugin)) { 14 + require($plugin); 15 + 16 + preg_match_all('/(\w+)/', $name, $matches); 17 + 18 + $className = 'Adminer'. implode('', array_map('ucfirst', $matches[1])); 19 + 20 + $plugins[] = new $className; 21 + } 22 + } 23 + } 24 + 25 + return new \AdminerPlugin($plugins); 26 + } 27 + } 28 + 29 + namespace { 30 + function adminer_object() { 31 + return \nixos\adminer_object(); 32 + } 33 + 34 + require(__DIR__ . '/adminer.php'); 35 + }
+73
pkgs/by-name/ad/adminerevo/package.nix
···
··· 1 + { lib 2 + , pkgs 3 + , stdenvNoCC 4 + , fetchFromGitHub 5 + , php 6 + , nix-update-script 7 + , theme ? null 8 + , plugins ? [] 9 + }: 10 + 11 + stdenvNoCC.mkDerivation (finalAttrs: { 12 + version = "4.8.4"; 13 + pname = "adminerevo"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "adminerevo"; 17 + repo = "adminerevo"; 18 + rev = "v${finalAttrs.version}"; 19 + hash = "sha256-cyKSwzoVbS/0Fiv02kFIF4MTOqzpKSEFwwUwS4yqL6Q="; 20 + fetchSubmodules = true; 21 + }; 22 + 23 + nativeBuildInputs = [ 24 + php 25 + ]; 26 + 27 + buildPhase = '' 28 + runHook preBuild 29 + 30 + php compile.php 31 + 32 + runHook postBuild 33 + ''; 34 + 35 + installPhase = '' 36 + runHook preInstall 37 + 38 + mkdir $out 39 + cp adminer-${finalAttrs.version}.php $out/adminer.php 40 + cp ${./index.php} $out/index.php 41 + 42 + ${lib.optionalString (theme != null) '' 43 + cp designs/${theme}/adminer.css $out/adminer.css 44 + ''} 45 + 46 + # Copy base plugin 47 + mkdir -p $out/plugins 48 + cp plugins/plugin.php $out/plugins/plugin.php 49 + 50 + ${lib.optionalString (plugins != []) '' 51 + cp plugins/*.php $out/plugins/ 52 + cp ${pkgs.writeText "$out/plugins.json" '' 53 + ${toString (builtins.toJSON plugins)} 54 + ''} $out/plugins.json 55 + ''} 56 + 57 + runHook postInstall 58 + ''; 59 + 60 + passthru = { 61 + updateScript = nix-update-script { }; 62 + }; 63 + 64 + meta = with lib; { 65 + description = "Database management in a single PHP file"; 66 + homepage = "https://docs.adminerevo.org"; 67 + license = with licenses; [ asl20 gpl2Only ]; 68 + maintainers = with maintainers; [ 69 + shyim 70 + ]; 71 + platforms = platforms.all; 72 + }; 73 + })