From b20c08d2cb85ba9e2b2f45f0b57b6cd77d2f66c9 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:14:01 +0100 Subject: [PATCH 1/2] nixos/redis: user set uid, make it compatible #1076 --- nixos/modules/misc/ids.nix | 1 + nixos/modules/services/databases/redis.nix | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index adaa2b0d9ae..66f04668a70 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -102,6 +102,7 @@ tcpcryptd = 93; # tcpcryptd uses a hard-coded uid. We patch it in Nixpkgs to match this choice. zope2 = 94; firebird = 95; + redis = 96; # When adding a uid, make sure it doesn't match an existing gid. diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 5bc58c73bd6..059b157498d 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -177,8 +177,9 @@ in config = mkIf config.services.redis.enable { - users.extraUsers = singleton + users.extraUsers.redis = { name = cfg.user; + uid = config.ids.uids.redis; description = "Redis database user"; }; From d28a9619a1d48b0885a027aa0ad976966f7778eb Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 28 Oct 2013 18:14:49 +0100 Subject: [PATCH 2/2] nixos/redis: log to syslog by default --- nixos/modules/services/databases/redis.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 059b157498d..ea6399ba4f4 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -14,6 +14,7 @@ let ${condOption "unixsocket" cfg.unixSocket} loglevel ${cfg.logLevel} logfile ${cfg.logfile} + syslog-enabled ${redisBool cfg.syslog} databases ${toString cfg.databases} ${concatMapStrings (d: "save ${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}\n") cfg.save} dbfilename ${cfg.dbFilename} @@ -82,12 +83,18 @@ in }; logfile = mkOption { - default = "stdout"; + default = "/dev/null"; description = "Specify the log file name. Also 'stdout' can be used to force Redis to log on the standard output."; example = "/var/log/redis.log"; type = with types; string; }; + syslog = mkOption { + default = true; + description = "Enable logging to the system logger."; + type = with types; bool; + }; + databases = mkOption { default = 16; description = "Set the number of databases.";