nagiosPlugins.check_ssl_cert: 2.85.1 -> 2.86.0 (#379244)
[NixPkgs.git] / pkgs / by-name / x2 / x2goserver / package.nix
blobf253d3649382b65a11d1655e45a6e48ee16e0a19
2   stdenv,
3   lib,
4   fetchurl,
5   perlPackages,
6   makeWrapper,
7   perl,
8   which,
9   nx-libs,
10   util-linux,
11   coreutils,
12   glibc,
13   gawk,
14   gnused,
15   gnugrep,
16   findutils,
17   xorg,
18   nettools,
19   iproute2,
20   bc,
21   procps,
22   psmisc,
23   lsof,
24   pwgen,
25   openssh,
26   sshfs,
27   bash,
30 let
31   pname = "x2goserver";
32   version = "4.1.0.3";
34   src = fetchurl {
35     url = "https://code.x2go.org/releases/source/${pname}/${pname}-${version}.tar.gz";
36     sha256 = "Z3aqo1T1pE40nws8F21JiMiKYYwu30bJijeuicBp3NA=";
37   };
39   x2go-perl = perlPackages.buildPerlPackage rec {
40     pname = "X2Go";
41     inherit version src;
42     makeFlags = [
43       "-f"
44       "Makefile.perl"
45     ];
46     patchPhase = ''
47       substituteInPlace X2Go/Config.pm --replace '/etc/x2go' '/var/lib/x2go/conf'
48       substituteInPlace X2Go/Server/DB.pm \
49         --replace '$x2go_lib_path/libx2go-server-db-sqlite3-wrapper' \
50                   '/run/wrappers/bin/x2gosqliteWrapper'
51       substituteInPlace X2Go/Server/DB/SQLite3.pm --replace "user='x2gouser'" "user='x2go'"
52     '';
53   };
55   perlEnv = perl.withPackages (
56     p: with p; [
57       x2go-perl
58       DBI
59       DBDSQLite
60       FileBaseDir
61       TryTiny
62       CaptureTiny
63       ConfigSimple
64       Switch
65       FileWhich
66     ]
67   );
69   binaryDeps = [
70     perlEnv
71     which
72     nx-libs
73     util-linux
74     coreutils
75     glibc.bin
76     gawk
77     gnused
78     gnugrep
79     findutils
80     nettools
81     iproute2
82     bc
83     procps
84     psmisc
85     lsof
86     pwgen
87     openssh
88     sshfs
89     xorg.xauth
90     xorg.xinit
91     xorg.xrandr
92     xorg.xmodmap
93     xorg.xwininfo
94     xorg.fontutil
95     xorg.xkbcomp
96     xorg.setxkbmap
97   ];
99 stdenv.mkDerivation rec {
100   inherit pname version src;
102   buildInputs = [
103     perlEnv
104     bash
105   ];
107   nativeBuildInputs = [ makeWrapper ];
109   prePatch = ''
110     patchShebangs .
111     sed -i '/Makefile.PL\|Makefile.perl/d' Makefile
112     for i in */Makefile; do
113       substituteInPlace "$i" --replace "-o root -g root " ""
114     done
115     substituteInPlace libx2go-server-db-perl/Makefile --replace "chmod 2755" "chmod 755"
116     for i in x2goserver/sbin/x2godbadmin x2goserver/bin/x2go*
117     do
118       substituteInPlace $i --replace '/etc/x2go' '/var/lib/x2go/conf'
119     done
120     substituteInPlace x2goserver/sbin/x2gocleansessions \
121       --replace '/var/run/x2goserver.pid' '/var/run/x2go/x2goserver.pid'
122     substituteInPlace x2goserver/sbin/x2godbadmin --replace 'user="x2gouser"' 'user="x2go"'
123     substituteInPlace x2goserver-xsession/etc/Xsession \
124       --replace "SSH_AGENT /bin/bash -c" "SSH_AGENT ${bash}/bin/bash -c" \
125       --replace "[ -f /etc/redhat-release ]" "[ -d /etc/nix ] || [ -f /etc/redhat-release ]"
126   '';
128   makeFlags = [
129     "PREFIX=/"
130     "NXLIBDIR=${nx-libs}/lib/nx"
131   ];
133   installFlags = [ "DESTDIR=$(out)" ];
135   postInstall = ''
136     mv $out/etc/x2go/x2goserver.conf{,.example}
137     mv $out/etc/x2go/x2goagent.options{,.example}
138     ln -sf ${nx-libs}/bin/nxagent $out/bin/x2goagent
139     for i in $out/sbin/x2go* $(find $out/bin -type f) \
140       $(ls $out/lib/x2go/x2go* | grep -v x2gocheckport)
141     do
142       wrapProgram $i --prefix PATH : ${lib.makeBinPath binaryDeps}:$out
143     done
144     # We're patching @INC of the setgid wrapper, because we can't mix
145     # the perl wrapper (for PERL5LIB) with security.wrappers (for setgid)
146     sed -i -e "s,.\+bin/perl,#!${perl}/bin/perl -I ${perlEnv}/lib/perl5/site_perl," \
147       $out/lib/x2go/libx2go-server-db-sqlite3-wrapper.pl
148   '';
150   enableParallelBuilding = true;
152   meta = with lib; {
153     description = "Remote desktop application, server component";
154     homepage = "http://x2go.org/";
155     platforms = lib.platforms.linux;
156     license = licenses.gpl2;
157     maintainers = with maintainers; [ averelld ];
158   };