xrdp: add xorgxrdp patched sources patch

Delightfully meta
This commit is contained in:
Charlotte Van Petegem 2023-08-19 15:44:56 +02:00
parent 0d346c0d16
commit e9c024d11f
No known key found for this signature in database
GPG key ID: 019E764B7184435A

154
patches/250189.patch Normal file
View file

@ -0,0 +1,154 @@
diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix
index 0fb74488f0bfb..c9072f1c0c46d 100644
--- a/pkgs/applications/networking/remote/xrdp/default.nix
+++ b/pkgs/applications/networking/remote/xrdp/default.nix
@@ -1,6 +1,19 @@
-{ lib, stdenv, fetchFromGitHub, pkg-config, which, perl, autoconf, automake, libtool, openssl, systemd, pam, fuse, libjpeg, libopus, nasm, xorg }:
+{ lib, stdenv, fetchFromGitHub, applyPatches, pkg-config, which, perl, autoconf, automake, libtool, openssl, systemd, pam, fuse, libjpeg, libopus, nasm, xorg }:
let
+ version = "0.9.22.1";
+ patchedXrdpSrc = applyPatches {
+ patches = [ ./dynamic_config.patch ];
+ name = "xrdp-patched-${version}";
+ src = fetchFromGitHub {
+ owner = "neutrinolabs";
+ repo = "xrdp";
+ rev = "v${version}";
+ fetchSubmodules = true;
+ hash = "sha256-8gAP4wOqSmar8JhKRt4qRRwh23coIn0Q8Tt9ClHQSt8=";
+ };
+ };
+
xorgxrdp = stdenv.mkDerivation rec {
pname = "xorgxrdp";
version = "0.9.19";
@@ -28,80 +41,71 @@ let
preConfigure = "./bootstrap";
- configureFlags = [ "XRDP_CFLAGS=-I${xrdp.src}/common" ];
+ configureFlags = [ "XRDP_CFLAGS=-I${patchedXrdpSrc}/common" ];
enableParallelBuilding = true;
};
+in stdenv.mkDerivation rec {
+ inherit version;
+ pname = "xrdp";
- xrdp = stdenv.mkDerivation rec {
- version = "0.9.22.1";
- pname = "xrdp";
+ src = patchedXrdpSrc;
- src = fetchFromGitHub {
- owner = "neutrinolabs";
- repo = "xrdp";
- rev = "v${version}";
- fetchSubmodules = true;
- hash = "sha256-8gAP4wOqSmar8JhKRt4qRRwh23coIn0Q8Tt9ClHQSt8=";
- };
-
- nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm perl ];
+ nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm perl ];
- buildInputs = [ openssl systemd pam fuse libjpeg libopus xorg.libX11 xorg.libXfixes xorg.libXrandr ];
+ buildInputs = [ openssl systemd pam fuse libjpeg libopus xorg.libX11 xorg.libXfixes xorg.libXrandr ];
- patches = [ ./dynamic_config.patch ];
- postPatch = ''
- substituteInPlace sesman/xauth.c --replace "xauth -q" "${xorg.xauth}/bin/xauth -q"
- '';
+ 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;
- configureFlags = [ "--with-systemdsystemunitdir=/var/empty" "--enable-ipv6" "--enable-jpeg" "--enable-fuse" "--enable-rfxcodec" "--enable-opus" "--enable-pam-config=unix" ];
+ preConfigure = ''
+ (cd librfxcodec && ./bootstrap && ./configure --prefix=$out --enable-static --disable-shared)
+ ./bootstrap
+ '';
+ dontDisableStatic = true;
+ configureFlags = [ "--with-systemdsystemunitdir=/var/empty" "--enable-ipv6" "--enable-jpeg" "--enable-fuse" "--enable-rfxcodec" "--enable-opus" "--enable-pam-config=unix" ];
- installFlags = [ "DESTDIR=$(out)" "prefix=" ];
+ installFlags = [ "DESTDIR=$(out)" "prefix=" ];
- postInstall = ''
- # remove generated keys (as non-deterministic)
- rm $out/etc/xrdp/{rsakeys.ini,key.pem,cert.pem}
+ postInstall = ''
+ # remove generated keys (as non-deterministic)
+ rm $out/etc/xrdp/{rsakeys.ini,key.pem,cert.pem}
- cp $src/keygen/openssl.conf $out/share/xrdp/openssl.conf
+ cp $src/keygen/openssl.conf $out/share/xrdp/openssl.conf
- substituteInPlace $out/etc/xrdp/sesman.ini --replace /etc/xrdp/pulse $out/etc/xrdp/pulse
+ 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 -i -ne 'print unless /\[(X11rdp|Xvnc|console|vnc-any|sesman-any|rdp-any|neutrinordp-any)\]/ .. /^$/' $out/etc/xrdp/xrdp.ini
+ # remove all session types except Xorg (they are not supported by this setup)
+ 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 -i -ne 'print unless /\[(X11rdp|Xvnc|Xorg)\]/ .. /^$/' $out/etc/xrdp/sesman.ini
+ # remove all session types and then add Xorg
+ perl -i -ne 'print unless /\[(X11rdp|Xvnc|Xorg)\]/ .. /^$/' $out/etc/xrdp/sesman.ini
- cat >> $out/etc/xrdp/sesman.ini <<EOF
+ 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
- '';
+ [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;
+ enableParallelBuilding = true;
- meta = with lib; {
- description = "An open source RDP server";
- homepage = "https://github.com/neutrinolabs/xrdp";
- license = licenses.asl20;
- maintainers = with maintainers; [ chvp ];
- platforms = platforms.linux;
- };
+ meta = with lib; {
+ description = "An open source RDP server";
+ homepage = "https://github.com/neutrinolabs/xrdp";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ chvp ];
+ platforms = platforms.linux;
};
-in xrdp
+}