-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstickerbucket.nix
89 lines (79 loc) · 1.97 KB
/
stickerbucket.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
77
78
79
80
81
82
83
84
85
86
87
88
89
{
lib,
stdenv,
rustPlatform,
cargo,
buildGoModule,
fetchFromGitHub,
cargo-tauri,
esbuild,
wrapGAppsHook3,
nodejs,
pkg-config,
rustc,
libayatana-appindicator,
pnpm,
llvmPackages,
libraries ? lib.throw "libraries must be specified"
}:
stdenv.mkDerivation rec {
pname = "stickerbucket";
version = "0.0.0";
src = builtins.path {
name = "source";
path = ./.;
};
sourceRoot = "source/src-tauri";
postPatch = ''
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
--replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
'';
pnpmDeps = pnpm.fetchDeps {
pname = "${pname}-pnpm-deps";
inherit src version;
hash = "sha256-23Eph8mPnfKjKioytrAZ1tVAG6kbYx/LVMU+tL66ym0=";
};
pnpmRoot = "..";
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./src-tauri/Cargo.lock;
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
cargo-tauri
nodejs
llvmPackages.clang
pnpm.configHook
pkg-config
wrapGAppsHook3
];
buildInputs = libraries;
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
ESBUILD_BINARY_PATH = "${lib.getExe (esbuild.override {
buildGoModule = args:
buildGoModule (args
// rec {
version = "0.20.2";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
})}";
preConfigure = ''
# pnpm.configHook has to write to .., as our sourceRoot is set to src-tauri
# TODO: move frontend into its own drv
chmod +w ..
'';
preBuild = ''
# Use cargo-tauri from nixpkgs instead of pnpm tauri from npm
cargo tauri build -b deb
'';
preInstall = ''
mv target/release/bundle/deb/*/data/usr/ $out
'';
}