2018-07-21 01:44:44 +01:00
{ stdenv , fetchFromGitHub , pkgconfig , 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 {
2019-08-15 13:41:18 +01:00
pname = " x o r g x r d p " ;
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 = " n e u t r i n o l a b s " ;
repo = " x o r g x r d p " ;
rev = " v ${ version } " ;
2019-01-16 15:04:37 +00:00
sha256 = " 1 b h p 5 x 4 7 h a j h i n v g l m c 4 v x x n p j v f j m 6 3 6 9 n j b 3 g h q f r 7 c 5 x y p v z r " ;
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 {
2019-01-16 15:04:37 +00:00
version = " 0 . 9 . 9 " ;
2019-08-15 13:41:18 +01:00
pname = " x r d p " ;
2017-07-29 16:16:19 +01:00
2017-01-05 23:14:35 +00:00
src = fetchFromGitHub {
owner = " v o l t h " ;
repo = " x r d p " ;
2019-01-16 15:04:37 +00:00
rev = " r e f s / t a g 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-05 23:14:35 +00:00
fetchSubmodules = true ;
2019-01-16 15:04:37 +00:00
sha256 = " 0 y n j 6 p m l 4 f 3 8 y 8 5 7 1 r y h i f z a 5 7 w f q g 4 f r d r j c w z w 3 f m r y i z n f m 1 z " ;
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 ;
2017-07-31 01:42:56 +01: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-05 23:14:35 +00:00
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
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 stdenv . lib ; {
description = " A n o p e n s o u r c e R D P s e r v e r " ;
2020-04-01 02:11:51 +01:00
homepage = " h t t p s : / / g i t h u b . c o m / n e u t r i n o l a b s / x r d p " ;
2017-01-05 23:14:35 +00:00
license = licenses . asl20 ;
maintainers = [ maintainers . volth ] ;
platforms = platforms . linux ;
} ;
} ;
in xrdp