nixos/monetdb: init (#39812)
This commit is contained in:
parent
de60146f59
commit
1b8642dff6
|
@ -138,7 +138,6 @@
|
||||||
ngircd = 112;
|
ngircd = 112;
|
||||||
btsync = 113;
|
btsync = 113;
|
||||||
minecraft = 114;
|
minecraft = 114;
|
||||||
#monetdb = 115; # unused (not packaged), removed 2016-09-19
|
|
||||||
vault = 115;
|
vault = 115;
|
||||||
rippled = 116;
|
rippled = 116;
|
||||||
murmur = 117;
|
murmur = 117;
|
||||||
|
@ -306,6 +305,7 @@
|
||||||
monero = 287;
|
monero = 287;
|
||||||
ceph = 288;
|
ceph = 288;
|
||||||
duplicati = 289;
|
duplicati = 289;
|
||||||
|
monetdb = 290;
|
||||||
|
|
||||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||||
|
|
||||||
|
@ -424,7 +424,6 @@
|
||||||
#ngircd = 112; # unused
|
#ngircd = 112; # unused
|
||||||
btsync = 113;
|
btsync = 113;
|
||||||
#minecraft = 114; # unused
|
#minecraft = 114; # unused
|
||||||
#monetdb = 115; # unused (not packaged), removed 2016-09-19
|
|
||||||
vault = 115;
|
vault = 115;
|
||||||
#ripped = 116; # unused
|
#ripped = 116; # unused
|
||||||
#murmur = 117; # unused
|
#murmur = 117; # unused
|
||||||
|
@ -580,6 +579,7 @@
|
||||||
monero = 287;
|
monero = 287;
|
||||||
ceph = 288;
|
ceph = 288;
|
||||||
duplicati = 289;
|
duplicati = 289;
|
||||||
|
monetdb = 290;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing
|
# When adding a gid, make sure it doesn't match an existing
|
||||||
# uid. Users and groups with the same name should have equal
|
# uid. Users and groups with the same name should have equal
|
||||||
|
|
|
@ -199,6 +199,7 @@
|
||||||
./services/databases/hbase.nix
|
./services/databases/hbase.nix
|
||||||
./services/databases/influxdb.nix
|
./services/databases/influxdb.nix
|
||||||
./services/databases/memcached.nix
|
./services/databases/memcached.nix
|
||||||
|
./services/databases/monetdb.nix
|
||||||
./services/databases/mongodb.nix
|
./services/databases/mongodb.nix
|
||||||
./services/databases/mysql.nix
|
./services/databases/mysql.nix
|
||||||
./services/databases/neo4j.nix
|
./services/databases/neo4j.nix
|
||||||
|
|
100
nixos/modules/services/databases/monetdb.nix
Normal file
100
nixos/modules/services/databases/monetdb.nix
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.monetdb;
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = with maintainers; [ StillerHarpo primeos ];
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
options = {
|
||||||
|
services.monetdb = {
|
||||||
|
|
||||||
|
enable = mkEnableOption "the MonetDB database server";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.monetdb;
|
||||||
|
defaultText = "pkgs.monetdb";
|
||||||
|
description = "MonetDB package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "monetdb";
|
||||||
|
description = "User account under which MonetDB runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "monetdb";
|
||||||
|
description = "Group under which MonetDB runs.";
|
||||||
|
};
|
||||||
|
|
||||||
|
dataDir = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/var/lib/monetdb";
|
||||||
|
description = "Data directory for the dbfarm.";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.ints.u16;
|
||||||
|
default = 50000;
|
||||||
|
description = "Port to listen on.";
|
||||||
|
};
|
||||||
|
|
||||||
|
listenAddress = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "127.0.0.1";
|
||||||
|
example = "0.0.0.0";
|
||||||
|
description = "Address to listen on.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
users.users.monetdb = mkIf (cfg.user == "monetdb") {
|
||||||
|
uid = config.ids.uids.monetdb;
|
||||||
|
group = cfg.group;
|
||||||
|
description = "MonetDB user";
|
||||||
|
home = cfg.dataDir;
|
||||||
|
createHome = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.monetdb = mkIf (cfg.group == "monetdb") {
|
||||||
|
gid = config.ids.gids.monetdb;
|
||||||
|
members = [ cfg.user ];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
|
systemd.services.monetdb = {
|
||||||
|
description = "MonetDB database server";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
path = [ cfg.package ];
|
||||||
|
unitConfig.RequiresMountsFor = "${cfg.dataDir}";
|
||||||
|
serviceConfig = {
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
ExecStart = "${cfg.package}/bin/monetdbd start -n ${cfg.dataDir}";
|
||||||
|
ExecStop = "${cfg.package}/bin/monetdbd stop ${cfg.dataDir}";
|
||||||
|
};
|
||||||
|
preStart = ''
|
||||||
|
if [ ! -e ${cfg.dataDir}/.merovingian_properties ]; then
|
||||||
|
# Create the dbfarm (as cfg.user)
|
||||||
|
${cfg.package}/bin/monetdbd create ${cfg.dataDir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update the properties
|
||||||
|
${cfg.package}/bin/monetdbd set port=${toString cfg.port} ${cfg.dataDir}
|
||||||
|
${cfg.package}/bin/monetdbd set listenaddr=${cfg.listenAddress} ${cfg.dataDir}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue