Merge pull request #271496 from MDM23/create-surrealist

surrealist: init at 1.11.5
This commit is contained in:
Pol Dellaiera 2024-03-02 23:41:57 +01:00 committed by GitHub
commit 29fb642d2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4105 additions and 0 deletions

View file

@ -6560,6 +6560,11 @@
githubId = 726447;
name = "Francisco Demartino";
};
frankp = {
github = "MDM23";
githubId = 10290864;
name = "Peter Frank";
};
franzmondlichtmann = {
name = "Franz Schroepf";
email = "franz-schroepf@t-online.de";

3914
pkgs/by-name/su/surrealist/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,186 @@
{ buildGoModule
, cacert
, cairo
, cargo
, cargo-tauri
, esbuild
, fetchFromGitHub
, gdk-pixbuf
, gobject-introspection
, jq
, lib
, libsoup
, llvmPackages_15
, makeBinaryWrapper
, moreutils
, nodePackages
, pango
, pkg-config
, rustc
, rustPlatform
, stdenv
, stdenvNoCC
, wasm-bindgen-cli
, webkitgtk
}:
stdenv.mkDerivation (finalAttrs: {
pname = "surrealist";
version = "1.11.5";
src = fetchFromGitHub {
owner = "StarlaneStudios";
repo = "Surrealist";
rev = "v${finalAttrs.version}";
hash = "sha256-9hm45bTvOhDHYYFUs7nTdOkHOsDJUiqDv8F6wQqEdFs=";
};
sourceRoot = "${finalAttrs.src.name}/src-tauri";
embed = stdenv.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-embed";
sourceRoot = "${finalAttrs.src.name}/src-embed";
auditable = false;
dontInstall = true;
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (finalAttrs) src;
sourceRoot = "${finalAttrs.src.name}/src-embed";
hash = "sha256-sf1sn3lOKvUu5MXxdMohS1DJ8jP9icZGftJKhrWA/JE=";
};
nativeBuildInputs = [
cargo
rustc
llvmPackages_15.clangNoLibc
llvmPackages_15.lld
rustPlatform.cargoSetupHook
wasm-bindgen-cli
];
postBuild = ''
CC=clang CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER=lld cargo build \
--target wasm32-unknown-unknown \
--release
wasm-bindgen \
target/wasm32-unknown-unknown/release/surrealist_embed.wasm \
--out-dir $out \
--out-name surrealist-embed \
--target web
'';
};
pnpm-deps = stdenvNoCC.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-pnpm-deps";
dontFixup = true;
nativeBuildInputs = [ cacert jq moreutils nodePackages.pnpm ];
postInstall = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
# use --ignore-script and --no-optional to avoid downloading binaries
# use --frozen-lockfile to avoid checking git deps
pnpm install --frozen-lockfile --no-optional --ignore-script
# Remove timestamp and sort the json files
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';
outputHashMode = "recursive";
outputHash = "sha256-jT0Bw0xiusOw/5o6EUaEV3/GqkD/l6jkwXmOqc3a/nc=";
};
ui = stdenvNoCC.mkDerivation {
inherit (finalAttrs) src version;
pname = "${finalAttrs.pname}-ui";
dontFixup = true;
ESBUILD_BINARY_PATH = let version = "0.18.20";
in "${lib.getExe (esbuild.override {
buildGoModule = args:
buildGoModule (args // {
inherit version;
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-mED3h+mY+4H465m02ewFK/BgA1i/PQ+ksUNxBlgpUoI=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
})}";
nativeBuildInputs = [ nodePackages.pnpm ];
postPatch = ''
ln -s ${finalAttrs.embed} src/generated
'';
postBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${finalAttrs.pnpm-deps}
pnpm install --offline --frozen-lockfile --no-optional --ignore-script
pnpm build
'';
postInstall = ''
cp -r dist $out
'';
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"tauri-plugin-localhost-0.1.0" =
"sha256-7PJgz6t/jPEwX/2xaOe0SYawfPSZw/F1QtOrc6iPiP0=";
};
};
nativeBuildInputs = [
cargo
cargo-tauri
makeBinaryWrapper
pkg-config
rustc
rustPlatform.cargoSetupHook
];
buildInputs =
[ cairo gdk-pixbuf gobject-introspection libsoup pango webkitgtk ];
postPatch = ''
substituteInPlace ./tauri.conf.json \
--replace '"distDir": "../dist",' '"distDir": "${finalAttrs.ui}",' \
--replace '"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 = "Powerful graphical SurrealDB query playground and database explorer for Browser and Desktop";
homepage = "https://surrealist.starlane.studio";
license = licenses.mit;
mainProgram = "surrealist";
maintainers = with maintainers; [ frankp ];
platforms = platforms.linux;
};
})