1 { config, pkgs, lib, ... }:
4 cfg = config.services.cachefilesd;
6 cfgFile = pkgs.writeText "cachefilesd.conf" ''
15 services.cachefilesd = {
17 enable = lib.mkOption {
18 type = lib.types.bool;
20 description = "Whether to enable cachefilesd network filesystems caching daemon.";
23 cacheDir = lib.mkOption {
25 default = "/var/cache/fscache";
26 description = "Directory to contain filesystem cache.";
29 extraConfig = lib.mkOption {
30 type = lib.types.lines;
33 description = "Additional configuration file entries. See cachefilesd.conf(5) for more information.";
41 config = lib.mkIf cfg.enable {
43 boot.kernelModules = [ "cachefiles" ];
45 systemd.services.cachefilesd = {
46 description = "Local network file caching management daemon";
47 wantedBy = [ "multi-user.target" ];
50 ExecStart = "${pkgs.cachefilesd}/bin/cachefilesd -n -f ${cfgFile}";
51 Restart = "on-failure";
56 systemd.tmpfiles.settings."10-cachefilesd".${cfg.cacheDir}.d = {