On nixos-unstable, I use vscode with a couple of extensions, which require a JDK. Inspired by VSCode extensions setup - #4 by danbst, this works for me:
(nixpkgs-vscode.vscode-with-extensions.override {
vscode = nixpkgs-vscode.vscode.overrideAttrs (oldAttrs: rec {
buildInputs = oldAttrs.buildInputs ++ [ jdk11 ];
});
vscodeExtensions = with nixpkgs-vscode.vscode-extensions; [
scala-lang.scala
scalameta.metals
];
})
(nixpkgs-vscode is just a branch of nixpkgs where I added those extensions:
nixpkgs-vscode = import (/home/aengelen/nixpkgs-vscode) {
config.allowUnfree = true;
};
)
This works great, but I figured it might be nice to use vscodium instead of vscode. So I added:
(nixpkgs-vscode.vscode-with-extensions.override {
vscode = nixpkgs-vscode.vscodium.overrideAttrs (oldAttrs: rec {
buildInputs = oldAttrs.buildInputs ++ [ jdk11 ];
});
vscodeExtensions = with nixpkgs-vscode.vscode-extensions; [
scala-lang.scala
scalameta.metals
];
})
This was less successful: first, codium
would not start at all. Turns out this was because the launcher script tried to load extensions from /nix/store/6nac8lnrw1kxf650dl72kf71a0x1c66h-vscodium-extensions-1.41.0/share/vscodium/extensions
rather than /nix/store/6nac8lnrw1kxf650dl72kf71a0x1c66h-vscodium-extensions-1.41.0/share/vscode/extensions
.
After making a copy of the launcher script and fixing the extensions path, I can start codium and it sees the extensions, but it can’t find the JDK.
Am I on the right track? How would I diagnose and fix the JDK not being found? I suspect for vscode it’s getting it via the JAVA_HOME environment variable, but where it that set? (it’s not set in my shell session, so it must be set by some wrapper script?).