nixpkgs/pkgs/servers/sqlpage/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
3.3 KiB
Nix
Raw Normal View History

2023-08-20 09:34:24 +00:00
{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, sqlite
, zstd
, stdenv
, darwin
, fetchurl
}:
let
apexcharts = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/apexcharts@3.43.2-0/dist/apexcharts.min.js";
sha256 = "sha256-7al9VaQHu7u5jfx1HZf+T8k27kbIhgHvRwaeIeYEjVI=";
2023-08-20 09:34:24 +00:00
};
tablerCss = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css";
sha256 = "sha256-lS3nKxMMZiKIRJG7UgUonOHYuvHgW5eckEjvHMYxb9Q=";
2023-08-20 09:34:24 +00:00
};
tablerVendorsCss = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css";
sha256 = "sha256-Aa7AUOaz6hJLiUzQStZTy2VPOZyg0ViSo2MCzpDU1tY=";
2023-08-20 09:34:24 +00:00
};
tablerJs = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js";
sha256 = "sha256-ygO5OTRUtYxDDkERRwBCfq+fmakhM6ybwfl6gCCPlAQ=";
2023-08-20 09:34:24 +00:00
};
listJsFixed = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js";
sha256 = "sha256-sYy7qNJW7RTuaNA0jq6Yrtfs57ypYrItZ3f8T7kqfPM=";
2023-08-20 09:34:24 +00:00
};
tablerIcons = fetchurl {
2023-11-10 20:38:32 +00:00
url = "https://cdn.jsdelivr.net/npm/@tabler/icons@2.39.0/tabler-sprite.svg";
sha256 = "sha256-8C9PPhDyVnym0q/RkQlTyfjKbAMRsYBlRtsMbNAepvY=";
2023-08-20 09:34:24 +00:00
};
in
rustPlatform.buildRustPackage rec {
pname = "sqlpage";
2023-11-10 20:38:32 +00:00
version = "0.15.1";
2023-08-20 09:34:24 +00:00
src = fetchFromGitHub {
owner = "lovasoa";
repo = "SQLpage";
rev = "v${version}";
2023-11-10 20:38:32 +00:00
hash = "sha256-0CPWMVdX0HGPMfIiDfC6TJ2t07O6eZcS7yEDVAvjLUc=";
2023-08-20 09:34:24 +00:00
};
postPatch = ''
substituteInPlace sqlpage/apexcharts.js \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/apexcharts@3.43.2-0/dist/apexcharts.min.js */' \
2023-08-20 09:34:24 +00:00
"$(cat ${apexcharts})"
substituteInPlace sqlpage/sqlpage.css \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css */' \
2023-08-20 09:34:24 +00:00
"$(cat ${tablerCss})"
substituteInPlace sqlpage/sqlpage.css \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css */' \
2023-08-20 09:34:24 +00:00
"$(cat ${tablerVendorsCss})"
substituteInPlace sqlpage/sqlpage.js \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js */' \
2023-08-20 09:34:24 +00:00
"$(cat ${tablerJs})"
substituteInPlace sqlpage/sqlpage.js \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js */' \
2023-08-20 09:34:24 +00:00
"$(cat ${listJsFixed})"
substituteInPlace sqlpage/tabler-icons.svg \
2023-11-10 20:38:32 +00:00
--replace '/* !include https://cdn.jsdelivr.net/npm/@tabler/icons@2.39.0/tabler-sprite.svg */' \
2023-08-20 09:34:24 +00:00
"$(cat ${tablerIcons})"
'';
2023-11-10 20:38:32 +00:00
cargoHash = "sha256-ooK4eIaPbUsxgDuVJkWHlArMa81TtlRfR6YYEAh7cLY=";
2023-08-20 09:34:24 +00:00
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 ];
2023-11-23 21:09:35 +00:00
mainProgram = "sqlpage";
2023-08-20 09:34:24 +00:00
};
}