1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-09 04:39:44 +01:00
home-manager/tests/modules/programs/gradle/example-settings.nix
Benedikt Ritter 433120e47d
gradle: add module
Introduces a new program called gradle for managing files stored in
the home directory by the [Gradle Build Tool](https://gradle.org).
Gradle uses the $HOME/.gradle folder for all it's configuration.

Features of the new program module are:

- Automatically setting programs.java.enable = true to make a Java
  installation available for running Gradle.
- Specifying an alternate Gradle home directory
- Setting of abitrary values for gradle.properties stored inside the
  Gradle home directory.
- Defining init scripts that will be linked into the init.d inside
  the Gradle home directory.

Co-authored-by: Olli Helenius <liff@iki.fi>
Co-authored-by: Robert Helgesson <robert@rycee.net>
2023-12-20 12:41:17 +01:00

42 lines
978 B
Nix

{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.gradle = {
enable = true;
settings = {
"org.gradle.caching" = true;
"org.gradle.parallel" = true;
"org.gradle.java.home" = pkgs.jdk17;
"org.gradle.java.installations.paths" = "${pkgs.jdk8},${pkgs.jdk11}";
};
};
programs.java.package =
pkgs.runCommandLocal "java" { home = ""; } "mkdir $out";
test.stubs = {
gradle = { };
jdk = { };
jdk8 = { };
jdk11 = { };
jdk17 = { };
};
nmt.script = ''
assertFileExists home-files/.gradle/gradle.properties
assertFileContent home-files/.gradle/gradle.properties ${
builtins.toFile "gradle.expected" ''
# Generated with Nix
org.gradle.caching = true
org.gradle.java.home = @jdk17@
org.gradle.java.installations.paths = @jdk8@,@jdk11@
org.gradle.parallel = true
''
}
'';
};
}