nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 sqlite,
7 unixODBC,
8 zstd,
9 fetchurl,
10}:
11
12let
13 apexcharts = {
14 url = "https://cdn.jsdelivr.net/npm/apexcharts@5.3.6/dist/apexcharts.min.js";
15 hash = "sha256-qNJtESJROYHRKwS/u3zdu4Fev69db17hKHZvrqGiqRs=";
16 };
17 tablerCss = {
18 url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/css/tabler.min.css";
19 hash = "sha256-fvdQvRBUamldCxJ2etgEi9jz7F3n2u+xBn+dDao9HJo=";
20 };
21 tomSelectCss = {
22 url = "https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.css";
23 hash = "sha256-vW5UjM/Ka9/jIY8I5s5KcudaTRWh/cCGE1ZUsrJvlI0=";
24 };
25 tablerVendorsCss = {
26 url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/css/tabler-vendors.min.css";
27 hash = "sha256-/VPz9GtiH1Es1KGLY706UIayEEgG93B6aIBa3WzwKYc=";
28 };
29 tablerJs = {
30 url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/js/tabler.min.js";
31 hash = "sha256-tgx2Fg6XYkV027jPEKvmrummSTtgCW/fwV3R3SvZnrk=";
32 };
33 tablerIcons = {
34 url = "https://cdn.jsdelivr.net/npm/@tabler/icons-sprite@3.34.0/dist/tabler-sprite.svg";
35 hash = "sha256-pCPkhrx0GnPg5/EthJ7pLdMxb7wbYMJ0R7WchDcffpg=";
36 };
37 tomselect = {
38 url = "https://cdn.jsdelivr.net/npm/tom-select@2.4.1/dist/js/tom-select.popular.min.js";
39 hash = "sha256-Cb1Xmb9qQO8I1mMVkz4t2bT8l7HX+1JeKncGBSytSHQ=";
40 };
41in
42
43rustPlatform.buildRustPackage (finalAttrs: {
44 pname = "sqlpage";
45 version = "0.41.0";
46
47 src = fetchFromGitHub {
48 owner = "lovasoa";
49 repo = "SQLpage";
50 tag = "v${finalAttrs.version}";
51 hash = "sha256-rUij1nhXcLEwdUUVpKoUbgNqV47TvmMCEds4ihP9QL4=";
52 };
53
54 postPatch = ''
55 substituteInPlace sqlpage/apexcharts.js \
56 --replace-fail '/* !include ${apexcharts.url} */' \
57 "$(cat ${fetchurl apexcharts})"
58 substituteInPlace sqlpage/sqlpage.css \
59 --replace-fail '/* !include ${tablerCss.url} */' \
60 "$(cat ${fetchurl tablerCss})" \
61 --replace-fail '/* !include ${tablerVendorsCss.url} */' \
62 "$(cat ${fetchurl tablerVendorsCss})" \
63 --replace-fail '/* !include ${tomSelectCss.url} */' \
64 "$(cat ${fetchurl tomSelectCss})"
65 substituteInPlace sqlpage/sqlpage.js \
66 --replace-fail '/* !include ${tablerJs.url} */' \
67 "$(cat ${fetchurl tablerJs})"
68 substituteInPlace sqlpage/tabler-icons.svg \
69 --replace-fail '/* !include ${tablerIcons.url} */' \
70 "$(cat ${fetchurl tablerIcons})"
71 substituteInPlace sqlpage/tomselect.js \
72 --replace-fail '/* !include ${tomselect.url} */' \
73 "$(cat ${fetchurl tomselect})"
74 substituteInPlace build.rs \
75 --replace-fail "https://cdn.jsdelivr.net/npm/@tabler/icons-sprite@3.35.0/dist/tabler-sprite.svg" "${fetchurl tablerIcons}" \
76 --replace-fail "copy_url_to_opened_file(&client, sprite_url, &mut sprite_content).await;" "sprite_content = std::fs::read(sprite_url).unwrap();"
77 '';
78
79 cargoHash = "sha256-jyhvhViPz/tj76mvmaIih4LaCH+ODFa8gs0/MTYbuQg=";
80
81 nativeBuildInputs = [ pkg-config ];
82
83 buildInputs = [
84 sqlite
85 unixODBC
86 zstd
87 ];
88
89 env.ZSTD_SYS_USE_PKG_CONFIG = true;
90
91 __darwinAllowLocalNetworking = true;
92
93 meta = {
94 description = "SQL-only webapp builder, empowering data analysts to build websites and applications quickly";
95 homepage = "https://github.com/lovasoa/SQLpage";
96 changelog = "https://github.com/lovasoa/SQLpage/blob/${finalAttrs.src.rev}/CHANGELOG.md";
97 license = lib.licenses.mit;
98 maintainers = with lib.maintainers; [ dit7ya ];
99 mainProgram = "sqlpage";
100 };
101})