1 # Support for DRBD, the Distributed Replicated Block Device.
3 { config, lib, pkgs, ... }:
7 let cfg = config.services.drbd; in
15 services.drbd.enable = mkOption {
19 Whether to enable support for DRBD, the Distributed Replicated
24 services.drbd.config = mkOption {
28 Contents of the {file}`drbd.conf` configuration file.
37 config = mkIf cfg.enable {
39 environment.systemPackages = [ pkgs.drbd ];
41 services.udev.packages = [ pkgs.drbd ];
43 boot.kernelModules = [ "drbd" ];
45 boot.extraModprobeConfig =
47 options drbd usermode_helper=/run/current-system/sw/bin/drbdadm
50 environment.etc."drbd.conf" =
51 { source = pkgs.writeText "drbd.conf" cfg.config; };
53 systemd.services.drbd = {
54 after = [ "systemd-udev.settle.service" "network.target" ];
55 wants = [ "systemd-udev.settle.service" ];
56 wantedBy = [ "multi-user.target" ];
58 ExecStart = "${pkgs.drbd}/bin/drbdadm up all";
59 ExecStop = "${pkgs.drbd}/bin/drbdadm down all";