Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 104f8a0e1a17
Choose a base ref
...
head repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bc4361a540e2
Choose a head ref

Commits on Jul 6, 2019

  1. nixos/graylog: fix startup

    Until now the startup failed with an error like this:
    
    ```
    com.github.joschi.jadconfig.ValidationException: Parent path /var/lib/graylog/server for Node ID file at /var/lib/graylog/server/node-id is not a directory
    ```
    
    This happens since `graylog.service` ensures that `/var/lib/graylog`
    exists, however it doesn't take care of the directory for
    `cfg.nodeIdFile`.
    Ma27 committed Jul 6, 2019
    Copy the full SHA
    3464c60 View commit details

Commits on Jul 9, 2019

  1. Copy the full SHA
    60ed1f4 View commit details
  2. nixos/graylog: add test

    Basic test which confirms new inputs can be created and that messages
    can be sent to a UDP-GELF input using `netcat`.
    
    This test requires 4GB of RAM to avoid issues due insufficient
    memory (please refer to `nixos/tests/elk.nix` for a detailed explanation of
    the issue) for elasticsearch.
    
    Also it's ensured that elasticsearch has an open HTTP port for communication
    when starting `graylog`. This is a workaround to ensure that all services
    are started in proper order, even in test environments with less power.
    However this shouldn't be implemented in the `nixos/graylog` module as
    this might be harmful when using elasticsearch clusters that require e.g.
    authentication and/or run on different servers.
    Ma27 committed Jul 9, 2019
    Copy the full SHA
    16d0b8d View commit details

Commits on Jul 16, 2019

  1. nixos/tiddlywiki: init

    Service that runs TiddlyWiki nodejs server
    nbardiuk committed Jul 16, 2019
    Copy the full SHA
    976928d View commit details

Commits on Jul 19, 2019

  1. Copy the full SHA
    0557007 View commit details

Commits on Jul 20, 2019

  1. conda: update default condaDeps

    Conda PyQt5 applications require those packages in the system.
    sbourdeauducq committed Jul 20, 2019
    Copy the full SHA
    c59966d View commit details
  2. tint2: 16.6.1 -> 16.7

    Semi-automatic update generated by
    https://github.com/ryantm/nixpkgs-update tools. This update was made
    based on information from
    https://repology.org/metapackage/tint2/versions
    r-ryantm committed Jul 20, 2019

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    58c7628 View commit details
  3. uftrace: 0.9.2 -> 0.9.3

    Semi-automatic update generated by
    https://github.com/ryantm/nixpkgs-update tools. This update was made
    based on information from
    https://repology.org/metapackage/uftrace/versions
    r-ryantm committed Jul 20, 2019

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Mic92 Jörg Thalheim
    Copy the full SHA
    2535b73 View commit details

