-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfilespider.nix
76 lines (68 loc) · 1.67 KB
/
filespider.nix
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
{ lib
, fetchFromGitHub
, fetchYarnDeps
, mkYarnPackage
, callPackage
, cargo-tauri
, dpkg
, cmake
, dbus
, freetype
, gtk3
, libsoup
, openssl
, pkg-config
, webkitgtk
}:
let
fs = lib.fileset;
version = "nix-build";
name = "filespider";
source = fetchFromGitHub {
owner = "Kruemmelspalter";
repo = name;
rev = version;
hash = "sha256-nPBu2lfltd/EthfV3GIOl+Zj8gqQR0jZ6dZgnOAS55E=";
};
frontend-build = mkYarnPackage rec {
src = source;
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
sha256 = "sha256-ts5WW422nUboTRp29jZ58gx+5aIPcPz/jjzR3Wo5zZU=";
};
packageJSON = src + "/package.json";
buildPhase = ''
export HOME=$(mktemp -d)
yarn run --offline build
cp -r deps/filespider/dist $out
'';
distPhase = "true";
dontInstall = true;
};
mkRustPlatform = callPackage ./rust-nightly.nix {};
rustPlatform = mkRustPlatform {
date = "2024-01-01";
channel = "nightly";
};
in
rustPlatform.buildRustPackage rec {
inherit version name;
pname = name;
src = source + "/src-tauri";
buildInputs = [ dbus openssl freetype libsoup gtk3 webkitgtk cmake cargo-tauri dpkg ];
nativeBuildInputs = [ pkg-config ];
lockFile = src + "/Cargo.lock";
cargoLock = {
inherit lockFile;
};
buildPhase = ''
${cargo-tauri.outPath}/bin/cargo-tauri build -b deb \
-c '{"build" : {"distDir": "${frontend-build.outPath}", "beforeBuildCommand": "true"}}'
'';
installPhase = ''
${dpkg.outPath}/bin/dpkg-deb -x target/release/bundle/deb/*.deb $out
mv $out/usr/* $out
rmdir $out/usr
mv $out/bin/migrator $out/bin/filespider-migrate
'';
}