16 lines
459 B
Nix
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));
|
|
};
|
|
}
|