at 23.11-pre 1.2 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 cfg = config.services.bloop; 8 9in { 10 11 options.services.bloop = { 12 extraOptions = mkOption { 13 type = types.listOf types.str; 14 default = [ ]; 15 example = [ 16 "-J-Xmx2G" 17 "-J-XX:MaxInlineLevel=20" 18 "-J-XX:+UseParallelGC" 19 ]; 20 description = lib.mdDoc '' 21 Specifies additional command line argument to pass to bloop 22 java process. 23 ''; 24 }; 25 26 install = mkOption { 27 type = types.bool; 28 default = false; 29 description = lib.mdDoc '' 30 Whether to install a user service for the Bloop server. 31 32 The service must be manually started for each user with 33 "systemctl --user start bloop". 34 ''; 35 }; 36 }; 37 38 config = mkIf (cfg.install) { 39 systemd.user.services.bloop = { 40 description = "Bloop Scala build server"; 41 42 environment = { 43 PATH = mkForce "${makeBinPath [ config.programs.java.package ]}"; 44 }; 45 serviceConfig = { 46 Type = "simple"; 47 ExecStart = "${pkgs.bloop}/bin/bloop server"; 48 Restart = "always"; 49 }; 50 }; 51 52 environment.systemPackages = [ pkgs.bloop ]; 53 }; 54}