1{ config, lib, pkgs, ...}: 2 3with lib; 4 5let 6 cfg = config.services.hail; 7in { 8 9 10 ###### interface 11 12 options.services.hail = { 13 enable = mkOption { 14 type = types.bool; 15 default = false; 16 description = '' 17 Enables the Hail Auto Update Service. Hail can automatically deploy artifacts 18 built by a Hydra Continous Integration server. A common use case is to provide 19 continous deployment for single services or a full NixOS configuration.''; 20 }; 21 profile = mkOption { 22 type = types.str; 23 default = "hail-profile"; 24 description = "The name of the Nix profile used by Hail."; 25 }; 26 hydraJobUri = mkOption { 27 type = types.str; 28 description = "The URI of the Hydra Job."; 29 }; 30 netrc = mkOption { 31 type = types.nullOr types.path; 32 description = "The netrc file to use when fetching data from Hydra."; 33 default = null; 34 }; 35 package = mkOption { 36 type = types.package; 37 default = pkgs.haskellPackages.hail; 38 defaultText = "pkgs.haskellPackages.hail"; 39 description = "Hail package to use."; 40 }; 41 }; 42 43 44 ###### implementation 45 46 config = mkIf cfg.enable { 47 systemd.services.hail = { 48 description = "Hail Auto Update Service"; 49 wants = [ "network-online.target" ]; 50 wantedBy = [ "multi-user.target" ]; 51 path = with pkgs; [ nix ]; 52 environment = { 53 HOME = "/var/lib/empty"; 54 }; 55 serviceConfig = { 56 ExecStart = "${cfg.package}/bin/hail --profile ${cfg.profile} --job-uri ${cfg.hydraJobUri}" 57 + lib.optionalString (cfg.netrc != null) " --netrc-file ${cfg.netrc}"; 58 }; 59 }; 60 }; 61}