-
-
Save ottidmes/86d1c6864e1b5d9db036ed03f5848754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, lib, fetchurl, makeWrapper, dpkg, systemd, xorg, qt5, openssl, hicolor_icon_theme }: | |
with lib; | |
let | |
deps = [ | |
systemd.lib | |
stdenv.cc.cc.lib | |
xorg.libX11 | |
xorg.libXi | |
xorg.libXtst | |
xorg.libXext | |
qt5.qtbase | |
qt5.qtdeclarative | |
qt5.qtquickcontrols | |
openssl | |
hicolor_icon_theme | |
]; | |
in stdenv.mkDerivation rec { | |
name = "${pname}-${version}"; | |
pname = "synergy"; | |
version = "2.0.5"; | |
src = fetchurl { | |
url = https://binaries.symless.com/v2.0.5/synergy_2.0.5.stable~b1345%2B3f23b557_amd64.deb; | |
sha256 = "1pvp8j5qda1dih7z22w839dbykkf9m1b6qc9bhyg9gsqs5dm0xxv"; | |
name = "${package-name}_${version}.stable_amd64.deb"; | |
}; | |
nativeBuildInputs = [ makeWrapper ]; | |
buildInputs = [ dpkg ] ++ deps; | |
# ./result/bin/synergy-tests: ./result/bin/synergy-tests: no version information available (required by ./result/bin/synergy-tests) | |
# https://github.com/NixOS/patchelf/issues/99#issuecomment-355536880 | |
dontStrip = true; | |
phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; | |
unpackPhase = '' | |
dpkg-deb -x $src . | |
''; | |
installPhase = '' | |
mkdir -p $out | |
cp -r ./usr/bin $out | |
cp -r ./usr/share $out | |
for elf in $out/bin/synergy-*; do | |
patchelf --set-interpreter "$(cat ${stdenv.cc}/nix-support/dynamic-linker)" --set-rpath ${makeLibraryPath deps} $elf | |
done | |
''; | |
meta = { | |
homepage = https://symless.com/synergy; | |
description = "Keyboard and mouse sharing solution. Synergy allows you to share one mouse and keyboard between multiple computers. Work seamlessly across Windows, macOS and Linux"; | |
license = licenses.unfree; | |
platforms = [ "x86_64-linux" ]; | |
maintainers = with maintainers; [ msteen ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FIXME: Should not be run as a systemd service. | |
# https://superuser.com/questions/759759/writing-a-service-that-depends-on-xorg/759891 | |
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.synergy2; | |
in { | |
options.services.synergy2 = { | |
enable = mkEnableOption "Synergy 2"; | |
}; | |
config = mkIf cfg.enable { | |
environment.systemPackages = with pkgs; [ synergy2 ]; | |
systemd.services.synergy2 = { | |
description = "Synergy 2, a keyboard and mouse sharing solution"; | |
after = [ "network.target" ]; | |
serviceConfig = { | |
Restart = "always"; | |
RestartSec = 0; | |
SyslogLevel = "err"; | |
Environment = "DISPLAY=:0.0"; | |
ExecStart = "${pkgs.synergy2}/bin/synergy-service"; | |
}; | |
wantedBy = [ "multi-user.target" ]; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment