git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #91813 from Mic92/types1

nixos/*: Add types to the database module options

commit5666f34b28568b3f8b978a106029faba3ea9a531 authorKevin Cox <kevincox@kevincox.ca> dateThu 14 Jan 2021, 17:04 (6 years ago) parent3d9a14f55127e1
5 files changed+44−7
nixos/modules/services/databases/firebird.nix+3 nixos/modules/services/databases/memcached.nix+10−5 nixos/modules/services/databases/mongodb.nix+7 nixos/modules/services/databases/redis.nix+19−2 nixos/modules/services/databases/virtuoso.nix+5
nixos/modules/services/databases/firebird.nix+3
@@ -59,6 +59,7 @@ in
5959
6060 port = mkOption {
6161 default = "3050";
62+ type = types.port;
6263 description = ''
6364 Port Firebird uses.
6465 '';
@@ -66,6 +67,7 @@ in
6667
6768 user = mkOption {
6869 default = "firebird";
70+ type = types.str;
6971 description = ''
7072 User account under which firebird runs.
7173 '';
@@ -73,6 +75,7 @@ in
7375
7476 baseDir = mkOption {
7577 default = "/var/db/firebird"; # ubuntu is using /var/lib/firebird/2.1/data/.. ?
78+ type = types.str;
7679 description = ''
7780 Location containing data/ and system/ directories.
7881 data/ stores the databases, system/ stores the password database security2.fdb.
nixos/modules/services/databases/memcached.nix+10−5
@@ -17,39 +17,44 @@ in
1717 options = {
1818
1919 services.memcached = {
20−
2120 enable = mkEnableOption "Memcached";
2221
2322 user = mkOption {
23+ type = types.str;
2424 default = "memcached";
2525 description = "The user to run Memcached as";
2626 };
2727
2828 listen = mkOption {
29+ type = types.str;
2930 default = "127.0.0.1";
30− description = "The IP address to bind to";
31+ description = "The IP address to bind to.";
3132 };
3233
3334 port = mkOption {
35+ type = types.port;
3436 default = 11211;
35− description = "The port to bind to";
37+ description = "The port to bind to.";
3638 };
3739
3840 enableUnixSocket = mkEnableOption "unix socket at /run/memcached/memcached.sock";
3941
4042 maxMemory = mkOption {
43+ type = types.ints.unsigned;
4144 default = 64;
4245 description = "The maximum amount of memory to use for storage, in megabytes.";
4346 };
4447
4548 maxConnections = mkOption {
49+ type = types.ints.unsigned;
4650 default = 1024;
47− description = "The maximum number of simultaneous connections";
51+ description = "The maximum number of simultaneous connections.";
4852 };
4953
5054 extraOptions = mkOption {
55+ type = types.listOf types.str;
5156 default = [];
52− description = "A list of extra options that will be added as a suffix when running memcached";
57+ description = "A list of extra options that will be added as a suffix when running memcached.";
5358 };
5459 };
5560
nixos/modules/services/databases/mongodb.nix+7
@@ -41,16 +41,19 @@ in
4141 };
4242
4343 user = mkOption {
44+ type = types.str;
4445 default = "mongodb";
4546 description = "User account under which MongoDB runs";
4647 };
4748
4849 bind_ip = mkOption {
50+ type = types.str;
4951 default = "127.0.0.1";
5052 description = "IP to bind to";
5153 };
5254
5355 quiet = mkOption {
56+ type = types.bool;
5457 default = false;
5558 description = "quieter output";
5659 };
@@ -68,16 +71,19 @@ in
6871 };
6972
7073 dbpath = mkOption {
74+ type = types.str;
7175 default = "/var/db/mongodb";
7276 description = "Location where MongoDB stores its files";
7377 };
7478
7579 pidFile = mkOption {
80+ type = types.str;
7681 default = "/run/mongodb.pid";
7782 description = "Location of MongoDB pid file";
7883 };
7984
8085 replSetName = mkOption {
86+ type = types.str;
8187 default = "";
8288 description = ''
8389 If this instance is part of a replica set, set its name here.
@@ -86,6 +92,7 @@ in
8692 };
8793
8894 extraConfig = mkOption {
95+ type = types.lines;
8996 default = "";
9097 example = ''
9198 storage.journal.enabled: false
nixos/modules/services/databases/redis.nix+19−2
@@ -122,12 +122,29 @@ in
122122 };
123123
124124 slaveOf = mkOption {
125− default = null; # { ip, port }
126− description = "An attribute set with two attributes: ip and port to which this redis instance acts as a slave.";
125+ type = with types; nullOr (submodule ({ ... }: {
126+ options = {
127+ ip = mkOption {
128+ type = str;
129+ description = "IP of the Redis master";
130+ example = "192.168.1.100";
131+ };
132+
133+ port = mkOption {
134+ type = port;
135+ description = "port of the Redis master";
136+ default = 6379;
137+ };
138+ };
139+ }));
140+
141+ default = null;
142+ description = "IP and port to which this redis instance acts as a slave.";
127143 example = { ip = "192.168.1.100"; port = 6379; };
128144 };
129145
130146 masterAuth = mkOption {
147+ type = types.str;
131148 default = null;
132149 description = ''If the master is password protected (using the requirePass configuration)
133150 it is possible to tell the slave to authenticate before starting the replication synchronization
nixos/modules/services/databases/virtuoso.nix+5
@@ -16,28 +16,33 @@ with lib;
1616 enable = mkEnableOption "Virtuoso Opensource database server";
1717
1818 config = mkOption {
19+ type = types.lines;
1920 default = "";
2021 description = "Extra options to put into Virtuoso configuration file.";
2122 };
2223
2324 parameters = mkOption {
25+ type = types.lines;
2426 default = "";
2527 description = "Extra options to put into [Parameters] section of Virtuoso configuration file.";
2628 };
2729
2830 listenAddress = mkOption {
31+ type = types.str;
2932 default = "1111";
3033 example = "myserver:1323";
3134 description = "ip:port or port to listen on.";
3235 };
3336
3437 httpListenAddress = mkOption {
38+ type = types.nullOr types.str;
3539 default = null;
3640 example = "myserver:8080";
3741 description = "ip:port or port for Virtuoso HTTP server to listen on.";
3842 };
3943
4044 dirsAllowed = mkOption {
45+ type = types.nullOr types.str; # XXX Maybe use a list in the future?
4146 default = null;
4247 example = "/www, /home/";
4348 description = "A list of directories Virtuoso is allowed to access";