From 4a785b0cefcb11bb42c48964007ea1fc80af9492 Mon Sep 17 00:00:00 2001 From: GenericNerdyUsername Date: Mon, 5 Feb 2024 23:29:23 +0000 Subject: [PATCH] jetbrains-remote: add module --- modules/lib/maintainers.nix | 5 ++++ modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/programs/jetbrains-remote.nix | 38 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 modules/programs/jetbrains-remote.nix diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 39fa654a1..3de4a7ae6 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -223,6 +223,11 @@ githubId = 33058747; name = "Gaetan Lepage"; }; + genericnerdyusername = { + email = "genericnerdyusername@proton.me"; + github = "genericnerdyusername"; + githubId = 111183546; + }; maximsmol = { email = "maximsmol@gmail.com"; github = "maximsmol"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 5d4c99217..0b19711af 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1407,6 +1407,13 @@ in { A new module is available: 'services.arrpc' ''; } + + { + time = "2024-02-05T22:45:37+00:00"; + message = '' + A new module is available: 'programs.jetbrains-remote' + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index a75037c0f..f8146efac 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -120,6 +120,7 @@ let ./programs/ion.nix ./programs/irssi.nix ./programs/java.nix + ./programs/jetbrains-remote.nix ./programs/jq.nix ./programs/jujutsu.nix ./programs/joshuto.nix diff --git a/modules/programs/jetbrains-remote.nix b/modules/programs/jetbrains-remote.nix new file mode 100644 index 000000000..4a9c045a9 --- /dev/null +++ b/modules/programs/jetbrains-remote.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.jetbrains-remote; + +in { + meta.maintainers = with lib.maintainers; [ genericnerdyusername ]; + + options.programs.jetbrains-remote = { + enable = mkEnableOption "JetBrains remote development system"; + + ides = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression '' + with pkgs.jetbrains; [ clion pycharm-professional ]; + ''; + description = '' + IDEs accessible to the JetBrains remote development system. + ''; + }; + }; + + config = mkIf (cfg.enable && cfg.ides != [ ]) { + home.activation.jetBrainsRemote = let + mkLine = ide: + # Errors out if the symlink already exists + "${ide}/bin/${ide.meta.mainProgram}-remote-dev-server registerBackendLocationForGateway || true"; + lines = map mkLine cfg.ides; + linesStr = '' + rm $HOME/.cache/JetBrains/RemoteDev/userProvidedDist/_nix_store* + '' + concatStringsSep "\n" lines; + in hm.dag.entryAfter [ "writeBoundary" ] linesStr; + }; +}