Skip to content
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
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6c864de769a6
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 23e79267d4d6
Choose a head ref

Commits on Nov 5, 2018

  1. Copy the full SHA
    ddb35fe View commit details

Commits on Nov 6, 2018

  1. Copy the full SHA
    6a31bbb View commit details

Commits on Nov 15, 2018

  1. rss2email module: init

    Also adding `system-sendmail` package for sharing the code with other
    modules or packages needing it.
    Ekleog committed Nov 15, 2018
    Copy the full SHA
    0483ce0 View commit details

Commits on Nov 16, 2018

  1. ibus-table: fix FHS path default in tabcreatedb.py

    It uses /usr/share as a default parameter, which errors out on NixOS.
    This replaces it with the path to the derivation.
    Kevin Liu committed Nov 16, 2018
    Copy the full SHA
    95dee0d View commit details
  2. ibus-table-chinese: init at 1.8.2

    Kevin Liu committed Nov 16, 2018
    Copy the full SHA
    624966a View commit details

Commits on Nov 17, 2018

  1. clightning: 0.6.1 -> 0.6.2

    Signed-off-by: William Casarin <jb55@jb55.com>
    jb55 committed Nov 17, 2018
    Copy the full SHA
    3c1d711 View commit details

Commits on Nov 18, 2018

  1. xidlehook: 0.6.0 -> 0.6.1

    jD91mZM2 committed Nov 18, 2018
    Copy the full SHA
    a2ae93a View commit details
  2. xidlehook: Fix darwin build

    ... I think
    jD91mZM2 committed Nov 18, 2018
    Copy the full SHA
    e2d5470 View commit details

Commits on Nov 19, 2018

  1. nixos/firewall: Always use global firewall.allowed rules

    Apply global firewall.allowed* rules separately from the
    interface specific rules.
    blaxill committed Nov 19, 2018
    Copy the full SHA
    551d2f7 View commit details

Commits on Nov 21, 2018

  1. Copy the full SHA
    32779b4 View commit details
  2. Copy the full SHA
    6dda65e View commit details
  3. Add release notes

    blaxill committed Nov 21, 2018
    Copy the full SHA
    b48c6d0 View commit details

