Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
55 lines
1.3 KiB
Nix
55 lines
1.3 KiB
Nix
{
|
|
fetchurl,
|
|
stdenv,
|
|
lib,
|
|
php83,
|
|
writeShellScript,
|
|
nixosTests,
|
|
}:
|
|
let
|
|
version = "4.0.2";
|
|
src = fetchurl {
|
|
url = "https://github.com/misterunknown/ifm/releases/download/v${version}/cdn.ifm.php";
|
|
hash = "sha256-37WbRM6D7JGmd//06zMhxMGIh8ioY8vRUmxX4OHgqBE=";
|
|
};
|
|
|
|
serve_script = writeShellScript "ifm-serve" ''
|
|
if [ $# -ne 3 ]; then
|
|
echo "Usage: $0 <listen address> <port> <data directory>";
|
|
exit 1;
|
|
fi
|
|
|
|
SERVE_DIR=$(dirname "$0")/../php/
|
|
IFM_ROOT_DIR="$3" ${lib.getExe php83} -S "$1:$2" -t "$SERVE_DIR"
|
|
'';
|
|
in
|
|
stdenv.mkDerivation {
|
|
pname = "ifm";
|
|
inherit version src;
|
|
|
|
dontUnpack = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin $out/php
|
|
cp $src $out/php/index.php
|
|
cp ${serve_script} $out/bin/ifm
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests = {
|
|
inherit (nixosTests) ifm;
|
|
};
|
|
|
|
meta = {
|
|
description = "Improved File Manager, a single-file web-based filemanager";
|
|
longDescription = ''
|
|
The IFM is a web-based filemanager, which comes as a single file solution using HTML5, CSS3, JavaScript and PHP.
|
|
'';
|
|
homepage = "https://github.com/misterunknown/ifm";
|
|
changelog = "https://github.com/misterunknown/ifm/releases/tag/v${version}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ litchipi ];
|
|
mainProgram = "ifm";
|
|
};
|
|
}
|