mirror of
https://codeberg.org/privacy1st/nix-git
synced 2025-01-31 07:25:15 +01:00
intellij and java
This commit is contained in:
parent
e0faf9d6bc
commit
083de5031e
43
modules/java.nix
Normal file
43
modules/java.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
# Select a JDK version
|
||||
#
|
||||
jdk = pkgs.jdk23;
|
||||
#
|
||||
# If a more recent OpenJDK version than the bundled JDK is needed.
|
||||
#jdk = pkgs.unstable.jdk;
|
||||
#jdk = pkgs.unstable.jdk23;
|
||||
#
|
||||
# If JavaFX with WebKit is required.
|
||||
# https://github.com/NixOS/nixpkgs/blob/4b218e54ae22c8b3ad642ff0dec842363c3abd0f/pkgs/top-level/all-packages.nix#L14583-L14588
|
||||
#jdk = pkgs.jdk23.override {
|
||||
# enableJavaFX = true;
|
||||
# openjfx_jdk = pkgs.openjfx23.override { withWebKit = true; };
|
||||
#};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/23e89b7da85c3640bbc2173fe04f4bd114342367/pkgs/development/tools/build-managers/gradle/default.nix#L46
|
||||
gradle = pkgs.gradle.override {
|
||||
java = jdk;
|
||||
javaToolchains = [ jdk ];
|
||||
};
|
||||
in
|
||||
{
|
||||
# System-wide installation makes pkgs available at:
|
||||
# /run/current-system/sw/bin/
|
||||
# This makes it easier to configure them in Jetbrain's IDE.
|
||||
environment.systemPackages = with pkgs; [
|
||||
# To use Gradle in IntelliJ:
|
||||
# - Project settings > Add and select JDK
|
||||
# - `type java` gives `/run/current-system/sw/bin/java`.
|
||||
# - Somehow IntelliJ can't select it
|
||||
# - Thus we use the symlinks destination instead ...
|
||||
jdk
|
||||
# To use Gradle in IntelliJ:
|
||||
# - Settings > Build tools > Gradle > Local installation
|
||||
# - `type gradle` gives `/run/current-system/sw/bin/gradle`.
|
||||
# - Somehow IntelliJ can't select it
|
||||
# - Thus we use the symlinks destination instead ...
|
||||
gradle
|
||||
maven
|
||||
];
|
||||
}
|
@ -18,6 +18,12 @@ in
|
||||
[
|
||||
# Rust programming lang
|
||||
./rust.nix
|
||||
|
||||
# Java programming lang (with Gradle and Maven)
|
||||
#
|
||||
# For IntelliJ to use Gradles toolchain,
|
||||
# see `shell-intellij-gradle-openjdk.nix`.
|
||||
./java.nix
|
||||
];
|
||||
|
||||
allowUnfree = [
|
||||
@ -30,15 +36,6 @@ in
|
||||
# This makes it easier to configure it as interpreter in Jetbrain's IDE.
|
||||
python3
|
||||
|
||||
maven
|
||||
|
||||
# To use Gradle within InelliJ (or to use a specific OpenJDK version with Gradle), see
|
||||
# shell-intellij-grade-openjd.nix
|
||||
|
||||
# If a more recent OpenJDK version than the bundled JDK is needed
|
||||
#unstable.jdk
|
||||
#unstable.jdk23
|
||||
|
||||
# Markdown preview
|
||||
#pandoc
|
||||
# TODO: Currently markdown previews are broken anyways because of issues with the sandboxed webbrowser on NixOS
|
||||
|
@ -1,24 +1,28 @@
|
||||
# Example from my (non public) Software Quality course homework.
|
||||
# That (private) repo might contain a more up to date version.
|
||||
|
||||
{
|
||||
pkgs ? import <nixpkgs> {
|
||||
# https://github.com/NixOS/nixpkgs/issues/166220#issuecomment-1745803058
|
||||
config.allowUnfree = true;
|
||||
}
|
||||
}:
|
||||
|
||||
{ }:
|
||||
let
|
||||
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
|
||||
### Import nixpkgs with Niv ###
|
||||
#
|
||||
sources = import ./nix/sources.nix;
|
||||
# nixpkgs stable
|
||||
pkgs = import sources.nixpkgs {
|
||||
# Required for IntelliJ Ultimate
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/4b218e54ae22c8b3ad642ff0dec842363c3abd0f/pkgs/top-level/all-packages.nix#L14583-L14588
|
||||
jdk = unstable.jdk23.override {
|
||||
# https://github.com/NixOS/nixpkgs/blob/d9e98537533e7d978556bd58739813a47db5d591/pkgs/top-level/all-packages.nix#L14078-L14083
|
||||
jdk = pkgs.jdk23.override {
|
||||
enableJavaFX = true;
|
||||
openjfx_jdk = unstable.openjfx23.override { withWebKit = true; };
|
||||
openjfx_jdk = pkgs.openjfx23.override { withWebKit = true; };
|
||||
};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/23e89b7da85c3640bbc2173fe04f4bd114342367/pkgs/development/tools/build-managers/gradle/default.nix#L46
|
||||
gradle = unstable.gradle.override { java = jdk; };
|
||||
gradle = pkgs.gradle.override {
|
||||
java = jdk;
|
||||
javaToolchains = [ jdk ];
|
||||
};
|
||||
in
|
||||
|
||||
(
|
||||
|
Loading…
x
Reference in New Issue
Block a user