Advertisement
Guest User

nixpkgs/nixos/modules/services/system/zrepl.nix

a guest
Apr 22nd, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. { config, lib, pkgs, ... }:
  2.  
  3. with lib;
  4.  
  5. let
  6.  
  7. cfg = config.services.zrepl;
  8.  
  9. in
  10.  
  11. {
  12.  
  13. ###### interface
  14.  
  15. options = {
  16.  
  17. services.zrepl = {
  18.  
  19. enable = mkOption {
  20. type = types.bool;
  21. default = true;
  22. description = "Whether to enable the zrepl daemon.";
  23. };
  24.  
  25. config = mkOption {
  26. type = types.lines;
  27. default = "";
  28. description = "Configuration to use for zrepl aemon.";
  29. };
  30.  
  31. };
  32.  
  33. };
  34.  
  35.  
  36. ###### implementation
  37.  
  38. config = mkIf cfg.enable {
  39. environment.etc."zrepl.yml".text = cfg.config;
  40.  
  41. systemd.services.zrepl =
  42. { description = "zrepl daemon";
  43.  
  44. wantedBy = [ "multi-user.target" ];
  45.  
  46. restartTriggers = [
  47. config.environment.etc."zrepl.yml".source
  48. ];
  49.  
  50. serviceConfig =
  51. { ExecStart = "${pkgs.zrepl}/bin/zrepl daemon --config /etc/zrepl.yml";
  52. Type = "simple";
  53. RuntimeDirectory= "zrepl";
  54. RuntimeDirectoryMode= "0700";
  55. };
  56. };
  57.  
  58. };
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement