idiosyn/modules/datacow.nix
2024-07-23 17:05:42 +02:00

16 lines
459 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 {
config = {
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));
};
}