Commits on Jul 21, 2019

  1. yandex-disk: 0.1.5.1010 -> 0.1.5.1039

    Semi-automatic update generated by
    https://github.com/ryantm/nixpkgs-update tools. This update was made
    based on information from
    https://repology.org/metapackage/yandex-disk/versions
    r-ryantm committed Jul 21, 2019
    Copy the full SHA
    6b62be5 View commit details
  2. Merge pull request #65194 from r-ryantm/auto-update/uftrace

    uftrace: 0.9.2 -> 0.9.3
    worldofpeace authored Jul 21, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    dywedir Vlad M.
    Copy the full SHA
    b647c76 View commit details
  3. docs: update docs for postgresql plugins (#64899)

    docs: update docs for postgresql plugins
    
    Co-Authored-By: Mario Rodas <marsam@users.noreply.github.com>
    danbst and marsam authored Jul 21, 2019
    Copy the full SHA
    caa0f82 View commit details
  4. postgresql: Make systemd support configurable. See #61580. (#61581)

    On by default, as was before.
    
    The systemd dependency means that all libraries or applications using only libpq
    will also pull systemd into their closures.
    
    Further, no application or library using libpq can be built against musl, as
    systemd relies on glibc-only features and thus does not build with musl.
    
    With it being configurable, packages that need only the library can at
    least turn it off to reduce their closure size.
    nh2 authored and danbst committed Jul 21, 2019
    Copy the full SHA
    943baed View commit details
  5. Merge pull request #65205 from r-ryantm/auto-update/yandex-disk

    yandex-disk: 0.1.5.1010 -> 0.1.5.1039
    markuskowa authored Jul 21, 2019
    Copy the full SHA
    e21cb99 View commit details
  6. prometheus-wireguard-exporter: 2.0.1 -> 3.0.0

    Two new releases are available:
    * https://github.com/MindFlavor/prometheus_wireguard_exporter/releases/tag/3.0.0
    * https://github.com/MindFlavor/prometheus_wireguard_exporter/releases/tag/2.0.2
    
    The main new feature is that the exporter exposes all allowed ips and
    subnets.
    Ma27 committed Jul 21, 2019
    Copy the full SHA
    543ef56 View commit details
  7. nixos/prometheus-exporters/wireguard: add support for -s switch

    Since version 3.0 all allowed IPs and subnets are exposed by the
    exporter. With `-s` set on the CLI, instead of a comma-separated list,
    each allowed IP and subnet will be in a single field with the schema
    `allowed_ip_<index>`.
    Ma27 committed Jul 21, 2019
    Copy the full SHA
    7095bdf View commit details
  8. Merge pull request #65225 from Ma27/bump-prometheus-wireguard-exporter

    prometheus-wireguard-exporter: 2.0.1 -> 3.0.0
    fpletz authored Jul 21, 2019
    Copy the full SHA
    bc41883 View commit details
  9. phpPackages.mailparse: 3.0.2 -> 3.0.3

    Mailparse 3.0.3 adds PHP 7.3 compatibility.
    Claas Augner authored and caugner committed Jul 21, 2019
    Copy the full SHA
    2c55fe1 View commit details
  10. Merge pull request #60436 from nbardiuk/master

    nixos/tiddlywiki: init
    aanderse authored Jul 21, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    44565ad View commit details
  11. Merge pull request #64463 from Ma27/graylog-test

    nixos/graylog: minor fixes, add test
    fpletz authored Jul 21, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    376b5fd View commit details
  12. Merge pull request #65131 from m-labs/for-upstream

    conda: update default condaDeps
    adisbladis authored Jul 21, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    24aef5a View commit details
  13. Merge pull request #65091 from eadwu/firmwareLinuxNonfree/update-1

    firmwareLinuxNonfree: 2019-06-16 -> 2019-07-17
    fpletz authored Jul 21, 2019
    Copy the full SHA
    e467600 View commit details

Commits on Jul 22, 2019

  1. Merge pull request #65193 from r-ryantm/auto-update/tint2

    tint2: 16.6.1 -> 16.7
    romildo authored Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f0b95f3 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7741883 View commit details
  3. linux: 4.19.59 -> 4.19.60

    NeQuissimus committed Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7e6342d View commit details
  4. linux: 4.4.185 -> 4.4.186

    NeQuissimus committed Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    822ae87 View commit details
  5. linux: 4.9.185 -> 4.9.186

    NeQuissimus committed Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a4a4e08 View commit details
  6. linux: 5.1.18 -> 5.1.19

    NeQuissimus committed Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    84d2eb6 View commit details
  7. linux: 5.2.1 -> 5.2.2

    NeQuissimus committed Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e1309f7 View commit details
  8. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2b350d1 View commit details
  9. Merge pull request #65232 from caugner/patch-1

    phpPackages.mailparse: 3.0.2 -> 3.0.3
    etu authored Jul 22, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8866b70 View commit details
  10. Add antora

    domenkozar committed Jul 22, 2019
    Copy the full SHA
    2000a9e View commit details
  11. maintainers: add delan

    delan committed Jul 22, 2019
    Copy the full SHA
    9b7a0ae View commit details
  12. fxlinuxprint: init at 1.1.2-1

    delan committed Jul 22, 2019
    Copy the full SHA
    d6e03ca View commit details
  13. Merge pull request #65196 from delan/fxlinuxprint

    fxlinuxprint: init at 1.1.2-1
    worldofpeace authored Jul 22, 2019
    Copy the full SHA
    c470619 View commit details
  14. kdeconnect: Fix build

    bkchr authored and FRidh committed Jul 22, 2019
    Copy the full SHA
    bc4361a View commit details
Showing with 2,074 additions and 1,397 deletions.
  1. +5 −0 maintainers/maintainer-list.nix
  2. +1 −0 nixos/modules/module-list.nix
  3. +9 −31 nixos/modules/services/databases/postgresql.nix
  4. +68 −2 nixos/modules/services/databases/postgresql.xml
  5. +3 −0 nixos/modules/services/logging/graylog.nix
  6. +52 −0 nixos/modules/services/misc/tiddlywiki.nix
  7. +12 −0 nixos/modules/services/monitoring/prometheus/exporters/wireguard.nix
  8. +2 −0 nixos/tests/all-tests.nix
  9. +111 −0 nixos/tests/graylog.nix
  10. +2 −1 nixos/tests/prometheus-exporters.nix
  11. +67 −0 nixos/tests/tiddlywiki.nix
  12. +1 −1 pkgs/applications/misc/kdeconnect/default.nix
  13. +2 −2 pkgs/applications/misc/tint2/default.nix
  14. +2 −2 pkgs/applications/networking/browsers/vivaldi/default.nix
  15. +1 −0 pkgs/development/node-packages/node-packages-v10.json
  16. +1,638 −1,307 pkgs/development/node-packages/node-packages-v10.nix
  17. +2 −2 pkgs/development/tools/uftrace/default.nix
  18. +51 −0 pkgs/misc/cups/drivers/fxlinuxprint/default.nix
  19. +4 −4 pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
  20. +2 −2 pkgs/os-specific/linux/kernel/linux-4.14.nix
  21. +2 −2 pkgs/os-specific/linux/kernel/linux-4.19.nix
  22. +2 −2 pkgs/os-specific/linux/kernel/linux-4.4.nix
  23. +2 −2 pkgs/os-specific/linux/kernel/linux-4.9.nix
  24. +2 −2 pkgs/os-specific/linux/kernel/linux-5.1.nix
  25. +2 −2 pkgs/os-specific/linux/kernel/linux-5.2.nix
  26. +3 −5 pkgs/servers/monitoring/prometheus/wireguard-exporter.nix
  27. +8 −2 pkgs/servers/sql/postgresql/default.nix
  28. +2 −2 pkgs/tools/filesystems/yandex-disk/default.nix
  29. +2 −1 pkgs/tools/package-management/conda/default.nix
  30. +7 −9 pkgs/tools/system/systemd-journal2gelf/default.nix
  31. +0 −11 pkgs/tools/system/systemd-journal2gelf/deps.nix
  32. +4 −0 pkgs/top-level/all-packages.nix
  33. +3 −3 pkgs/top-level/php-packages.nix
5 changes: 5 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
@@ -1237,6 +1237,11 @@
github = "deepfire";
name = "Kosyrev Serge";
};
delan = {
name = "Delan Azabani";
email = "delan@azabani.com";
github = "delan";
};
delroth = {
email = "delroth@gmail.com";
github = "delroth";
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -473,6 +473,7 @@
./services/misc/synergy.nix
./services/misc/sysprof.nix
./services/misc/taskserver
./services/misc/tiddlywiki.nix
./services/misc/tzupdate.nix
./services/misc/uhub.nix
./services/misc/weechat.nix
40 changes: 9 additions & 31 deletions nixos/modules/services/databases/postgresql.nix
Original file line number Diff line number Diff line change
@@ -6,26 +6,10 @@ let

cfg = config.services.postgresql;

# see description of extraPlugins
postgresqlAndPlugins = pg:
if cfg.extraPlugins == [] then pg
else pkgs.buildEnv {
name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
paths = [ pg pg.lib ] ++ cfg.extraPlugins;
# We include /bin to ensure the $out/bin directory is created which is
# needed because we'll be removing files from that directory in postBuild
# below. See #22653
pathsToLink = [ "/" "/bin" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild =
''
rm $out/bin/{pg_config,postgres,pg_ctl}
cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
'';
};

postgresql = postgresqlAndPlugins cfg.package;
postgresql =
if cfg.extraPlugins == []
then cfg.package
else cfg.package.withPackages (_: cfg.extraPlugins);

# The main PostgreSQL configuration file.
configFile = pkgs.writeText "postgresql.conf"
@@ -58,7 +42,7 @@ in

package = mkOption {
type = types.package;
example = literalExample "pkgs.postgresql_9_6";
example = literalExample "pkgs.postgresql_11";
description = ''
PostgreSQL package to use.
'';
@@ -74,7 +58,7 @@ in

dataDir = mkOption {
type = types.path;
example = "/var/lib/postgresql/9.6";
example = "/var/lib/postgresql/11";
description = ''
Data directory for PostgreSQL.
'';
@@ -195,17 +179,11 @@ in
extraPlugins = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ (pkgs.postgis.override { postgresql = pkgs.postgresql_9_4; }) ]";
example = literalExample "with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]";
description = ''
When this list contains elements a new store path is created.
PostgreSQL and the elements are symlinked into it. Then pg_config,
postgres and pg_ctl are copied to make them use the new
$out/lib directory as pkglibdir. This makes it possible to use postgis
without patching the .sql files which reference $libdir/postgis-1.5.
List of PostgreSQL plugins. PostgreSQL version for each plugin should
match version for <literal>services.postgresql.package</literal> value.
'';
# Note: the duplication of executables is about 4MB size.
# So a nicer solution was patching postgresql to allow setting the
# libdir explicitely.
};

extraConfig = mkOption {
70 changes: 68 additions & 2 deletions nixos/modules/services/databases/postgresql.xml
Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@
<filename>configuration.nix</filename>:
<programlisting>
<xref linkend="opt-services.postgresql.enable"/> = true;
<xref linkend="opt-services.postgresql.package"/> = pkgs.postgresql_9_4;
<xref linkend="opt-services.postgresql.package"/> = pkgs.postgresql_11;
</programlisting>
Note that you are required to specify the desired version of PostgreSQL
(e.g. <literal>pkgs.postgresql_9_4</literal>). Since upgrading your
(e.g. <literal>pkgs.postgresql_11</literal>). Since upgrading your
PostgreSQL version requires a database dump and reload (see below), NixOS
cannot provide a default value for
<xref linkend="opt-services.postgresql.package"/> such as the most recent
@@ -74,4 +74,70 @@ Type "help" for help.
<link linkend="opt-services.postgresql.enable">here</link>.
</para>
</section>
<section xml:id="module-services-postgres-plugins">
<title>Plugins</title>

<para>
Plugins collection for each PostgreSQL version can be accessed with
<literal>.pkgs</literal>. For example, for
<literal>pkgs.postgresql_11</literal> package, its plugin collection is
accessed by <literal>pkgs.postgresql_11.pkgs</literal>:
<screen>
<prompt>$ </prompt>nix repl '&lt;nixpkgs&gt;'

Loading '&lt;nixpkgs&gt;'...
Added 10574 variables.

<prompt>nix-repl&gt; </prompt>postgresql_11.pkgs.&lt;TAB&gt;&lt;TAB&gt;
postgresql_11.pkgs.cstore_fdw postgresql_11.pkgs.pg_repack
postgresql_11.pkgs.pg_auto_failover postgresql_11.pkgs.pg_safeupdate
postgresql_11.pkgs.pg_bigm postgresql_11.pkgs.pg_similarity
postgresql_11.pkgs.pg_cron postgresql_11.pkgs.pg_topn
postgresql_11.pkgs.pg_hll postgresql_11.pkgs.pgjwt
postgresql_11.pkgs.pg_partman postgresql_11.pkgs.pgroonga
...
</screen>
</para>
<para>
To add plugins via NixOS configuration, set <literal>services.postgresql.extraPlugins</literal>:
<programlisting>
<xref linkend="opt-services.postgresql.package"/> = pkgs.postgresql_11;
<xref linkend="opt-services.postgresql.extraPlugins"/> = with pkgs.postgresql_11.pkgs; [
pg_repack
postgis
];
</programlisting>
</para>
<para>
You can build custom PostgreSQL-with-plugins (to be used outside of NixOS) using
function <literal>.withPackages</literal>. For example, creating a custom
PostgreSQL package in an overlay can look like:
<programlisting>
self: super: {
postgresql_custom = self.postgresql_11.withPackages (ps: [
ps.pg_repack
ps.postgis
]);
}
</programlisting>
</para>
<para>
Here's a recipe on how to override a particular plugin through an overlay:
<programlisting>
self: super: {
postgresql_11 = super.postgresql_11.override { this = self.postgresql_11; } // {
pkgs = super.postgresql_11.pkgs // {
pg_repack = super.postgresql_11.pkgs.pg_repack.overrideAttrs (_: {
name = "pg_repack-v20181024";
src = self.fetchzip {
url = "https://github.com/reorg/pg_repack/archive/923fa2f3c709a506e111cc963034bf2fd127aa00.tar.gz";
sha256 = "17k6hq9xaax87yz79j773qyigm4fwk8z4zh5cyp6z0sxnwfqxxw5";
};
});
};
};
}
</programlisting>
</para>
</section>
</chapter>
3 changes: 3 additions & 0 deletions nixos/modules/services/logging/graylog.nix
Original file line number Diff line number Diff line change
@@ -150,6 +150,9 @@ in
rm -rf /var/lib/graylog/plugins || true
mkdir -p /var/lib/graylog/plugins -m 755
mkdir -p "$(dirname ${cfg.nodeIdFile})"
chown -R ${cfg.user} "$(dirname ${cfg.nodeIdFile})"
for declarativeplugin in `ls ${glPlugins}/bin/`; do
ln -sf ${glPlugins}/bin/$declarativeplugin /var/lib/graylog/plugins/$declarativeplugin
done
52 changes: 52 additions & 0 deletions nixos/modules/services/misc/tiddlywiki.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.services.tiddlywiki;
listenParams = concatStrings (mapAttrsToList (n: v: " '${n}=${toString v}' ") cfg.listenOptions);
exe = "${pkgs.nodePackages.tiddlywiki}/lib/node_modules/.bin/tiddlywiki";
name = "tiddlywiki";
dataDir = "/var/lib/" + name;

in {

options.services.tiddlywiki = {

enable = mkEnableOption "TiddlyWiki nodejs server";

listenOptions = mkOption {
type = types.attrs;
default = {};
example = {
credentials = "../credentials.csv";
readers="(authenticated)";
port = 3456;
};
description = ''
Parameters passed to <literal>--listen</literal> command.
Refer to <link xlink:href="https://tiddlywiki.com/#WebServer"/>
for details on supported values.
'';
};
};

config = mkIf cfg.enable {
systemd = {
services.tiddlywiki = {
description = "TiddlyWiki nodejs server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
Restart = "on-failure";
DynamicUser = true;
StateDirectory = name;
ExecStartPre = "-${exe} ${dataDir} --init server";
ExecStart = "${exe} ${dataDir} --listen ${listenParams}";
};
};
};
};
}
Original file line number Diff line number Diff line change
@@ -23,12 +23,24 @@ in {
to set the peers up.
'';
};

