-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathflake.nix
More file actions
88 lines (70 loc) · 2.25 KB
/
flake.nix
File metadata and controls
88 lines (70 loc) · 2.25 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
{
description = "VnKey — Vietnamese input method (Fcitx5 & IBus)";
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};
vnkey-engine = pkgs.rustPlatform.buildRustPackage {
pname = "vnkey-engine";
version = "1.0.1";
src = ./vnkey-engine;
cargoLock.lockFile = ./vnkey-engine/Cargo.lock;
# Chỉ build static library
buildPhase = ''
cargo build --release
'';
installPhase = ''
mkdir -p $out/lib $out/include
cp target/release/libvnkey_engine.a $out/lib/
cp src/vnkey-engine.h $out/include/ 2>/dev/null || true
'';
};
vnkey-fcitx5 = pkgs.stdenv.mkDerivation {
pname = "vnkey-fcitx5";
version = "1.0.1";
src = ./vnkey-fcitx5;
nativeBuildInputs = with pkgs; [
cmake
pkg-config
];
buildInputs = with pkgs; [
fcitx5
];
cmakeFlags = [
"-DVNKEY_ENGINE_LIB_DIR=${vnkey-engine}/lib"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DFCITX_INSTALL_ADDONDIR=${placeholder "out"}/lib/fcitx5"
"-DFCITX_INSTALL_PKGDATADIR=${placeholder "out"}/share/fcitx5"
];
};
vnkey-ibus = pkgs.stdenv.mkDerivation {
pname = "vnkey-ibus";
version = "1.0.1";
src = ./vnkey-ibus;
nativeBuildInputs = with pkgs; [
cmake
pkg-config
];
buildInputs = with pkgs; [
ibus
glib
];
cmakeFlags = [
"-DVNKEY_ENGINE_LIB_DIR=${vnkey-engine}/lib"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DIBUS_LIBEXECDIR=${placeholder "out"}/libexec"
"-DIBUS_COMPONENT_DIR=${placeholder "out"}/share/ibus/component"
];
};
in {
packages = {
inherit vnkey-engine vnkey-fcitx5 vnkey-ibus;
default = vnkey-fcitx5;
};
}
);
}