summary refs log tree commit diff
path: root/nixos/modules/services/development/bloop.nix
blob: 56904b7c40e6a30c8b97621953478bdea3d43eb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.bloop;

in {

  options.services.bloop = {
    install = mkOption {
      type = types.bool;
      default = false;
      description = ''
        Whether to install a user service for the Bloop server.

        The service must be manually started for each user with
        "systemctl --user start bloop".
      '';
    };
  };

  config = mkIf (cfg.install) {
    systemd.user.services.bloop = {
      description = "Bloop Scala build server";

      serviceConfig = {
        Type      = "simple";
        ExecStart = ''${pkgs.bloop}/bin/blp-server'';
        Restart   = "always";
      };
    };

    environment.systemPackages = [ pkgs.bloop ];
  };
}