nixpkgs/pkgs/applications/networking/remote/xrdp/default.nix

106 lines
3.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, pkg-config, which, perl, autoconf, automake, libtool, openssl, systemd, pam, fuse, libjpeg, libopus, nasm, xorg }:
2017-01-05 23:14:35 +00:00
let
xorgxrdp = stdenv.mkDerivation rec {
pname = "xorgxrdp";
2019-01-16 15:04:37 +00:00
version = "0.2.9";
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
src = fetchFromGitHub {
owner = "neutrinolabs";
repo = "xorgxrdp";
rev = "v${version}";
2019-01-16 15:04:37 +00:00
sha256 = "1bhp5x47hajhinvglmc4vxxnpjvfjm6369njb3ghqfr7c5xypvzr";
2017-01-05 23:14:35 +00:00
};
nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm ];
2017-01-05 23:14:35 +00:00
buildInputs = [ xorg.xorgserver ];
postPatch = ''
# patch from Debian, allows to run xrdp daemon under unprivileged user
substituteInPlace module/rdpClientCon.c \
--replace 'g_sck_listen(dev->listen_sck);' 'g_sck_listen(dev->listen_sck); g_chmod_hex(dev->uds_data, 0x0660);'
substituteInPlace configure.ac \
--replace 'moduledir=`pkg-config xorg-server --variable=moduledir`' "moduledir=$out/lib/xorg/modules" \
--replace 'sysconfdir="/etc"' "sysconfdir=$out/etc"
'';
preConfigure = "./bootstrap";
configureFlags = [ "XRDP_CFLAGS=-I${xrdp.src}/common" ];
enableParallelBuilding = true;
};
xrdp = stdenv.mkDerivation rec {
2019-01-16 15:04:37 +00:00
version = "0.9.9";
pname = "xrdp";
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
src = fetchFromGitHub {
owner = "volth";
repo = "xrdp";
2019-01-16 15:04:37 +00:00
rev = "refs/tags/runtime-cfg-path-${version}"; # Fixes https://github.com/neutrinolabs/xrdp/issues/609; not a patch on top of the official repo because "xorgxrdp.configureFlags" above includes "xrdp.src" which must be patched already
2017-01-05 23:14:35 +00:00
fetchSubmodules = true;
2019-01-16 15:04:37 +00:00
sha256 = "0ynj6pml4f38y8571ryhifza57wfqg4frdrjcwzw3fmryiznfm1z";
2017-01-05 23:14:35 +00:00
};
nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm ];
2017-01-05 23:14:35 +00:00
buildInputs = [ openssl systemd pam fuse libjpeg libopus xorg.libX11 xorg.libXfixes xorg.libXrandr ];
postPatch = ''
substituteInPlace sesman/xauth.c --replace "xauth -q" "${xorg.xauth}/bin/xauth -q"
'';
preConfigure = ''
(cd librfxcodec && ./bootstrap && ./configure --prefix=$out --enable-static --disable-shared)
./bootstrap
'';
dontDisableStatic = true;
2017-07-31 01:42:56 +01:00
configureFlags = [ "--with-systemdsystemunitdir=/var/empty" "--enable-ipv6" "--enable-jpeg" "--enable-fuse" "--enable-rfxcodec" "--enable-opus" ];
2017-01-05 23:14:35 +00:00
installFlags = [ "DESTDIR=$(out)" "prefix=" ];
postInstall = ''
2017-03-31 02:37:06 +01:00
# remove generated keys (as non-determenistic) and upstart script
rm $out/etc/xrdp/{rsakeys.ini,key.pem,cert.pem,xrdp.sh}
2017-01-05 23:14:35 +00:00
cp $src/keygen/openssl.conf $out/share/xrdp/openssl.conf
substituteInPlace $out/etc/xrdp/sesman.ini --replace /etc/xrdp/pulse $out/etc/xrdp/pulse
# remove all session types except Xorg (they are not supported by this setup)
${perl}/bin/perl -i -ne 'print unless /\[(X11rdp|Xvnc|console|vnc-any|sesman-any|rdp-any|neutrinordp-any)\]/ .. /^$/' $out/etc/xrdp/xrdp.ini
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
# remove all session types and then add Xorg
${perl}/bin/perl -i -ne 'print unless /\[(X11rdp|Xvnc|Xorg)\]/ .. /^$/' $out/etc/xrdp/sesman.ini
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
cat >> $out/etc/xrdp/sesman.ini <<EOF
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
[Xorg]
param=${xorg.xorgserver}/bin/Xorg
param=-modulepath
param=${xorgxrdp}/lib/xorg/modules,${xorg.xorgserver}/lib/xorg/modules
param=-config
param=${xorgxrdp}/etc/X11/xrdp/xorg.conf
param=-noreset
param=-nolisten
param=tcp
param=-logfile
param=.xorgxrdp.%s.log
EOF
'';
enableParallelBuilding = true;
meta = with lib; {
2017-01-05 23:14:35 +00:00
description = "An open source RDP server";
homepage = "https://github.com/neutrinolabs/xrdp";
2017-01-05 23:14:35 +00:00
license = licenses.asl20;
maintainers = [ maintainers.volth ];
platforms = platforms.linux;
};
};
in xrdp