Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / atlassian / crowd.nix
blob6c87e3c071157a5e35bf92feb2b2f062f85440b9
1 { lib, stdenv, fetchurl, home ? "/var/lib/crowd"
2 , port ? 8092, proxyUrl ? null, openidPassword ? "WILL_NEVER_BE_SET" }:
4 lib.warnIf (openidPassword != "WILL_NEVER_BE_SET") "Using `crowdProperties` is deprecated!"
5 (stdenv.mkDerivation rec {
6   pname = "atlassian-crowd";
7   version = "5.0.1";
9   src = fetchurl {
10     url = "https://www.atlassian.com/software/crowd/downloads/binary/${pname}-${version}.tar.gz";
11     sha256 = "sha256-ccXSNuiXP0+b9WObboikqVd0nKH0Fi2gMVEF3+WAx5M=";
12   };
14   buildPhase = ''
15     mv apache-tomcat/conf/server.xml apache-tomcat/conf/server.xml.dist
16     ln -s /run/atlassian-crowd/server.xml apache-tomcat/conf/server.xml
18     rm -rf apache-tomcat/{logs,work}
19     ln -s /run/atlassian-crowd/logs apache-tomcat/logs
20     ln -s /run/atlassian-crowd/work apache-tomcat/work
22     ln -s /run/atlassian-crowd/database database
24     substituteInPlace apache-tomcat/bin/startup.sh --replace start run
26     echo "crowd.home=${home}" > crowd-webapp/WEB-INF/classes/crowd-init.properties
27     substituteInPlace build.properties \
28       --replace "openidserver.url=http://localhost:8095/openidserver" \
29                 "openidserver.url=http://localhost:${toString port}/openidserver"
30     substituteInPlace crowd-openidserver-webapp/WEB-INF/classes/crowd.properties \
31       --replace "http://localhost:8095/" \
32                 "http://localhost:${toString port}/"
33     sed -r -i crowd-openidserver-webapp/WEB-INF/classes/crowd.properties \
34       -e 's,application.password\s+password,application.password ${openidPassword},'
35   '' + lib.optionalString (proxyUrl != null) ''
36     sed -i crowd-openidserver-webapp/WEB-INF/classes/crowd.properties \
37       -e 's,http://localhost:${toString port}/openidserver,${proxyUrl}/openidserver,'
38   '';
40   installPhase = ''
41     cp -rva . $out
42   '';
44   meta = with lib; {
45     description = "Single sign-on and identity management tool";
46     homepage = "https://www.atlassian.com/software/crowd";
47     license = licenses.unfree;
48     maintainers = with maintainers; [ ];
49   };