-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
139 lines (123 loc) · 4.5 KB
/
Copy pathflake.nix
File metadata and controls
139 lines (123 loc) · 4.5 KB
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
{
description = "annot — Human-in-the-loop annotation for AI workflows (Tauri v2 + SvelteKit)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
# GStreamer plugin path for WebKit2GTK media support (Linux only)
gstPluginPath = pkgs.lib.optionalString isLinux (
pkgs.lib.concatStringsSep ":" [
"${pkgs.gst_all_1.gstreamer.out}/lib/gstreamer-1.0"
"${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0"
"${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0"
"${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0"
]
);
in
{
# Formatter (nixfmt)
formatter = pkgs.nixfmt;
# Binary package (requires pre-built artifacts from `pnpm tauri build`)
# Install with: nix profile add path:. --impure
# Remove with: nix profile remove annot
packages.default =
pkgs.runCommand "annot"
{
nativeBuildInputs = [ pkgs.makeWrapper ];
meta.mainProgram = "annot";
}
(
if isDarwin then
''
mkdir -p $out/bin
makeWrapper ${./src-tauri/target/release/annot} $out/bin/annot
''
else
''
mkdir -p $out/bin
makeWrapper ${./src-tauri/target/release/annot} $out/bin/annot \
--set GDK_BACKEND x11 \
--set WEBKIT_DISABLE_DMABUF_RENDERER 1 \
--set GST_PLUGIN_SYSTEM_PATH "${gstPluginPath}" \
--set GIO_MODULE_DIR "${pkgs.glib-networking}/lib/gio/modules"
''
);
# Development shell
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
cargo
rustc
rustfmt
clippy
nodejs_24
pnpm
];
buildInputs =
with pkgs;
[ openssl ]
++ pkgs.lib.optionals isLinux [
# Tauri v2 WebView (WebKit2GTK 4.1)
webkitgtk_4_1
gtk3
glib
glib-networking
libsoup_3
cairo
pango
gdk-pixbuf
librsvg
at-spi2-atk
at-spi2-core
# GStreamer (media/video support for WebKit)
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
# Clipboard support (arboard X11 backend)
libxcb
xclip
# tauri-plugin-opener
xdg-utils
];
shellHook = ''
# OpenSSL pkg-config path
export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
${pkgs.lib.optionalString isLinux ''
# WebKitGTK pkg-config
export PKG_CONFIG_PATH="${pkgs.webkitgtk_4_1.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
# GStreamer plugin discovery
export GST_PLUGIN_SYSTEM_PATH="${gstPluginPath}"
# Force X11 (WebKit2GTK Wayland/DMABuf is broken on NixOS)
export GDK_BACKEND=x11
export WEBKIT_DISABLE_DMABUF_RENDERER=1
# GIO modules for TLS support
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
''}
# Use nixpkgs pnpm directly (disable corepack strict mode)
export COREPACK_ENABLE_STRICT=0
echo "annot dev shell ready (${if isDarwin then "macOS" else "Linux"})"
echo " pnpm install — install JS dependencies"
echo " pnpm tauri dev — start dev server + Tauri window"
echo " pnpm tauri build — production build"
echo " pnpm demo — open demo with test fixture"
echo " pnpm test — run vitest suite"
echo " pnpm check — svelte-check typecheck"
echo " pnpm run — list all available scripts"
'';
};
}
);
}