diff options
author | Christian Theune <ct@flyingcircus.io> | 2023-09-09 21:38:16 +0200 |
---|---|---|
committer | Martin Weinelt <mweinelt@users.noreply.github.com> | 2023-09-10 15:34:11 +0200 |
commit | 7f341bb4502e2dbb3b7541af0e517b22817e9ba1 (patch) | |
tree | a71b95cb0416289b6260e80409d3fac40d9c47d3 /nixos/modules/tasks | |
parent | 74bb2557607dd8f273c068ada66a41171d8b32de (diff) | |
download | nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar.gz nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar.bz2 nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar.lz nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar.xz nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.tar.zst nixpkgs-7f341bb4502e2dbb3b7541af0e517b22817e9ba1.zip |
nixos/swraid: fix monitor service
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/swraid.nix | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nixos/modules/tasks/swraid.nix b/nixos/modules/tasks/swraid.nix index f624294565b..8985660d80a 100644 --- a/nixos/modules/tasks/swraid.nix +++ b/nixos/modules/tasks/swraid.nix @@ -2,6 +2,8 @@ cfg = config.boot.swraid; + mdadm_conf = config.environment.etc."mdadm.conf"; + in { imports = [ (lib.mkRenamedOptionModule [ "boot" "initrd" "services" "swraid" "enable" ] [ "boot" "swraid" "enable" ]) @@ -36,8 +38,14 @@ in { }; config = lib.mkIf cfg.enable { + warnings = lib.mkIf + ((builtins.match ".*(MAILADDR|PROGRAM).*" mdadm_conf.text) == null) + [ "mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash." ]; + environment.systemPackages = [ pkgs.mdadm ]; + environment.etc."mdadm.conf".text = lib.mkAfter cfg.mdadmConf; + services.udev.packages = [ pkgs.mdadm ]; systemd.packages = [ pkgs.mdadm ]; @@ -59,12 +67,10 @@ in { $out/bin/mdadm --version ''; - extraFiles."/etc/mdadm.conf".source = pkgs.writeText "mdadm.conf" config.boot.swraid.mdadmConf; + extraFiles."/etc/mdadm.conf" = mdadm_conf; systemd = { - contents."/etc/mdadm.conf" = lib.mkIf (cfg.mdadmConf != "") { - text = cfg.mdadmConf; - }; + contents."/etc/mdadm.conf".text = mdadm_conf.text; packages = [ pkgs.mdadm ]; initrdBin = [ pkgs.mdadm ]; |