not-matthias / dotfiles-nix

NixOS dotfiles and hardware configurations
5 stars 0 forks source link

Github Copilot for IntelliJ IDEs #23

Closed not-matthias closed 1 year ago

not-matthias commented 1 year ago

Updater: https://gitlab.com/genericnerdyusername/jetbrains-updater/

Tracking issue: https://github.com/NixOS/nixpkgs/pull/191341 Implementation:

Another potential fix: https://github.com/NixOS/nixpkgs/pull/201518

not-matthias commented 1 year ago

Current workaround:

cd ~/.local/share/JetBrains/CLion2022.3/github-copilot-intellij/copilot-agent/bin/
mv copilot-agent-linux copilot-agent-linux.bak
ln -s /nix/store/a5a8gvrbynadh84s7v9l6md6mrl5p4jf-home-manager-path/bin/copilot-agent (pwd)/copilot-agent-linux
hacker1024 commented 1 year ago

Using my derivation, the binary can be replaced with Home Manager. Here's my setup, for example:

{
  xdg.dataFile = let
    ideDataDirectories = with pkgs;
      with jetbrains; {
        "JetBrains/IntelliJIdea" = idea-ultimate;
        "JetBrains/PyCharm" = pycharm-professional;
        "JetBrains/WebStorm" = webstorm;
        "JetBrains/CLion" = clion;
        "Google/AndroidStudioPreview" = androidStudioPackages.dev;
      };
    copilotAgent =
      "${github-copilot-intellij-agent}/bin/copilot-agent";
  in lib.mapAttrs' (name: package:
    lib.nameValuePair "${name}${
      lib.versions.majorMinor (lib.getVersion package)
    }/github-copilot-intellij/copilot-agent/bin/copilot-agent-linux" {
      source = copilotAgent;
      force = true;
    }) ideDataDirectories;
}