1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
{ buildGoModule
, cairo
, cargo
, cargo-tauri
, esbuild
, fetchFromGitHub
, gdk-pixbuf
, gobject-introspection
, lib
, libsoup
, makeBinaryWrapper
, nodejs
, openssl
, pango
, pkg-config
, pnpm
, rustc
, rustPlatform
, stdenv
, stdenvNoCC
, webkitgtk
}:
let
esbuild-20-2 = let version = "0.20.2";
in esbuild.override {
buildGoModule = args:
buildGoModule (args // {
inherit version;
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
};
in stdenv.mkDerivation (finalAttrs: {
pname = "surrealist";
version = "2.0.6";
src = fetchFromGitHub {
owner = "surrealdb";
repo = "surrealist";
rev = "surrealist-v${finalAttrs.version}";
hash = "sha256-5OiVqn+ujssxXZXC6pnGiG1Nw8cAhoDU5IIl9skywBw=";
};
sourceRoot = "${finalAttrs.src.name}/src-tauri";
ui = stdenvNoCC.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-ui";
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-apvU7nanzueaF7PEQL7EKjVT5z1M6I7PZpEIJxfKuCQ=";
};
ESBUILD_BINARY_PATH = "${lib.getExe esbuild-20-2}";
nativeBuildInputs = [ nodejs pnpm.configHook ];
buildPhase = ''
runHook preBuild
pnpm build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (finalAttrs) src sourceRoot version;
name = "${finalAttrs.pname}-${finalAttrs.version}";
hash = "sha256-uE4r0smgSbl4l77/MsHtn1Ar5fqspsYcLC/u8TUrcu8=";
};
nativeBuildInputs = [
cargo
cargo-tauri
makeBinaryWrapper
pkg-config
rustc
rustPlatform.cargoSetupHook
];
buildInputs =
[ cairo gdk-pixbuf gobject-introspection libsoup openssl pango webkitgtk ];
env = {
OPENSSL_NO_VENDOR = 1;
};
postPatch = ''
substituteInPlace ./tauri.conf.json \
--replace-fail '"distDir": "../dist",' '"distDir": "${finalAttrs.ui}",' \
--replace-fail '"beforeBuildCommand": "pnpm build",' '"beforeBuildCommand": "",'
'';
postBuild = ''
cargo tauri build --bundles deb
'';
postInstall = ''
install -Dm555 target/release/bundle/deb/surrealist_${finalAttrs.version}_*/data/usr/bin/surrealist -t $out/bin
cp -r target/release/bundle/deb/surrealist_${finalAttrs.version}_*/data/usr/share $out
'';
postFixup = ''
wrapProgram "$out/bin/surrealist" --set WEBKIT_DISABLE_COMPOSITING_MODE 1
'';
meta = with lib; {
description = "Surrealist is the ultimate way to visually manage your SurrealDB database";
homepage = "https://surrealdb.com/surrealist";
license = licenses.mit;
mainProgram = "surrealist";
maintainers = with maintainers; [ frankp ];
platforms = platforms.linux;
};
})
|