diff options
-rw-r--r-- | ci-builds.nix | 1 | ||||
-rw-r--r-- | third_party/apereo-cas/default.nix | 63 | ||||
-rw-r--r-- | third_party/apereo-cas/overlay/build.gradle | 84 | ||||
-rw-r--r-- | third_party/apereo-cas/overlay/gradle/tasks.gradle | 17 | ||||
-rw-r--r-- | third_party/default.nix | 15 |
5 files changed, 137 insertions, 43 deletions
diff --git a/ci-builds.nix b/ci-builds.nix index 5ef6e58e0c7d..26f7e105d9fd 100644 --- a/ci-builds.nix +++ b/ci-builds.nix @@ -66,6 +66,7 @@ in lib.fix (self: { grpc nix openldap + apereo-cas ]; various = with depot; [ diff --git a/third_party/apereo-cas/default.nix b/third_party/apereo-cas/default.nix new file mode 100644 index 000000000000..5f628ce8e709 --- /dev/null +++ b/third_party/apereo-cas/default.nix @@ -0,0 +1,63 @@ +{ pkgs, ... }: + +let + name = "apereo-cas-${version}"; + version = "6.2.0"; + overlay = ./overlay; + + jdk = pkgs.jdk11; + gradle = pkgs.gradle_6; + + meta = with pkgs.stdenvNoCC.lib; { + homepage = "https://www.apereo.org/projects/cas"; + description = "CAS provides enterprise single sign-on for the Web"; + platforms = platforms.linux; + licenses = licenses.asl20; + }; + + deps = pkgs.stdenvNoCC.mkDerivation { + inherit meta; + + name = "${name}-deps"; + src = overlay; + nativeBuildInputs = with pkgs; [ gradle perl ]; + + buildPhase = '' + export GRADLE_USER_HOME="$(mktemp -d)" + gradle --no-daemon build -x test downloadShell + ''; + + # perl code mavenizes paths (see pkgs/servers/ma1sd from nixpkgs) + installPhase = '' + find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\([wj]ar\|pom\)' \ + | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# $src = $1; ($x = $2) =~ tr|\.|/|; $dir1 = $3; $dir2 = $4; ($y = $5) =~ s|-jvm||n; "install -Dm444 $src \$out/$x/$dir1/$dir2/$y" #e' \ + | sh + install -m444 build/libs/cas-server-support-shell-* $out/cas-server-shell.jar + ''; + + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "0lggx83g0nl5xwxgadgjrz62ch5qkwcyxwrd1zq8y1r7fir3m8pq"; + }; +in +pkgs.stdenvNoCC.mkDerivation { + inherit name version meta; + + src = overlay; + nativeBuildInputs = with pkgs; [ gradle makeWrapper ]; + buildInputs = with pkgs; [ jdk ]; + + buildPhase = '' + export GRADLE_USER_HOME="$(mktemp -d)" + + gradle -PcacheLocation="${deps}" --offline --no-daemon build -x test + ''; + + installPhase = '' + install -D build/libs/cas.war $out/lib/cas.war + cp ${deps}/cas-server-shell.jar $out/lib/cas-server-shell.jar + cp -R etc $out/etc + makeWrapper ${jdk}/bin/java $out/bin/cas --add-flags "-Dcas.standalone.configurationDirectory=$out/etc/cas/config -jar $out/lib/cas.war" + makeWrapper ${jdk}/bin/java $out/bin/cas-shell --add-flags "-Dcas.standalone.configurationDirectory=$out/etc/cas/config -jar $out/lib/cas-server-shell.jar" + ''; +} diff --git a/third_party/apereo-cas/overlay/build.gradle b/third_party/apereo-cas/overlay/build.gradle index 79a7e7c1be59..2b04bbc5f0cc 100644 --- a/third_party/apereo-cas/overlay/build.gradle +++ b/third_party/apereo-cas/overlay/build.gradle @@ -1,20 +1,25 @@ buildscript { repositories { - mavenLocal() - gradlePluginPortal() - mavenCentral() - jcenter() - maven { - url "https://repo.spring.io/libs-milestone" - mavenContent { releasesOnly() } - } - maven { - url "https://repo.spring.io/libs-snapshot" - mavenContent { snapshotsOnly() } - } - maven { - url "https://plugins.gradle.org/m2/" - mavenContent { releasesOnly() } + if (rootProject.hasProperty("cacheLocation")) { + mavenLocal() + maven { url cacheLocation } + } else { + mavenLocal() + gradlePluginPortal() + mavenCentral() + jcenter() + maven { + url "https://repo.spring.io/libs-milestone" + mavenContent { releasesOnly() } + } + maven { + url "https://repo.spring.io/libs-snapshot" + mavenContent { snapshotsOnly() } + } + maven { + url "https://plugins.gradle.org/m2/" + mavenContent { releasesOnly() } + } } } dependencies { @@ -27,28 +32,33 @@ buildscript { } repositories { - mavenLocal() - mavenCentral() - jcenter() - maven { - url "https://oss.sonatype.org/content/repositories/snapshots" - mavenContent { snapshotsOnly() } - } - maven { - mavenContent { releasesOnly() } - url "https://build.shibboleth.net/nexus/content/repositories/releases/" - } - maven { - mavenContent { releasesOnly() } - url "https://repo.spring.io/milestone/" - } - maven { - url "https://repo.spring.io/snapshot/" - mavenContent { snapshotsOnly() } - } - maven { - mavenContent { snapshotsOnly() } - url "https://oss.jfrog.org/artifactory/oss-snapshot-local" + if (rootProject.hasProperty("cacheLocation")) { + mavenLocal() + maven { url cacheLocation } + } else { + mavenLocal() + mavenCentral() + jcenter() + maven { + url "https://oss.sonatype.org/content/repositories/snapshots" + mavenContent { snapshotsOnly() } + } + maven { + mavenContent { releasesOnly() } + url "https://build.shibboleth.net/nexus/content/repositories/releases/" + } + maven { + mavenContent { releasesOnly() } + url "https://repo.spring.io/milestone/" + } + maven { + url "https://repo.spring.io/snapshot/" + mavenContent { snapshotsOnly() } + } + maven { + mavenContent { snapshotsOnly() } + url "https://oss.jfrog.org/artifactory/oss-snapshot-local" + } } } diff --git a/third_party/apereo-cas/overlay/gradle/tasks.gradle b/third_party/apereo-cas/overlay/gradle/tasks.gradle index 40fdac0b157c..297555b1e44d 100644 --- a/third_party/apereo-cas/overlay/gradle/tasks.gradle +++ b/third_party/apereo-cas/overlay/gradle/tasks.gradle @@ -10,12 +10,17 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style buildscript { repositories { - mavenLocal() - mavenCentral() - jcenter() - maven { - url "https://oss.sonatype.org/content/repositories/snapshots" - mavenContent { snapshotsOnly() } + if (rootProject.hasProperty("cacheLocation")) { + mavenLocal() + maven { url cacheLocation } + } else { + mavenLocal() + mavenCentral() + jcenter() + maven { + url "https://oss.sonatype.org/content/repositories/snapshots" + mavenContent { snapshotsOnly() } + } } } diff --git a/third_party/default.nix b/third_party/default.nix index 3e55ae63676b..9fb26887e0bc 100644 --- a/third_party/default.nix +++ b/third_party/default.nix @@ -81,6 +81,7 @@ let imagemagickBig installShellFiles jdk + jdk11 jetbrains-mono jq kontemplate @@ -122,6 +123,7 @@ let s6-portable-utils sbcl sqlite + stdenvNoCC stern symlinkJoin systemd @@ -171,6 +173,19 @@ let haskellPackages = (nixpkgs.haskellPackages.override { overrides = (import ./haskell_overlay { pkgs = nixpkgs; }); }); + + gradle_6 = (nixpkgs.gradleGen.override { + java = nixpkgs.jdk11; + jdk = nixpkgs.jdk11; + }).gradleGen rec { + name = "gradle-6.5.1"; + nativeVersion = "0.22-milestone-3"; + + src = builtins.fetchurl { + url = "https://services.gradle.org/distributions/${name}-bin.zip"; + sha256 = "0jmmipjh4fbsn92zpifa5cqg5ws2a4ha0s4jzqhrg4zs542x79sh"; + }; + }; }; in exposed.lib.fix(self: exposed // { |