-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
112 lines (110 loc) · 3.02 KB
/
flake.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
description = "draken development shell";
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs = {
follows = "nixpkgs";
};
flake-utils = {
follows = "flake-utils";
};
};
};
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
android_sdk = {
accept_license = true;
};
};
};
rustToolchain = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
extensions = ["rust-src" "clippy" "llvm-tools"];
};
androidEnv = pkgs.androidenv.override {licenseAccepted = true;};
androidComposition = androidEnv.composeAndroidPackages {
includeEmulator = true;
includeNDK = true;
emulatorVersion = "34.1.9";
platformToolsVersion = "33.0.3";
buildToolsVersions = ["30.0.3"];
ndkVersions = ["26.1.10909125"];
platformVersions = ["33"];
};
nativeBuildInputs = with pkgs; [
androidComposition.androidsdk
androidComposition.ndk-bundle
rustToolchain
pkg-config
lldb
jetbrains.jdk
];
libraries = with pkgs; [
webkitgtk
webkitgtk_4_1
libsoup
openssl_3
atk
cairo
gdk-pixbuf
dbus
zlib
lldb
];
tauri_packages = with pkgs; [
wget
pkg-config
atk
libsoup_3
webkitgtk
webkitgtk_4_1
openssl_3
librsvg
];
buildInputs = with pkgs;
[
rust-analyzer
nodejs_20
corepack_20
grcov
]
++ tauri_packages;
in
with pkgs; {
devShells.default = mkShell rec {
inherit buildInputs nativeBuildInputs;
RUST_BACKTRACE = 1;
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libraries;
NIX_LD = "${pkgs.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2";
ANDROID_HOME = "${androidComposition.androidsdk}/libexec/android-sdk";
NDK_HOME = "${ANDROID_HOME}/ndk-bundle";
NDK_LIBS = "${NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib";
JAVA_HOME = "${pkgs.jetbrains.jdk}";
shellHook = ''
export LD_LIBRARY_PATH=${NDK_LIBS}:${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
'';
};
}
);
}