depot/pkgs/by-name/ad/adminerevo/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

73 lines
1.4 KiB
Nix

{ lib
, pkgs
, stdenvNoCC
, fetchFromGitHub
, php
, nix-update-script
, theme ? null
, plugins ? []
}:
stdenvNoCC.mkDerivation (finalAttrs: {
version = "4.8.4";
pname = "adminerevo";
src = fetchFromGitHub {
owner = "adminerevo";
repo = "adminerevo";
rev = "v${finalAttrs.version}";
hash = "sha256-cyKSwzoVbS/0Fiv02kFIF4MTOqzpKSEFwwUwS4yqL6Q=";
fetchSubmodules = true;
};
nativeBuildInputs = [
php
];
buildPhase = ''
runHook preBuild
php compile.php
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
cp adminer-${finalAttrs.version}.php $out/adminer.php
cp ${./index.php} $out/index.php
${lib.optionalString (theme != null) ''
cp designs/${theme}/adminer.css $out/adminer.css
''}
# Copy base plugin
mkdir -p $out/plugins
cp plugins/plugin.php $out/plugins/plugin.php
${lib.optionalString (plugins != []) ''
cp plugins/*.php $out/plugins/
cp ${pkgs.writeText "$out/plugins.json" ''
${toString (builtins.toJSON plugins)}
''} $out/plugins.json
''}
runHook postInstall
'';
passthru = {
updateScript = nix-update-script { };
};
meta = with lib; {
description = "Database management in a single PHP file";
homepage = "https://docs.adminerevo.org";
license = with licenses; [ asl20 gpl2Only ];
maintainers = with maintainers; [
shyim
];
platforms = platforms.all;
};
})