2017-01-06 00:14:35 +01: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-07-29 17:16:19 +02:00
version = " 0 . 2 . 3 " ;
2017-01-06 00:14:35 +01: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-07-29 17:16:19 +02:00
sha256 = " 0 l 1 b 3 8 j 3 q 9 m x y b 8 f f p d p l b q s 6 r n a b j 9 2 i 8 w n g r w l k h f h 2 c 8 8 s z n 1 " ;
2017-01-06 00:14:35 +01: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-07-29 17:16:19 +02:00
version = " 0 . 9 . 3 " ;
name = " x r d p - ${ version } " ;
2017-01-06 00:14:35 +01:00
src = fetchFromGitHub {
owner = " v o l t h " ;
repo = " x r d p " ;
2017-07-29 17:16:19 +02:00
rev = " r e f s / h e a d s / r u n t i m e - c f g - p a t h - ${ 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-06 00:14:35 +01:00
fetchSubmodules = true ;
2017-07-29 17:16:19 +02:00
sha256 = " 0 x q y g 3 m 6 8 8 f j 4 4 2 z g g 9 f q m b z 7 n n z v q p d 7 a 9 k i 2 c w h 1 h y i b a c p m z 7 " ;
2017-01-06 00:14:35 +01: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 ;
2017-07-31 02:42:56 +02:00
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 = / v a r / e m p t y " " - - 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 " ] ;
2017-01-06 00:14:35 +01:00
installFlags = [ " D E S T D I R = $ ( o u t ) " " p r e f i x = " ] ;
postInstall = ''
2017-03-31 03:37:06 +02:00
# remove generated keys (as non-determenistic) and upstart script
rm $ out/etc/xrdp / { rsakeys . ini , key . pem , cert . pem , xrdp . sh }
2017-01-06 00:14:35 +01: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 17:16:19 +02:00
2017-01-06 00:14:35 +01: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 17:16:19 +02:00
2017-01-06 00:14:35 +01:00
cat > > $ out/etc/xrdp/sesman.ini < < EOF
2017-07-29 17:16:19 +02:00
2017-01-06 00:14:35 +01: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 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