mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
Merge pull request #241 from awseward/add-redis-extraConfig
Add extraConfig option to Redis
This commit is contained in:
commit
cb7b3d2471
3 changed files with 34 additions and 0 deletions
|
@ -52,6 +52,12 @@ in
|
|||
default = false;
|
||||
description = "By default data is only periodically persisted to disk, enable this option to use an append-only file for improved persistence.";
|
||||
};
|
||||
|
||||
services.redis.extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Additional text to be appended to <filename>redis.conf</filename>.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -69,6 +75,7 @@ in
|
|||
${optionalString (cfg.unixSocket != null) "unixsocket ${cfg.unixSocket}"}
|
||||
dir ${cfg.dataDir}
|
||||
appendOnly ${if cfg.appendOnly then "yes" else "no"}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
};
|
||||
|
|
|
@ -121,6 +121,7 @@ let
|
|||
tests.services-ofborg = makeTest ./tests/services-ofborg.nix;
|
||||
tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix;
|
||||
tests.services-privoxy = makeTest ./tests/services-privoxy.nix;
|
||||
tests.services-redis = makeTest ./tests/services-redis.nix;
|
||||
tests.services-skhd = makeTest ./tests/services-skhd.nix;
|
||||
tests.services-spacebar = makeTest ./tests/services-spacebar.nix;
|
||||
tests.services-synapse-bt = makeTest ./tests/services-synapse-bt.nix;
|
||||
|
|
26
tests/services-redis.nix
Normal file
26
tests/services-redis.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
redis = pkgs.runCommand "redis-0.0.0" {} "mkdir $out";
|
||||
in
|
||||
|
||||
{
|
||||
services.redis.enable = true;
|
||||
services.redis.package = redis;
|
||||
services.redis.extraConfig = ''
|
||||
maxmemory-policy allkeys-lru
|
||||
stop-writes-on-bgsave-error no
|
||||
'';
|
||||
|
||||
test = ''
|
||||
echo >&2 "checking redis service in ~/Library/LaunchAgents"
|
||||
grep "org.nixos.redis" ${config.out}/user/Library/LaunchAgents/org.nixos.redis.plist
|
||||
grep "${redis}/bin/redis-server /etc/redis.conf" ${config.out}/user/Library/LaunchAgents/org.nixos.redis.plist
|
||||
|
||||
echo >&2 "checking config in /etc/redis.conf"
|
||||
grep "maxmemory-policy allkeys-lru" ${config.out}/etc/redis.conf
|
||||
grep "stop-writes-on-bgsave-error no" ${config.out}/etc/redis.conf
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue