diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-11 08:59:44 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-11 08:59:44 +0100 |
commit | 7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8 (patch) | |
tree | 7061d7dc8c0e31d96e35fef2adce9999713be9f2 /nixos | |
parent | ed8400bb9a59f267185d2d09b8f47d270a44ee99 (diff) | |
parent | 3c4f70996e46ed7e9c3a480f51398194d31e3e93 (diff) | |
download | nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar.gz nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar.bz2 nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar.lz nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar.xz nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.tar.zst nixlib-7863aae5b2eeb8c7af241a0f0ee0c5a15a8fabc8.zip |
Merge master into staging-next
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/development/option-types.xml | 13 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/grafana-reporter.nix | 66 | ||||
-rw-r--r-- | nixos/modules/services/monitoring/monit.nix | 33 | ||||
-rw-r--r-- | nixos/modules/services/network-filesystems/glusterfs.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/networking/ssh/sshd.nix | 2 | ||||
-rw-r--r-- | nixos/modules/services/web-apps/nextcloud.nix | 7 | ||||
-rw-r--r-- | nixos/release.nix | 1 | ||||
-rw-r--r-- | nixos/tests/incron.nix | 52 |
9 files changed, 157 insertions, 21 deletions
diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml index e6c9eae11a72..d993e47bc914 100644 --- a/nixos/doc/manual/development/option-types.xml +++ b/nixos/doc/manual/development/option-types.xml @@ -106,7 +106,7 @@ </para> </listitem> </varlistentry> - <varlistentry> + <varlistentry xml:id='types.ints.ux'> <term> <varname>types.ints.{u8, u16, u32}</varname> </term> @@ -131,6 +131,17 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term> + <varname>types.port</varname> + </term> + <listitem> + <para> + A port number. This type is an alias to + <link linkend='types.ints.ux'><varname>types.ints.u16</varname></link>. + </para> + </listitem> + </varlistentry> </variablelist> <para> diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 3d5479c31f01..2fbde1c451ce 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -431,6 +431,7 @@ ./services/monitoring/dd-agent/dd-agent.nix ./services/monitoring/fusion-inventory.nix ./services/monitoring/grafana.nix + ./services/monitoring/grafana-reporter.nix ./services/monitoring/graphite.nix ./services/monitoring/hdaps.nix ./services/monitoring/heapster.nix diff --git a/nixos/modules/services/monitoring/grafana-reporter.nix b/nixos/modules/services/monitoring/grafana-reporter.nix new file mode 100644 index 000000000000..149026d20188 --- /dev/null +++ b/nixos/modules/services/monitoring/grafana-reporter.nix @@ -0,0 +1,66 @@ +{ options, config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.grafana_reporter; + +in { + options.services.grafana_reporter = { + enable = mkEnableOption "grafana_reporter"; + + grafana = { + protocol = mkOption { + description = "Grafana protocol."; + default = "http"; + type = types.enum ["http" "https"]; + }; + addr = mkOption { + description = "Grafana address."; + default = "127.0.0.1"; + type = types.str; + }; + port = mkOption { + description = "Grafana port."; + default = 3000; + type = types.int; + }; + + }; + addr = mkOption { + description = "Listening address."; + default = "127.0.0.1"; + type = types.str; + }; + + port = mkOption { + description = "Listening port."; + default = 8686; + type = types.int; + }; + + templateDir = mkOption { + description = "Optional template directory to use custom tex templates"; + default = "${pkgs.grafana_reporter}"; + type = types.str; + }; + }; + + config = mkIf cfg.enable { + systemd.services.grafana_reporter = { + description = "Grafana Reporter Service Daemon"; + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + serviceConfig = let + args = lib.concatSepString " " [ + "-proto ${cfg.grafana.protocol}://" + "-ip ${cfg.grafana.addr}:${toString cfg.grafana.port}" + "-port :${toString cfg.port}" + "-templates ${cfg.templateDir}" + ]; + in { + ExecStart = "${pkgs.grafana_reporter.bin}/bin/grafana-reporter ${args}"; + }; + }; + }; +} diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix index d48e5c550abb..32e14ab21ffc 100644 --- a/nixos/modules/services/monitoring/monit.nix +++ b/nixos/modules/services/monitoring/monit.nix @@ -1,33 +1,30 @@ -# Monit system watcher -# http://mmonit.org/monit/ - {config, pkgs, lib, ...}: -let inherit (lib) mkOption mkIf; +with lib; + +let + cfg = config.services.monit; in { - options = { - services.monit = { - enable = mkOption { - default = false; - description = '' - Whether to run Monit system watcher. - ''; - }; - config = mkOption { - default = ""; - description = "monitrc content"; - }; + options.services.monit = { + + enable = mkEnableOption "Monit"; + + config = mkOption { + type = types.lines; + default = ""; + description = "monitrc content"; }; + }; - config = mkIf config.services.monit.enable { + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.monit ]; environment.etc."monitrc" = { - text = config.services.monit.config; + text = cfg.config; mode = "0400"; }; diff --git a/nixos/modules/services/network-filesystems/glusterfs.nix b/nixos/modules/services/network-filesystems/glusterfs.nix index 8ac9f801dcb8..adf59100f067 100644 --- a/nixos/modules/services/network-filesystems/glusterfs.nix +++ b/nixos/modules/services/network-filesystems/glusterfs.nix @@ -198,6 +198,9 @@ in install -m 0755 -d /var/log/glusterfs ''; + # glustereventsd uses the `gluster` executable + path = [ glusterfs ]; + serviceConfig = { Type="simple"; Environment="PYTHONPATH=${glusterfs}/usr/lib/python2.7/site-packages"; diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index c16fbe8a52fa..5fab79f1b3d7 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -130,7 +130,7 @@ in }; ports = mkOption { - type = types.listOf types.int; + type = types.listOf types.port; default = [22]; description = '' Specifies on which ports the SSH daemon listens. diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index c7e97bbeba9a..d0efdf88d73c 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -171,7 +171,12 @@ in { dbhost = mkOption { type = types.nullOr types.str; default = "localhost"; - description = "Database host."; + description = '' + Database host. + + Note: for using Unix authentication with PostgreSQL, this should be + set to <literal>/tmp</literal>. + ''; }; dbport = mkOption { type = with types; nullOr (either int str); diff --git a/nixos/release.nix b/nixos/release.nix index b7f8c01bb000..c2372da23f57 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -336,6 +336,7 @@ in rec { tests.plasma5 = callTest tests/plasma5.nix {}; tests.plotinus = callTest tests/plotinus.nix {}; tests.keymap = callSubTests tests/keymap.nix {}; + tests.incron = callTest tests/incron.nix {}; tests.initrdNetwork = callTest tests/initrd-network.nix {}; tests.kafka = callSubTests tests/kafka.nix {}; tests.kernel-latest = callTest tests/kernel-latest.nix {}; diff --git a/nixos/tests/incron.nix b/nixos/tests/incron.nix new file mode 100644 index 000000000000..e39bbb5f096b --- /dev/null +++ b/nixos/tests/incron.nix @@ -0,0 +1,52 @@ +import ./make-test.nix ({ pkgs, lib, ... }: + +{ + name = "incron"; + meta.maintainers = [ lib.maintainers.aanderse ]; + + machine = + { ... }: + { services.incron.enable = true; + services.incron.extraPackages = [ pkgs.coreutils ]; + services.incron.systab = '' + /test IN_CREATE,IN_MODIFY,IN_CLOSE_WRITE,IN_MOVED_FROM,IN_MOVED_TO echo "$@/$# $%" >> /root/incron.log + ''; + + # ensure the directory to be monitored exists before incron is started + system.activationScripts.incronTest = '' + mkdir /test + ''; + }; + + testScript = '' + startAll; + + $machine->waitForUnit("multi-user.target"); + $machine->waitForUnit("incron.service"); + + $machine->succeed("test -d /test"); + # create some activity for incron to monitor + $machine->succeed("touch /test/file"); + $machine->succeed("echo foo >> /test/file"); + $machine->succeed("mv /test/file /root"); + $machine->succeed("mv /root/file /test"); + + $machine->sleep(1); + + # touch /test/file + $machine->succeed("grep '/test/file IN_CREATE' /root/incron.log"); + + # echo foo >> /test/file + $machine->succeed("grep '/test/file IN_MODIFY' /root/incron.log"); + $machine->succeed("grep '/test/file IN_CLOSE_WRITE' /root/incron.log"); + + # mv /test/file /root + $machine->succeed("grep '/test/file IN_MOVED_FROM' /root/incron.log"); + + # mv /root/file /test + $machine->succeed("grep '/test/file IN_MOVED_TO' /root/incron.log"); + + # ensure something unexpected is not present + $machine->fail("grep 'IN_OPEN' /root/incron.log"); + ''; +}) |