idiosyn/nixos/module/datacow.nix
2024-08-21 21:06:51 +02:00

15 lines
443 B
Nix

{ ... }: { config, lib, pkgs, ... }:
let
cfg = config.services;
noDataCow = dir: ''
mkdir -p ${lib.escapeShellArg dir}
${pkgs.e2fsprogs}/bin/chattr +C ${lib.escapeShellArg dir}
'';
in {
systemd.services.mysql.preStart = lib.mkIf cfg.mysql.enable
(lib.mkBefore (noDataCow cfg.mysql.dataDir));
systemd.services.postgresql.preStart = lib.mkIf cfg.postgresql.enable
(lib.mkBefore (noDataCow cfg.postgresql.dataDir));
}