nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 cmake,
5 curl,
6 xorg,
7 avahi,
8 qtbase,
9 mkDerivation,
10 openssl,
11 wrapGAppsHook3,
12 avahiWithLibdnssdCompat ? avahi.override { withLibdnssdCompat = true; },
13 fetchpatch,
14}:
15
16mkDerivation rec {
17 pname = "barrier";
18 version = "2.4.0";
19
20 src = fetchFromGitHub {
21 owner = "debauchee";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-2tHqLF3zS3C4UnOVIZfpcuzaemC9++nC7lXgFnFSfKU=";
25 fetchSubmodules = true;
26 };
27
28 patches = [
29 # This patch can be removed when a new version of barrier (greater than 2.4.0)
30 # is released, which will contain this commit.
31 (fetchpatch {
32 name = "add-missing-cstddef-header.patch";
33 url = "https://github.com/debauchee/barrier/commit/4b12265ae5d324b942698a3177e1d8b1749414d7.patch";
34 sha256 = "sha256-ajMxP7szBFi4h8cMT3qswfa3k/QiJ1FGI3q9fkCFQQk=";
35 })
36 ];
37
38 CXXFLAGS = [
39 # error: 'uint8_t' is not a member of 'std'; did you mean 'wint_t'?
40 "-include cstdint"
41 ];
42
43 buildInputs = [
44 curl
45 xorg.libX11
46 xorg.libXext
47 xorg.libXtst
48 avahiWithLibdnssdCompat
49 qtbase
50 ];
51 nativeBuildInputs = [
52 cmake
53 wrapGAppsHook3
54 ];
55
56 postFixup = ''
57 substituteInPlace "$out/share/applications/barrier.desktop" --replace "Exec=barrier" "Exec=$out/bin/barrier"
58 '';
59
60 qtWrapperArgs = [
61 ''--prefix PATH : ${lib.makeBinPath [ openssl ]}''
62 ];
63
64 meta = {
65 description = "Open-source KVM software";
66 longDescription = ''
67 Barrier is KVM software forked from Symless's synergy 1.9 codebase.
68 Synergy was a commercialized reimplementation of the original
69 CosmoSynergy written by Chris Schoeneman.
70 '';
71 homepage = "https://github.com/debauchee/barrier";
72 downloadPage = "https://github.com/debauchee/barrier/releases";
73 license = lib.licenses.gpl2;
74 maintainers = [ lib.maintainers.phryneas ];
75 platforms = lib.platforms.linux;
76 mainProgram = "barrier";
77 };
78}