pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / sqlpage / default.nix
blob4b9009091004ac956ab96a2e13df0c8f5f8b6584
1 { lib
2 , rustPlatform
3 , fetchFromGitHub
4 , pkg-config
5 , sqlite
6 , zstd
7 , stdenv
8 , darwin
9 , fetchurl
12 let
13   apexcharts = fetchurl {
14     url = "https://cdn.jsdelivr.net/npm/apexcharts@3.52.0/dist/apexcharts.min.js";
15     hash = "sha256-2sxp9+shRA5LMxzhgx+fpeQPIY2ZWgBdt4mp5V2Yn+E=";
16   };
17   tablerCss = fetchurl {
18     url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css";
19     hash = "sha256-lS3nKxMMZiKIRJG7UgUonOHYuvHgW5eckEjvHMYxb9Q=";
20   };
21   tablerVendorsCss = fetchurl {
22     url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css";
23     hash = "sha256-Aa7AUOaz6hJLiUzQStZTy2VPOZyg0ViSo2MCzpDU1tY=";
24   };
25   tablerJs = fetchurl {
26     url = "https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js";
27     hash = "sha256-ygO5OTRUtYxDDkERRwBCfq+fmakhM6ybwfl6gCCPlAQ=";
28   };
29   listJsFixed = fetchurl {
30     url = "https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js";
31     hash = "sha256-sYy7qNJW7RTuaNA0jq6Yrtfs57ypYrItZ3f8T7kqfPM=";
32   };
33   tablerIcons = fetchurl {
34     url = "https://cdn.jsdelivr.net/npm/@tabler/icons-sprite@3.10.0/dist/tabler-sprite.svg";
35     hash = "sha256-lEUAtxI+NffqLDllirLgcCRjEgbeCaz9Gkn3Tu9e9F4=";
36   };
37   tomselect = fetchurl {
38     url = "https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/js/tom-select.popular.min.js";
39     hash = "sha256-51NcdIM8GseVFFmg8mUWDxfhjLCA+n8kw/Ojyo+6Hjk=";
40   };
43 rustPlatform.buildRustPackage rec {
44   pname = "sqlpage";
45   version = "0.29.0";
47   src = fetchFromGitHub {
48     owner = "lovasoa";
49     repo = "SQLpage";
50     rev = "v${version}";
51     hash = "sha256-wI+nXrjX98vqyCE6Ofa5KxKUvpLfHqd7KFCsILuOnGk=";
52   };
54   postPatch = ''
55     substituteInPlace sqlpage/apexcharts.js \
56       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/apexcharts@3.52.0/dist/apexcharts.min.js */' \
57       "$(cat ${apexcharts})"
58     substituteInPlace sqlpage/sqlpage.css \
59       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css */' \
60       "$(cat ${tablerCss})"
61     substituteInPlace sqlpage/sqlpage.css \
62       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css */' \
63       "$(cat ${tablerVendorsCss})"
64     substituteInPlace sqlpage/sqlpage.js \
65       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js */' \
66       "$(cat ${tablerJs})"
67     substituteInPlace sqlpage/sqlpage.js \
68       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js */' \
69       "$(cat ${listJsFixed})"
70     substituteInPlace sqlpage/tabler-icons.svg \
71       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/@tabler/icons-sprite@3.10.0/dist/tabler-sprite.svg */' \
72       "$(cat ${tablerIcons})"
73     substituteInPlace sqlpage/tomselect.js \
74       --replace-fail '/* !include https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/js/tom-select.popular.min.js */' \
75       "$(cat ${tomselect})"
76     '';
78   cargoHash = "sha256-/B8tayEbyOsc0/po1YQKtp694X12B3I50OU4cMwJo8Q=";
80   nativeBuildInputs = [
81     pkg-config
82   ];
84   buildInputs =
85     [
86       sqlite
87       zstd
88     ]
89     ++ lib.optionals stdenv.hostPlatform.isDarwin [
90       darwin.apple_sdk.frameworks.CoreFoundation
91       darwin.apple_sdk.frameworks.Security
92       darwin.apple_sdk.frameworks.SystemConfiguration
93     ];
95   env = {
96     ZSTD_SYS_USE_PKG_CONFIG = true;
97   };
99   meta = {
100     description = "SQL-only webapp builder, empowering data analysts to build websites and applications quickly";
101     homepage = "https://github.com/lovasoa/SQLpage";
102     changelog = "https://github.com/lovasoa/SQLpage/blob/${src.rev}/CHANGELOG.md";
103     license = lib.licenses.mit;
104     maintainers = with lib.maintainers; [ dit7ya ];
105     mainProgram = "sqlpage";
106   };