Commits on Nov 22, 2018

  1. fetchurl: mirrors: http -> https, https before http, http before ftp

    Because HTTP has a higher probability of working behind proxies.
    oxij committed Nov 22, 2018
    Copy the full SHA
    8dcf831 View commit details
  2. Flexget: 2.16.2 -> 2.17.4

    sjau committed Nov 22, 2018
    Copy the full SHA
    e651ea5 View commit details
  3. keybinder3: 0.3.0 -> 0.3.2

    * keybinder3: 0.3.0 -> 0.3.2 (#50718)
    
    Semi-automatic update generated by
    https://github.com/ryantm/nixpkgs-update tools. This update was made
    based on information from
    https://repology.org/metapackage/keybinder3/versions
    
    * keybinder3: refresh
    
    Use new GitHub repo at https://github.com/kupferlauncher/keybinder
    Move autoconf/automake/libtool to nativeBuildInputs
    r-ryantm authored and c0bw3b committed Nov 22, 2018
    Copy the full SHA
    6a2963f View commit details
  4. Copy the full SHA
    744c971 View commit details
  5. maintainer: add jhillyerd

    jhillyerd committed Nov 22, 2018
    Copy the full SHA
    6aacc6f View commit details
  6. PULL_REQUEST_TEMPLATE: Ask for docs

    nh2 authored and FRidh committed Nov 22, 2018
    Copy the full SHA
    f2816e4 View commit details
  7. Merge pull request #50530 from jb55/bump-clightning

    clightning: 0.6.1 -> 0.6.2
    c0bw3b authored Nov 22, 2018
    Copy the full SHA
    4f29b8e View commit details
  8. golint: 20180208 -> 20181026

    - golint has moved from github to golang.org/x/lint
    - allowGoReferences must be true, fixes #50907
    jhillyerd committed Nov 22, 2018
    Copy the full SHA
    bd3810a View commit details
  9. Merge pull request #49824 from Assassinkin/libmr

    pythonPackages.libmr: init at 0.1.9
    lheckemann authored Nov 22, 2018
    Copy the full SHA
    20b3d00 View commit details
  10. python: pytest_37: init at 3.7.4

    Needed at least by pyjwt.
    fpletz committed Nov 22, 2018
    Copy the full SHA
    eb2d56c View commit details
  11. python: pyjwt: fix build

    fpletz committed Nov 22, 2018
    Copy the full SHA
    bcf736b View commit details
  12. sysdig: 0.23.1 -> 0.24.1

    * support kernels 4.14.0 to 4.19.x
    
    * move cmake and perl into native build inputs
    
    * licensing change:
      - userspace programs are now licensed under Apache 2.0
      - kernel module is now licensed under both MIT and GPLv2
    c0bw3b committed Nov 22, 2018
    Copy the full SHA
    c644bf3 View commit details

Commits on Nov 23, 2018

  1. Copy the full SHA
    308ab4e View commit details
  2. Copy the full SHA
    3963629 View commit details
  3. mopidy-iris: 3.29.2 -> 3.31.1

    Tomahna committed Nov 23, 2018
    Copy the full SHA
    c7f3f3a View commit details
  4. timidity: 2.14.0 -> 2.15.0

    vbgl committed Nov 23, 2018
    Copy the full SHA
    6bdb039 View commit details
  5. Merge pull request #50929 from c0bw3b/pkg/sysdig

    sysdig: 0.23.1 -> 0.24.1
    7c6f434c authored Nov 23, 2018
    Copy the full SHA
    24b381e View commit details
  6. nextcloud-client: 2.3.3 -> 2.5.0 (#50463)

    Updates to the latest version of the desktop client available. Tested
    the config migration from `nextcloud-client` 2.3.3 with a Nextcloud
    14.0.3 instance (hosted using `services.nextcloud`).
    
    Additionally the derivation required the following changes:
    
    * Dropped `Qt5Sql` patch: this has been fixed upstream and isn't needed
      anymore (furthermore their CMake structure has changed and the patch
      wouldn't apply anymore on 2.5.0).
    
    * Moved to a new upstream repository (nextcloud/desktop), kept
      `fetchgit` to properly fetch submodules.
    
    * Added OpenSSL 1.1 integration: `libsync` (the syncing provided by this
      package) requires 1.1, furthermore the linking flags had to be fixed
      manually by passing `NIX_LDFLAGS` to the derivation.
    
    Furthermore I moved the support for a Gnome3 keyring into its own
    wrapper to avoid a full rebuild of the package whenever you alter
    `withGnomeKeyring` in an override expressions.
    
    It's still possible to enable keyring (now without recompile) like this:
    
    ```
    nextcloud-client.override { withGnomeKeyring = true; }
    ```
    
    To override the derivation itself you now have to use
    `nextcloud-client-unwrapped`:
    
    ```
    nextcloud-client-unwrapped.overrideAttrs (old: {
       src = yoursrc;
    })
    ```
    Ma27 authored and worldofpeace committed Nov 23, 2018
    Copy the full SHA
    e75f922 View commit details
  7. insomnia: 6.0.2 -> 6.2.0 (#50906)

    - Switch to using autoPatchelfHook
    - Add some new deps needed for this version
    
    In particular the application won't function without `stdenv.cc.cc`
    in LD_LIBRARY_PATH.
    worldofpeace authored Nov 23, 2018
    Copy the full SHA
    f591dd2 View commit details
  8. runc: 1.0.0-rc5 -> 1.0.0-rc6

    Signed-off-by: Vincent Demeester <vincent@sbr.pm>
    vdemeester committed Nov 23, 2018
    Copy the full SHA
    9536fa2 View commit details
  9. libxkbcommon: split version (for bitwig)

    Ingolf Wagner authored and worldofpeace committed Nov 23, 2018
    Copy the full SHA
    b499f92 View commit details
  10. bitwig-studio1: fix dependency to libxkbcommon_7

    Ingolf Wagner authored and worldofpeace committed Nov 23, 2018
    Copy the full SHA
    6fcc67e View commit details
  11. urweb: 20170720 -> 20180616

    yrashk committed Nov 23, 2018
    Copy the full SHA
    4c1d199 View commit details
  12. Merge pull request #50937 from tathougies/travis/uriparser-cross

    uriparser: Enable cross-compilation
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    8dca420 View commit details
  13. Merge pull request #50924 from jhillyerd/add-jhillyerd

    maintainer: add jhillyerd
    srhb authored Nov 23, 2018
    Copy the full SHA
    3fb98d5 View commit details
  14. Merge pull request #50944 from yrashk/urweb-20180616

    urweb: 20170720 -> 20180616
    srhb authored Nov 23, 2018
    Copy the full SHA
    0ce8f99 View commit details
  15. Merge pull request #50942 from vdemeester/update-runc

    runc: 1.0.0-rc5 -> 1.0.0-rc6
    srhb authored Nov 23, 2018
    Copy the full SHA
    5a73ff0 View commit details
  16. Merge pull request #50908 from jhillyerd/golint

    golint: 20180208 -> 20181026
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    7acd4eb View commit details
  17. Merge pull request #50641 from blaxill/firewallMerge

    nixos/firewall: Always use global firewall.allowed rules
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    d3aeed3 View commit details
  18. Merge pull request #50940 from Tomahna/mopidy-iris

    mopidy-iris: 3.29.2 -> 3.31.1
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    af9e846 View commit details
  19. Merge pull request #50560 from oxij/pkgs/fetchurl-mirrors

    fetchurl: mirrors: http -> https, https before http, http before ftp
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    c424c11 View commit details
  20. Merge pull request #50919 from sjau/flexget-2.17.14

    Flexget: 2.16.2 -> 2.17.4
    Mic92 authored Nov 23, 2018
    Copy the full SHA
    04719a0 View commit details
  21. Copy the full SHA
    ef5da57 View commit details
  22. nixos-build-vms: fix eval

    Previously I got the following error message:
    
    ```
    error: opening file '/home/ma27/Projects/nixpkgs/nixos/modules/installer/default.nix': No such file or directory
    ```
    
    Probably related to 6c68fbd.
    Ma27 committed Nov 23, 2018
    Copy the full SHA
    b36fa8e View commit details
  23. Merge pull request #50941 from vbgl/timidity-2.15

    timidity: 2.14.0 -> 2.15.0
    lheckemann authored Nov 23, 2018
    Copy the full SHA
    5bc4595 View commit details
  24. pymssql: init at 2.1.4

    Massimo Redaelli authored and FRidh committed Nov 23, 2018
    Copy the full SHA
    1bf18e4 View commit details
  25. Merge pull request #50475 from Pneumaticat/ibus-table-chinese-init

    ibus-table-chinese: init at 1.8.2
    Ma27 authored Nov 23, 2018
    Copy the full SHA
    80e9f77 View commit details
  26. Merge pull request #50947 from mayflower/bump-hound

    hound: 20170324 -> 2018-11-02
    grahamc authored Nov 23, 2018
    Copy the full SHA
    9836d48 View commit details
Showing with 1,633 additions and 423 deletions.
  1. +1 −0 .github/PULL_REQUEST_TEMPLATE.md
  2. +15 −0 maintainers/maintainer-list.nix
  3. +11 −0 nixos/doc/manual/release-notes/rl-1903.xml
  4. +1 −1 nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
  5. +2 −0 nixos/modules/misc/ids.nix
  6. +1 −0 nixos/modules/module-list.nix
  7. +136 −0 nixos/modules/services/mail/rss2email.nix
  8. +51 −26 nixos/modules/services/monitoring/prometheus/alertmanager.nix
  9. +9 −10 nixos/modules/services/networking/firewall.nix
  10. +1 −0 nixos/tests/all-tests.nix
  11. +15 −0 nixos/tests/common/webroot/news-rss.xml
  12. +22 −0 nixos/tests/prometheus.nix
  13. +66 −0 nixos/tests/rss2email.nix
  14. +14 −4 pkgs/applications/altcoins/clightning.nix
  15. +2 −2 pkgs/applications/audio/mopidy/iris.nix
  16. +2 −2 pkgs/applications/misc/nnn/default.nix
  17. +7 −2 pkgs/applications/networking/feedreaders/rss2email/default.nix
  18. +6 −6 pkgs/applications/networking/flexget/default.nix
  19. +11 −20 pkgs/applications/networking/nextcloud-client/default.nix
  20. +0 −12 pkgs/applications/networking/nextcloud-client/find-sql.patch
  21. +14 −0 pkgs/applications/networking/nextcloud-client/wrapper.nix
  22. +30 −0 pkgs/applications/video/pyca/default.nix
  23. +2 −2 pkgs/applications/virtualization/runc/default.nix
  24. +15 −15 pkgs/build-support/fetchurl/mirrors.nix
  25. +2 −2 pkgs/data/fonts/inter-ui/default.nix
  26. +2 −2 pkgs/development/compilers/ghc/8.4.4.nix
  27. +2 −2 pkgs/development/compilers/ghc/8.6.1.nix
  28. +2 −2 pkgs/development/compilers/ghc/8.6.2.nix
  29. +1 −1 pkgs/development/compilers/ghc/head.nix
  30. +3 −3 pkgs/development/compilers/urweb/default.nix
  31. +376 −147 pkgs/development/haskell-modules/hackage-packages.nix
  32. +7 −7 pkgs/development/libraries/keybinder3/default.nix
  33. +32 −0 pkgs/development/libraries/libxkbcommon/libxkbcommon_7.nix
  34. +5 −3 pkgs/development/libraries/uriparser/default.nix
  35. +2 −2 pkgs/development/libraries/webkitgtk/2.22.nix
  36. +25 −0 pkgs/development/python-modules/libmr/default.nix
  37. +25 −0 pkgs/development/python-modules/nanoleaf/default.nix
  38. +3 −3 pkgs/development/python-modules/prettytable/default.nix
  39. +2 −2 pkgs/development/python-modules/pyjwt/default.nix
  40. +26 −0 pkgs/development/python-modules/pymssql/default.nix
  41. +49 −36 pkgs/development/python-modules/pytest/default.nix
  42. +21 −0 pkgs/development/python-modules/sdnotify/default.nix
  43. +17 −5 pkgs/development/tools/golint/default.nix
  44. +3 −2 pkgs/development/tools/golint/deps.nix
  45. +3 −4 pkgs/development/tools/minizinc/default.nix
  46. +3 −3 pkgs/development/tools/misc/hound/default.nix
  47. +6 −6 pkgs/development/tools/phantomjs2/default.nix
  48. +4 −4 pkgs/development/tools/skaffold/default.nix
  49. +53 −23 pkgs/development/web/insomnia/default.nix
  50. +2 −2 pkgs/games/minetest/default.nix
  51. +1 −1 pkgs/games/steam/runtime-wrapped.nix
  52. +2 −1 pkgs/os-specific/linux/iwd/default.nix
  53. +2 −2 pkgs/os-specific/linux/kernel/linux-4.14.nix
  54. +2 −2 pkgs/os-specific/linux/kernel/linux-4.19.nix
  55. +2 −2 pkgs/os-specific/linux/kernel/linux-4.9.nix
  56. +17 −13 pkgs/os-specific/linux/open-iscsi/default.nix
  57. +10 −5 pkgs/os-specific/linux/sysdig/default.nix
  58. +4 −0 pkgs/os-specific/linux/wpa_supplicant/default.nix
  59. +1 −1 pkgs/servers/home-assistant/component-packages.nix
  60. +3 −3 pkgs/servers/home-assistant/default.nix
  61. +36 −0 pkgs/servers/mail/system-sendmail/default.nix
  62. +2 −2 pkgs/servers/matrix-synapse/default.nix
  63. +7 −6 pkgs/shells/powershell/default.nix
  64. +25 −0 pkgs/tools/X11/imwheel/default.nix
  65. +4 −4 pkgs/tools/X11/xidlehook/default.nix
  66. +64 −0 pkgs/tools/inputmethods/ibus-engines/ibus-table-chinese/default.nix
  67. +1 −0 pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
  68. +2 −2 pkgs/tools/misc/direnv/default.nix
  69. +3 −3 pkgs/tools/misc/hyperfine/default.nix
  70. +3 −3 pkgs/tools/misc/timidity/default.nix
  71. +43 −0 pkgs/tools/networking/ssh-agents/default.nix
  72. +2 −2 pkgs/tools/security/browserpass/default.nix
  73. +2 −2 pkgs/tools/security/nsjail/default.nix
  74. +2 −0 pkgs/tools/security/wpscan/Gemfile
  75. +55 −0 pkgs/tools/security/wpscan/Gemfile.lock
  76. +21 −0 pkgs/tools/security/wpscan/default.nix
  77. +164 −0 pkgs/tools/security/wpscan/gemset.nix
  78. +29 −4 pkgs/top-level/all-packages.nix
  79. +4 −0 pkgs/top-level/haskell-packages.nix
  80. +10 −2 pkgs/top-level/python-packages.nix
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nox --run "nox-review wip"`
- [ ] Tested execution of all binary files (usually in `./result/bin/`)
- [ ] Determined the impact on package closure size (by running `nix path-info -S` before and after)
- [ ] Assured whether relevant documentation is up to date
- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).

---
15 changes: 15 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
@@ -1319,6 +1319,11 @@
github = "ellis";
name = "Ellis Whitehead";
};
elseym = {
email = "elseym@me.com";
github = "elseym";
name = "Simon Waibl";
};
elvishjerricco = {
email = "elvishjerricco@gmail.com";
github = "ElvishJerricco";
@@ -2027,6 +2032,11 @@
github = "jhhuh";
name = "Ji-Haeng Huh";
};
jhillyerd = {
email = "james+nixos@hillyerd.com";
github = "jhillyerd";
name = "James Hillyerd";
};
jirkamarsik = {
email = "jiri.marsik89@gmail.com";
github = "jirkamarsik";
@@ -4917,4 +4927,9 @@
github = "zzamboni";
name = "Diego Zamboni";
};
mredaelli = {
email = "massimo@typish.io";
github = "mredaelli";
name = "Massimo Redaelli";
};
}
11 changes: 11 additions & 0 deletions nixos/doc/manual/release-notes/rl-1903.xml
Original file line number Diff line number Diff line change
@@ -222,6 +222,17 @@
reset to the default value (<literal>false</literal>).
</para>
</listitem>
<listitem>
<para>
Network interface indiscriminate NixOS firewall options
(<literal>networking.firewall.allow*</literal>) are now preserved when also
setting interface specific rules such as <literal>networking.firewall.interfaces.en0.allow*</literal>.
These rules continue to use the pseudo device "default"
(<literal>networking.firewall.interfaces.default.*</literal>), and assigning
to this pseudo device will override the (<literal>networking.firewall.allow*</literal>)
options.
</para>
</listitem>
</itemizedlist>
</section>

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ let nodes = import networkExpr; in

with import ../../../../lib/testing.nix {
inherit system;
pkgs = import ../.. { inherit system config; };
pkgs = import ../../../../.. { inherit system config; };
};

(makeTest { inherit nodes; testScript = ""; }).driver
2 changes: 2 additions & 0 deletions nixos/modules/misc/ids.nix
Original file line number Diff line number Diff line change
@@ -336,6 +336,7 @@
solr = 309;
alerta = 310;
minetest = 311;
rss2email = 312;

# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!

@@ -632,6 +633,7 @@
solr = 309;
alerta = 310;
minetest = 311;
rss2email = 312;

# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -330,6 +330,7 @@
./services/mail/postgrey.nix
./services/mail/spamassassin.nix
./services/mail/rspamd.nix
./services/mail/rss2email.nix
./services/mail/rmilter.nix
./services/mail/nullmailer.nix
./services/misc/airsonic.nix
136 changes: 136 additions & 0 deletions nixos/modules/services/mail/rss2email.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.services.rss2email;
in {

###### interface

options = {

services.rss2email = {

enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable rss2email.";
};

to = mkOption {
type = types.str;
description = "Mail address to which to send emails";
};

interval = mkOption {
type = types.str;
default = "12h";
description = "How often to check the feeds, in systemd interval format";
};

config = mkOption {
type = with types; attrsOf (either str (either int bool));
default = {};
description = ''
The configuration to give rss2email.
Default will use system-wide <literal>sendmail</literal> to send the
email. This is rss2email's default when running
<literal>r2e new</literal>.
This set contains key-value associations that will be set in the
<literal>[DEFAULT]</literal> block along with the
<literal>to</literal> parameter.
See
<literal>https://github.com/rss2email/rss2email/blob/master/r2e.1</literal>
for more information on which parameters are accepted.
'';
};

feeds = mkOption {
description = "The feeds to watch.";
type = types.attrsOf (types.submodule {
options = {
url = mkOption {
type = types.str;
description = "The URL at which to fetch the feed.";
};

to = mkOption {
type = with types; nullOr str;
default = null;
description = ''
Email address to which to send feed items.
If <literal>null</literal>, this will not be set in the
configuration file, and rss2email will make it default to
<literal>rss2email.to</literal>.
'';
};
};
});
};
};

};


###### implementation

config = mkIf cfg.enable {
users.groups = {
rss2email.gid = config.ids.gids.rss2email;
};

users.users = {
rss2email = {
description = "rss2email user";
uid = config.ids.uids.rss2email;
group = "rss2email";
};
};

services.rss2email.config.to = cfg.to;

systemd.services.rss2email = let
conf = pkgs.writeText "rss2email.cfg" (lib.generators.toINI {} ({
DEFAULT = cfg.config;
} // lib.mapAttrs' (name: feed: nameValuePair "feed.${name}" (
{ inherit (feed) url; } //
lib.optionalAttrs (feed.to != null) { inherit (feed) to; }
)) cfg.feeds
));
in
{
preStart = ''
mkdir -p /var/rss2email
chmod 700 /var/rss2email
cp ${conf} /var/rss2email/conf.cfg
if [ ! -f /var/rss2email/db.json ]; then
echo '{"version":2,"feeds":[]}' > /var/rss2email/db.json
fi
chown -R rss2email:rss2email /var/rss2email
'';
path = [ pkgs.system-sendmail ];
serviceConfig = {
ExecStart =
"${pkgs.rss2email}/bin/r2e -c /var/rss2email/conf.cfg -d /var/rss2email/db.json run";
User = "rss2email";
PermissionsStartOnly = "true";
};
};

systemd.timers.rss2email = {
partOf = [ "rss2email.service" ];
wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "0";
timerConfig.OnUnitActiveSec = cfg.interval;
};
};

meta.maintainers = with lib.maintainers; [ ekleog ];
}
77 changes: 51 additions & 26 deletions nixos/modules/services/monitoring/prometheus/alertmanager.nix
Original file line number Diff line number Diff line change
@@ -5,10 +5,18 @@ with lib;
let
cfg = config.services.prometheus.alertmanager;
mkConfigFile = pkgs.writeText "alertmanager.yml" (builtins.toJSON cfg.configuration);
alertmanagerYml =
if cfg.configText != null then
pkgs.writeText "alertmanager.yml" cfg.configText
else mkConfigFile;

checkedConfig = file: pkgs.runCommand "checked-config" { buildInputs = [ cfg.package ]; } ''
ln -s ${file} $out
amtool check-config $out
'';

alertmanagerYml = let
yml = if cfg.configText != null then
pkgs.writeText "alertmanager.yml" cfg.configText
else mkConfigFile;
in checkedConfig yml;

cmdlineArgs = cfg.extraFlags ++ [
"--config.file ${alertmanagerYml}"
"--web.listen-address ${cfg.listenAddress}:${toString cfg.port}"
@@ -23,6 +31,15 @@ in {
services.prometheus.alertmanager = {
enable = mkEnableOption "Prometheus Alertmanager";

package = mkOption {
type = types.package;
default = pkgs.prometheus-alertmanager;
defaultText = "pkgs.alertmanager";
description = ''
Package that should be used for alertmanager.
'';
};

user = mkOption {
type = types.str;
default = "nobody";
@@ -40,8 +57,8 @@ in {
};

configuration = mkOption {
type = types.attrs;
default = {};
type = types.nullOr types.attrs;
default = null;
description = ''
Alertmanager configuration as nix attribute set.
'';
@@ -119,26 +136,34 @@ in {
};
};

config = mkMerge [
(mkIf cfg.enable {
assertions = singleton {
assertion = cfg.configuration != null || cfg.configText != null;
message = "Can not enable alertmanager without a configuration. "
+ "Set either the `configuration` or `configText` attribute.";
};
})
(mkIf cfg.enable {
networking.firewall.allowedTCPPorts = optional cfg.openFirewall cfg.port;

systemd.services.alertmanager = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${cfg.package}/bin/alertmanager \
${concatStringsSep " \\\n " cmdlineArgs}
'';

config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = optional cfg.openFirewall cfg.port;

systemd.services.alertmanager = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${pkgs.prometheus-alertmanager.bin}/bin/alertmanager \
${concatStringsSep " \\\n " cmdlineArgs}
'';

serviceConfig = {
User = cfg.user;
Group = cfg.group;
Restart = "always";
PrivateTmp = true;
WorkingDirectory = "/tmp";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
serviceConfig = {
User = cfg.user;
Group = cfg.group;
Restart = "always";
PrivateTmp = true;
WorkingDirectory = "/tmp";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
};
};
};
};
})
];
}
19 changes: 9 additions & 10 deletions nixos/modules/services/networking/firewall.nix
Original file line number Diff line number Diff line change
@@ -58,6 +58,9 @@ let
${text}
''; in "${dir}/bin/${name}";

defaultInterface = { default = mapAttrs (name: value: cfg."${name}") commonOptions; };
allInterfaces = defaultInterface // cfg.interfaces;

startScript = writeShScript "firewall-start" ''
${helpers}
@@ -154,7 +157,7 @@ let
ip46tables -A nixos-fw -p tcp --dport ${toString port} -j nixos-fw-accept ${optionalString (iface != "default") "-i ${iface}"}
''
) cfg.allowedTCPPorts
) cfg.interfaces)}
) allInterfaces)}
# Accept connections to the allowed TCP port ranges.
${concatStrings (mapAttrsToList (iface: cfg:
@@ -164,7 +167,7 @@ let
ip46tables -A nixos-fw -p tcp --dport ${range} -j nixos-fw-accept ${optionalString (iface != "default") "-i ${iface}"}
''
) cfg.allowedTCPPortRanges
) cfg.interfaces)}
) allInterfaces)}
# Accept packets on the allowed UDP ports.
${concatStrings (mapAttrsToList (iface: cfg:
@@ -173,7 +176,7 @@ let
ip46tables -A nixos-fw -p udp --dport ${toString port} -j nixos-fw-accept ${optionalString (iface != "default") "-i ${iface}"}
''
) cfg.allowedUDPPorts
) cfg.interfaces)}
) allInterfaces)}
# Accept packets on the allowed UDP port ranges.
${concatStrings (mapAttrsToList (iface: cfg:
@@ -183,7 +186,7 @@ let
ip46tables -A nixos-fw -p udp --dport ${range} -j nixos-fw-accept ${optionalString (iface != "default") "-i ${iface}"}
''
) cfg.allowedUDPPortRanges
) cfg.interfaces)}
) allInterfaces)}
# Accept IPv4 multicast. Not a big security risk since
# probably nobody is listening anyway.
@@ -508,15 +511,11 @@ in
};

interfaces = mkOption {
default = {
default = mapAttrs (name: value: cfg."${name}") commonOptions;
};
default = { };
type = with types; attrsOf (submodule [ { options = commonOptions; } ]);
description =
''
Interface-specific open ports. Setting this value will override
all values of the <literal>networking.firewall.allowed*</literal>
options.
Interface-specific open ports.
'';
};
} // commonOptions;
Loading