powersort/shell.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

# Gradle's toolchain support does not work with IntelliJ, thus we have to use buildFHSUserEnv
# https://discourse.nixos.org/t/how-to-create-a-development-environment-with-intellij-idea-and-openjdk/10153
# How to use `config.allowUnfree` in shell.nix
# https://github.com/NixOS/nixpkgs/issues/166220#issuecomment-1745803058
{
### Import with nix channels ###
#
2024-12-30 16:09:20 +00:00
# NixOS stable
#pkgs ? import <nixpkgs> {
# config.allowUnfree = true;
#},
2024-12-30 16:09:20 +00:00
# NixOS unstable
#unstable ? import <unstable> {
# config.allowUnfree = true;
#}
}:
let
### Import with Niv ###
#
sources = import ./nix/sources.nix;
# NixOS stable
pkgs = import sources.nixpkgs {
config.allowUnfree = true;
};
# NixOS unstable
unstable = import sources.unstable {
config.allowUnfree = true;
};
jdk = unstable.jdk23;
2025-01-07 17:26:25 +00:00
gradle = unstable.gradle.override {
java = jdk;
# Required for `gradle javaToolchains` to list JDK23
javaToolchains = [ jdk ];
};
in
(
pkgs.buildFHSUserEnv
{
name = "intellij-gradle-jdk23";
targetPkgs = pkgs_: [
pkgs_.jetbrains.idea-ultimate
2025-01-01 18:00:25 +00:00
# IntelliJ needs at least one font installed.
# If this shell.nix is run on a non-NixOS system, that might not be the case.
# Thus, we manually add one font.
pkgs_.noto-fonts
jdk
gradle
];
}
).env