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