depot/third_party/nixpkgs/pkgs/servers/sqlpage/default.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

100 lines
3.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, sqlite
, zstd
, stdenv
, darwin
, fetchurl
}:
let
apexcharts = fetchurl {
url = "https://cdn.jsdelivr.net/npm/apexcharts@3.47.0/dist/apexcharts.min.js";
sha256 = "sha256-StFDdV+DR9yItbCXAGTK6EUcu613N3vM0i5ngrYZlz4=";
};
tablerCss = fetchurl {
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css";
sha256 = "sha256-lS3nKxMMZiKIRJG7UgUonOHYuvHgW5eckEjvHMYxb9Q=";
};
tablerVendorsCss = fetchurl {
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css";
sha256 = "sha256-Aa7AUOaz6hJLiUzQStZTy2VPOZyg0ViSo2MCzpDU1tY=";
};
tablerJs = fetchurl {
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js";
sha256 = "sha256-ygO5OTRUtYxDDkERRwBCfq+fmakhM6ybwfl6gCCPlAQ=";
};
listJsFixed = fetchurl {
url = "https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js";
sha256 = "sha256-sYy7qNJW7RTuaNA0jq6Yrtfs57ypYrItZ3f8T7kqfPM=";
};
tablerIcons = fetchurl {
url = "https://cdn.jsdelivr.net/npm/@tabler/icons@2.47.0/tabler-sprite.svg";
sha256 = "sha256-dphCRqfQZmC7finy/HU9QnJQESwgWoUxRHkz7On877I=";
};
in
rustPlatform.buildRustPackage rec {
pname = "sqlpage";
version = "0.20.0";
src = fetchFromGitHub {
owner = "lovasoa";
repo = "SQLpage";
rev = "v${version}";
sha256 = "sha256-zmAnlsYL36qqO2cLSVdsnUG47xHslOvDzcGICNxG/5c=";
};
postPatch = ''
substituteInPlace sqlpage/apexcharts.js \
--replace '/* !include https://cdn.jsdelivr.net/npm/apexcharts@3.47.0/dist/apexcharts.min.js */' \
"$(cat ${apexcharts})"
substituteInPlace sqlpage/sqlpage.css \
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css */' \
"$(cat ${tablerCss})"
substituteInPlace sqlpage/sqlpage.css \
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css */' \
"$(cat ${tablerVendorsCss})"
substituteInPlace sqlpage/sqlpage.js \
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js */' \
"$(cat ${tablerJs})"
substituteInPlace sqlpage/sqlpage.js \
--replace '/* !include https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js */' \
"$(cat ${listJsFixed})"
substituteInPlace sqlpage/tabler-icons.svg \
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/icons@2.47.0/tabler-sprite.svg */' \
"$(cat ${tablerIcons})"
'';
cargoHash = "sha256-dPqO+yychyOybdTvdhWkcXyDlxIXO39KUZ80v+7Syqg=";
nativeBuildInputs = [
pkg-config
];
buildInputs =
[
sqlite
zstd
]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
};
meta = {
description = "SQL-only webapp builder, empowering data analysts to build websites and applications quickly";
homepage = "https://github.com/lovasoa/SQLpage";
changelog = "https://github.com/lovasoa/SQLpage/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dit7ya ];
mainProgram = "sqlpage";
};
}