-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
87 lines (76 loc) · 2.6 KB
/
flake.nix
File metadata and controls
87 lines (76 loc) · 2.6 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
{
description = "BeeCtl - Native Messaging Host for Browser's External Editor";
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};
# Build libuv with static library enabled
libuv-static = pkgs.libuv.overrideAttrs (oldAttrs: {
dontDisableStatic = true;
cmakeFlags = (oldAttrs.cmakeFlags or []) ++ [
"-DBUILD_SHARED_LIBS=OFF"
];
});
# Build cJSON with static library enabled
cjson-static = pkgs.cjson.overrideAttrs (oldAttrs: {
dontDisableStatic = true;
cmakeFlags = (oldAttrs.cmakeFlags or []) ++ [
"-DBUILD_SHARED_AND_STATIC_LIBS=ON"
"-DBUILD_SHARED_LIBS=OFF"
];
});
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "beectl";
version = "1.4.2-1";
src = ./.;
nativeBuildInputs = with pkgs; [
cmake
pkg-config
];
buildInputs = [
libuv-static
cjson-static
];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_SYSTEM_DEPS=ON"
];
postInstall = ''
# Fix hardcoded paths in CMakeLists.txt for NixOS
if [ -d "$out/usr/local/bin" ]; then
mkdir -p "$out/bin"
mv "$out/usr/local/bin/beectl" "$out/bin/"
rmdir -p "$out/usr/local/bin" || true
fi
if [ -d "$out/usr/lib/mozilla" ]; then
mkdir -p "$out/lib/mozilla"
mv "$out/usr/lib/mozilla/native-messaging-hosts" "$out/lib/mozilla/"
rmdir -p "$out/usr/lib/mozilla" || true
fi
if [ -d "$out/usr/lib64" ]; then
rm -rf "$out/usr/lib64"
fi
if [ -d "$out/usr" ]; then
rmdir -p "$out/usr" || true
fi
'';
meta = with pkgs.lib; {
description = "Native Messaging Host for the Bee Browser Extension <https://github.com/rosmanov/chrome-bee>";
homepage = "https://github.com/rosmanov/bee-host";
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
maintainers = [ ];
};
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/beectl";
};
});
}