2017-01-05 23:14:35 +00:00
{ stdenv , fetchFromGitHub , fetchpatch , pkgconfig , which , perl , autoconf , automake , libtool , openssl , systemd , pam , fuse , libjpeg , libopus , nasm , xorg }:
let
xorgxrdp = stdenv . mkDerivation rec {
name = " x o r g x r d p - ${ version } " ;
2017-03-31 02:37:06 +01:00
version = " 0 . 2 . 1 " ;
2017-01-05 23:14:35 +00:00
src = fetchFromGitHub {
owner = " n e u t r i n o l a b s " ;
repo = " x o r g x r d p " ;
rev = " v ${ version } " ;
2017-03-31 02:37:06 +01:00
sha256 = " 1 3 7 1 3 q s 1 v 7 9 x a 0 2 i w 6 v a j 9 b 2 q 6 2 i x 7 7 0 a 3 2 z 5 6 q l 0 5 d 6 y v f d s f h i " ;
2017-01-05 23:14:35 +00:00
} ;
nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ] ;
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 , 0 x0660 ) ; '
substituteInPlace configure . ac \
- - replace ' moduledir = ` pkg-config xorg-server - - variable = moduledir ` ' " m o d u l e d i r = $ o u t / l i b / x o r g / m o d u l e s " \
- - replace ' sysconfdir = " / e t c " ' " s y s c o n f d i r = $ o u t / e t c "
'' ;
preConfigure = " . / b o o t s t r a p " ;
configureFlags = [ " X R D P _ C F L A G S = - I ${ xrdp . src } / c o m m o n " ] ;
enableParallelBuilding = true ;
} ;
xrdp = stdenv . mkDerivation rec {
2017-03-31 02:37:06 +01:00
version = " 0 . 9 . 2 " ;
rev = " 4 8 c 2 6 a 3 " ; # 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 fixed already
2017-01-05 23:14:35 +00:00
name = " x r d p - ${ version } . ${ rev } " ;
src = fetchFromGitHub {
owner = " v o l t h " ;
repo = " x r d p " ;
rev = rev ;
fetchSubmodules = true ;
2017-03-31 02:37:06 +01:00
sha256 = " 0 z s 0 3 a m s h m v y 6 5 d 2 6 v s v 3 1 n 9 j f l k j f 4 3 v s j h g 4 c r z i f k a 3 v z 9 p 1 6 " ;
2017-01-05 23:14:35 +00:00
} ;
nativeBuildInputs = [ pkgconfig autoconf automake which libtool nasm ] ;
buildInputs = [ openssl systemd pam fuse libjpeg libopus xorg . libX11 xorg . libXfixes xorg . libXrandr ] ;
postPatch = ''
substituteInPlace sesman/xauth.c - - replace " x a u t h - q " " ${ xorg . xauth } / b i n / x a u t h - q "
'' ;
preConfigure = ''
( cd librfxcodec && ./bootstrap && ./configure - - prefix = $ out - - enable-static - - disable-shared )
./bootstrap
'' ;
dontDisableStatic = true ;
configureFlags = [ " - - w i t h - s y s t e m d s y s t e m u n i t d i r = . / d o - n o t - i n s t a l l " " - - e n a b l e - i p v 6 " " - - e n a b l e - j p e g " " - - e n a b l e - f u s e " " - - e n a b l e - r f x c o d e c " " - - e n a b l e - o p u s " ] ;
installFlags = [ " D E S T D I R = $ ( o u t ) " " p r e f i x = " ] ;
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
# remove all session types and then add Xorg
$ { perl } /bin/perl - i - ne ' print unless / \ [ ( X11rdp | Xvnc | Xorg ) \ ] / . . / ^ $ / ' $ out/etc/xrdp/sesman.ini
cat > > $ out/etc/xrdp/sesman.ini < < EOF
[ 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 stdenv . lib ; {
description = " A n o p e n s o u r c e R D P s e r v e r " ;
homepage = https://github.com/neutrinolabs/xrdp ;
license = licenses . asl20 ;
maintainers = [ maintainers . volth ] ;
platforms = platforms . linux ;
} ;
} ;
in xrdp