-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
237 lines (217 loc) · 8.42 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
{
description = "zknotes, a web based zettelkasten";
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-24.05"; };
flake-utils.url = "github:numtide/flake-utils";
# naersk.url = "github:nmattia/naersk";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, fenix }:
let
# mytauri = { pkgs }: pkgs.callPackage ./tauri/my-tauri.nix { };
# mytaurimobile = { pkgs }: pkgs.callPackage ./tauri/my-tauri-mobile.nix { };
# mtpkgs = nixpkgs // { rust = nixpkgs.rust_1_76; rustPackages = nixpkgs.rustPackages_1_76; } ;
in
flake-utils.lib.eachDefaultSystem (
system:
let
pname = "zknotes";
# naersk-lib = naersk.lib."${system}";
# elm-stuff = makeElmPkg { inherit pkgs; };
# rust-stuff = naersk-lib.buildPackage {
# pname = pname;
# root = ./.;
# buildInputs = with pkgs; [
# cargo
# rustc
# sqlite
# pkgconfig
# openssl.dev
# ];
# };
# fenix stuff for adding other compile targets
mkToolchain = fenix.packages.${system}.combine;
toolchain = fenix.packages.${system}.stable;
# toolchain = fenix.packages.${system}.default;
target1 = fenix.packages.${system}.targets."aarch64-linux-android".stable;
target2 = fenix.packages.${system}.targets."armv7-linux-androideabi".stable;
target3 = fenix.packages.${system}.targets."i686-linux-android".stable;
target4 = fenix.packages.${system}.targets."x86_64-linux-android".stable;
mobileTargets = mkToolchain (with toolchain; [
cargo
rustc
target1.rust-std
target2.rust-std
target3.rust-std
target4.rust-std
]);
# pkgs = nixpkgs.legacyPackages."${system}" {
pkgs = import nixpkgs {
config.android_sdk.accept_license = true;
config.allowUnfree = true;
system = "${system}";
# overlays = [ rust-overlay.overlays.default ];
# overlays = [ (self: super: super // { cargo = toolchain.cargo; rustc = toolchain.rustc; }) ];
# overlays = [ fenix.overlays.default ];
# rustPlatform = nixpkgs.makeRustPlatform { cargo = toolchain; rustc = toolchain; };
};
# mytauri = { pkgs }: pkgs.callPackage ./tauri/my-tauri.nix { };
# my-tauri = mytauri { inherit pkgs; };
# my-tauri = pkgs.callPackage ./tauri/my-tauri.nix {
# rustPlatform = pkgs.makeRustPlatform { cargo = toolchain; rustc = toolchain; };
# };
# my-tauri = pkgs.callPackage ./tauri/my-tauri.nix {
# inherit (pkgs.rustPackages_1_76) rustPlatform;
# };
# wasn't making `cargo tauri` work last time I tried
# mtplatform = pkgs.makeRustPlatform { inherit (fenix.packages.${system}.stable) cargo rustc; };
# mytauri = { pkgs }: pkgs.callPackage ./tauri/my-tauri.nix { rustPlatform = mtplatform; };
# my-tauri = mytauri { inherit pkgs; };
# my-tauri-mobile = mytaurimobile { inherit pkgs; };
libraries = with pkgs;[
gcc13
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
# dbus
openssl_3
librsvg
];
in
rec {
inherit pname;
# `nix build`
# packages.${pname} = pkgs.stdenv.mkDerivation {
# nativeBuildInputs = [ pkgs.makeWrapper ];
# name = pname;
# src = ./.;
# # building the 'out' folder
# installPhase = ''
# mkdir -p $out/share/zknotes/static
# mkdir $out/bin
# cp -r $src/server/static $out/share/zknotes
# cp ${elm-stuff}/main.js $out/share/zknotes/static
# cp -r ${rust-stuff}/bin $out
# mv $out/bin/zknotes-server $out/bin/.zknotes-server
# makeWrapper $out/bin/.zknotes-server $out/bin/zknotes-server --set ZKNOTES_STATIC_PATH $out/share/zknotes/static;
# '';
# };
# defaultPackage = packages.${pname};
# `nix run`
# apps.${pname} = flake-utils.lib.mkApp {
# drv = packages.${pname};
# };
# defaultApp = apps.${pname};
# meh = pkgs.androidenv.androidPkgs_9_0 // { android_sdk.accept_license = true; };
# androidComposition = pkgs.androidenv.androidPkgs_9_0 // { includeNDK = true; };
androidEnv = pkgs.androidenv.override { licenseAccepted = true; };
androidComposition = androidEnv.composeAndroidPackages {
includeNDK = true;
# platformToolsVersion = "34.0.5";
# buildToolsVersions = [ "34.0.0" ];
# platformVersions = [ "33" ];
extraLicenses = [
"android-googletv-license"
"android-sdk-arm-dbt-license"
"android-sdk-license"
"android-sdk-preview-license"
"google-gdk-license"
"intel-android-extra-license"
"intel-android-sysimage-license"
"mips-android-sysimage-license"
];
};
# `nix develop`
devShell = pkgs.mkShell {
NIX_LD = "${pkgs.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2";
ANDROID_HOME = "${androidComposition.androidsdk}/libexec/android-sdk";
NDK_HOME = "${androidComposition.androidsdk}/libexec/android-sdk/ndk/${builtins.head (pkgs.lib.lists.reverseList (builtins.split "-" "${androidComposition.ndk-bundle}"))}";
shellHook =
''
# export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS
'';
nativeBuildInputs = with pkgs; [
androidComposition.androidsdk
androidComposition.ndk-bundle
# cargo
# rustc
cargo-watch
rustfmt
rust-analyzer
sqlite
openssl.dev
# aarch64-linux-android-pkgs.sqlite
# aarch64-linux-android-pkgs.openssl.dev
pkg-config
elm2nix
elmPackages.elm
elmPackages.elm-analyse
elmPackages.elm-doc-preview
elmPackages.elm-format
elmPackages.elm-live
elmPackages.elm-test
elmPackages.elm-upgrade
elmPackages.elm-xref
elmPackages.elm-language-server
elmPackages.elm-verify-examples
elmPackages.elmi-to-json
elmPackages.elm-optimize-level-2
# extra stuff for tauri
# my-tauri
curl
wget
# dbus
# openssl_3
# gcc13
glib
gtk3
libsoup
# webkitgtk
librsvg
# wut
cairo
# cargo-tauri
atk
# glib
# dbus
# webkitgtk
# librsvg
# gst stuff for tauri AV
# Video/Audio data composition framework tools like "gst-inspect", "gst-launch" ...
gst_all_1.gstreamer
# Common plugins like "filesrc" to combine within e.g. gst-launch
gst_all_1.gst-plugins-base
# Specialized plugins separated by quality
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
# Plugins to reuse ffmpeg to play almost every video format
gst_all_1.gst-libav
# Support the Video Audio (Hardware) Acceleration API
gst_all_1.gst-vaapi
# for tauti-mobile
# librsvg
webkitgtk_4_1
# tauri-mobile
# my-tauri-mobile
libxml2
lldb
nodejs
# rustup # `cargo tauri android init` wants this, even though targets already installed.
# should be fixed though, https://github.com/tauri-apps/tauri/issues/7044
alsa-lib
mobileTargets
# they suggest using the jbr (jetbrains runtime?) from android-studio, but that is not accessible.
jetbrains.jdk
];
};
}
);
}