singleSubnetPerField = mkOption {
type = types.bool;
default = false;
description = ''
By default, all allowed IPs and subnets are comma-separated in the
<literal>allowed_ips</literal> field. With this option enabled,
a single IP and subnet will be listed in fields like <literal>allowed_ip_0</literal>,
<literal>allowed_ip_1</literal> and so on.
'';
};
};
serviceOpts = {
script = ''
${pkgs.prometheus-wireguard-exporter}/bin/prometheus_wireguard_exporter \
-p ${toString cfg.port} \
${optionalString cfg.verbose "-v"} \
${optionalString cfg.singleSubnetPerField "-s"} \
${optionalString (cfg.wireguardConfig != null) "-n ${cfg.wireguardConfig}"}
'';

2 changes: 2 additions & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
@@ -100,6 +100,7 @@ in
graphene = handleTest ./graphene.nix {};
grafana = handleTest ./grafana.nix {};
graphite = handleTest ./graphite.nix {};
graylog = handleTest ./graylog.nix {};
hadoop.hdfs = handleTestOn [ "x86_64-linux" ] ./hadoop/hdfs.nix {};
hadoop.yarn = handleTestOn [ "x86_64-linux" ] ./hadoop/yarn.nix {};
handbrake = handleTestOn ["x86_64-linux"] ./handbrake.nix {};
@@ -247,6 +248,7 @@ in
pdns-recursor = handleTest ./pdns-recursor.nix {};
taskserver = handleTest ./taskserver.nix {};
telegraf = handleTest ./telegraf.nix {};
tiddlywiki = handleTest ./tiddlywiki.nix {};
tinydns = handleTest ./tinydns.nix {};
tor = handleTest ./tor.nix {};
transmission = handleTest ./transmission.nix {};
111 changes: 111 additions & 0 deletions nixos/tests/graylog.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import ./make-test.nix ({ pkgs, lib, ... }: {
name = "graylog";
meta.maintainers = with lib.maintainers; [ ma27 ];

machine = { pkgs, ... }: {
virtualisation.memorySize = 4096;
virtualisation.diskSize = 4096;

services.mongodb.enable = true;
services.elasticsearch.enable = true;
services.elasticsearch.package = pkgs.elasticsearch-oss;
services.elasticsearch.extraConf = ''
network.publish_host: 127.0.0.1
network.bind_host: 127.0.0.1
'';

services.graylog = {
enable = true;
passwordSecret = "YGhZ59wXMrYOojx5xdgEpBpDw2N6FbhM4lTtaJ1KPxxmKrUvSlDbtWArwAWMQ5LKx1ojHEVrQrBMVRdXbRyZLqffoUzHfssc";
elasticsearchHosts = [ "http://localhost:9200" ];

# `echo -n "nixos" | shasum -a 256`
rootPasswordSha2 = "6ed332bcfa615381511d4d5ba44a293bb476f368f7e9e304f0dff50230d1a85b";
};

environment.systemPackages = [ pkgs.jq ];

systemd.services.graylog.path = [ pkgs.netcat ];
systemd.services.graylog.preStart = ''
until nc -z localhost 9200; do
sleep 2
done
'';
};

testScript = let
payloads.login = pkgs.writeText "login.json" (builtins.toJSON {
host = "127.0.0.1:9000";
username = "admin";
password = "nixos";
});

payloads.input = pkgs.writeText "input.json" (builtins.toJSON {
title = "Demo";
global = false;
type = "org.graylog2.inputs.gelf.udp.GELFUDPInput";
node = "@node@";
configuration = {
bind_address = "0.0.0.0";
decompress_size_limit = 8388608;
number_worker_threads = 1;
override_source = null;
port = 12201;
recv_buffer_size = 262144;
};
});

payloads.gelf_message = pkgs.writeText "gelf.json" (builtins.toJSON {
host = "example.org";
short_message = "A short message";
full_message = "A long message";
version = "1.1";
level = 5;
facility = "Test";
});
in ''
$machine->start;
$machine->waitForUnit("graylog.service");
$machine->waitForOpenPort(9000);
$machine->succeed("curl -sSfL http://127.0.0.1:9000/");
my $session = $machine->succeed("curl -X POST "
. "-sSfL http://127.0.0.1:9000/api/system/sessions "
. "-d \$(cat ${payloads.login}) "
. "-H 'Content-Type: application/json' "
. "-H 'Accept: application/json' "
. "-H 'x-requested-by: cli' "
. "| jq .session_id | xargs echo"
);
chomp($session);
$machine->succeed("curl -X POST "
. "-sSfL http://127.0.0.1:9000/api/system/inputs -u $session:session "
. "-d \$(cat ${payloads.input} | sed -e \"s,\@node\@,\$(cat /var/lib/graylog/server/node-id),\") "
. "-H 'Accept: application/json' "
. "-H 'Content-Type: application/json' "
. "-H 'x-requested-by: cli' "
);
$machine->waitUntilSucceeds("test \"\$(curl -sSfL 'http://127.0.0.1:9000/api/cluster/inputstates' "
. "-u $session:session "
. "-H 'Accept: application/json' "
. "-H 'Content-Type: application/json' "
. "-H 'x-requested-by: cli'"
. "| jq 'to_entries[]|.value|.[0]|.state' | xargs echo"
. ")\" = \"RUNNING\""
);
$machine->succeed("echo -n \$(cat ${payloads.gelf_message}) | nc -w10 -u 127.0.0.1 12201");
$machine->succeed("test \"\$(curl -X GET "
. "-sSfL 'http://127.0.0.1:9000/api/search/universal/relative?query=*' "
. "-u $session:session "
. "-H 'Accept: application/json' "
. "-H 'Content-Type: application/json' "
. "-H 'x-requested-by: cli'"
. " | jq '.total_results' | xargs echo)\" = \"1\""
);
'';
})
Loading