mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 01:33:10 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
66 lines
1.4 KiB
Nix
66 lines
1.4 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.cachefilesd;
|
|
|
|
cfgFile = pkgs.writeText "cachefilesd.conf" ''
|
|
dir ${cfg.cacheDir}
|
|
${cfg.extraConfig}
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.cachefilesd = {
|
|
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Whether to enable cachefilesd network filesystems caching daemon.";
|
|
};
|
|
|
|
cacheDir = mkOption {
|
|
type = types.str;
|
|
default = "/var/cache/fscache";
|
|
description = "Directory to contain filesystem cache.";
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = "brun 10%";
|
|
description = "Additional configuration file entries. See cachefilesd.conf(5) for more information.";
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
boot.kernelModules = [ "cachefiles" ];
|
|
|
|
systemd.services.cachefilesd = {
|
|
description = "Local network file caching management daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
Type = "exec";
|
|
ExecStart = "${pkgs.cachefilesd}/bin/cachefilesd -n -f ${cfgFile}";
|
|
Restart = "on-failure";
|
|
PrivateTmp = true;
|
|
};
|
|
};
|
|
|
|
systemd.tmpfiles.settings."10-cachefilesd".${cfg.cacheDir}.d = {
|
|
user = "root";
|
|
group = "root";
|
|
mode = "0700";
|
|
};
|
|
};
|
|
}
|