Browse Source

Merge branch 'master' into staging

nsd-state-dir
Vladimír Čunát 6 years ago
parent
commit
6bea415b5e
No known key found for this signature in database GPG Key ID: E747DF1F9575A3AA
  1. 16
      .github/CONTRIBUTING.md
  2. 31
      doc/cross-compilation.xml
  3. 5
      lib/licenses.nix
  4. 3
      lib/maintainers.nix
  5. 24
      nixos/doc/manual/release-notes/rl-1703.xml
  6. 2
      nixos/modules/hardware/video/amdgpu-pro.nix
  7. 2
      nixos/modules/hardware/video/ati.nix
  8. 2
      nixos/modules/hardware/video/bumblebee.nix
  9. 16
      nixos/modules/installer/tools/nixos-generate-config.pl
  10. 2
      nixos/modules/misc/ids.nix
  11. 3
      nixos/modules/module-list.nix
  12. 3
      nixos/modules/profiles/all-hardware.nix
  13. 4
      nixos/modules/rename.nix
  14. 38
      nixos/modules/security/grsecurity.xml
  15. 51
      nixos/modules/services/hardware/bluetooth.nix
  16. 35
      nixos/modules/services/hardware/illum.nix
  17. 2
      nixos/modules/services/hardware/sane.nix
  18. 54
      nixos/modules/services/hardware/trezord.nix
  19. 2
      nixos/modules/services/mail/postfix.nix
  20. 1
      nixos/modules/services/misc/gogs.nix
  21. 8
      nixos/modules/services/misc/taskserver/default.nix
  22. 84
      nixos/modules/services/network-filesystems/glusterfs.nix
  23. 97
      nixos/modules/services/network-filesystems/nfsd.nix
  24. 47
      nixos/modules/services/networking/chrony.nix
  25. 5
      nixos/modules/services/networking/cjdns.nix
  26. 177
      nixos/modules/services/networking/dnschain.nix
  27. 4
      nixos/modules/services/networking/firewall.nix
  28. 211
      nixos/modules/services/networking/namecoind.nix
  29. 52
      nixos/modules/services/networking/rpcbind.nix
  30. 3
      nixos/modules/services/networking/supplicant.nix
  31. 2
      nixos/modules/services/web-servers/apache-httpd/default.nix
  32. 198
      nixos/modules/services/web-servers/apache-httpd/moodle.nix
  33. 17
      nixos/modules/services/web-servers/nginx/default.nix
  34. 8
      nixos/modules/system/boot/systemd-lib.nix
  35. 6
      nixos/modules/system/boot/systemd-unit-options.nix
  36. 23
      nixos/modules/system/boot/systemd.nix
  37. 2
      nixos/modules/tasks/filesystems.nix
  38. 11
      nixos/modules/tasks/filesystems/glusterfs.nix
  39. 97
      nixos/modules/tasks/filesystems/nfs.nix
  40. 5
      nixos/modules/tasks/kbd.nix
  41. 4
      nixos/modules/tasks/network-interfaces-systemd.nix
  42. 39
      nixos/tests/chromium.nix
  43. 6
      nixos/tests/nfs.nix
  44. 25
      pkgs/applications/audio/audio-recorder/default.nix
  45. 51
      pkgs/applications/audio/audio-recorder/icon-names.diff
  46. 28
      pkgs/applications/audio/gbsplay/default.nix
  47. 9
      pkgs/applications/audio/qjackctl/default.nix
  48. 484
      pkgs/applications/editors/emacs-modes/melpa-generated.nix
  49. 84
      pkgs/applications/editors/emacs-modes/melpa-stable-generated.nix
  50. 11
      pkgs/applications/editors/emacs/macport-25.1.nix
  51. 4
      pkgs/applications/editors/vim/configurable.nix
  52. 5
      pkgs/applications/editors/vscode/default.nix
  53. 4
      pkgs/applications/graphics/digikam/5.nix
  54. 6
      pkgs/applications/graphics/rawtherapee/default.nix
  55. 96
      pkgs/applications/misc/googleearth/default.nix
  56. 4
      pkgs/applications/misc/keepassx/community.nix
  57. 0
      pkgs/applications/misc/krename/kde4.nix
  58. 35
      pkgs/applications/misc/krename/kde5.nix
  59. 19
      pkgs/applications/misc/llpp/default.nix
  60. 40
      pkgs/applications/misc/redshift-plasma-applet/default.nix
  61. 28
      pkgs/applications/misc/taskwarrior/0001-bash-completion-quote-pattern-argument-to-grep.patch
  62. 4
      pkgs/applications/misc/taskwarrior/default.nix
  63. 6
      pkgs/applications/networking/browsers/chromium/upstream-info.nix
  64. 5
      pkgs/applications/networking/browsers/firefox/wrapper.nix
  65. 8
      pkgs/applications/networking/browsers/opera/default.nix
  66. 35
      pkgs/applications/networking/cluster/minikube/default.nix
  67. 6
      pkgs/applications/networking/cluster/terragrunt/default.nix
  68. 60
      pkgs/applications/networking/cluster/terragrunt/deps.nix
  69. 8
      pkgs/applications/networking/instant-messengers/scudcloud/default.nix
  70. 21
      pkgs/applications/networking/mailreaders/notmuch/muchsync.nix
  71. 466
      pkgs/applications/networking/mailreaders/thunderbird-bin/sources.nix
  72. 4
      pkgs/applications/networking/mailreaders/thunderbird/default.nix
  73. 111
      pkgs/applications/networking/remote/freerdp/default.nix
  74. 73
      pkgs/applications/networking/remote/freerdp/legacy.nix
  75. 56
      pkgs/applications/networking/remote/freerdp/unstable.nix
  76. 34
      pkgs/applications/networking/remote/remmina/default.nix
  77. 6
      pkgs/applications/networking/sync/unison/default.nix
  78. 15
      pkgs/applications/office/cb2bib/default.nix
  79. 1
      pkgs/applications/office/libreoffice/default.nix
  80. 1
      pkgs/applications/office/libreoffice/still.nix
  81. 37
      pkgs/applications/science/biology/ecopcr/default.nix
  82. 6
      pkgs/applications/science/biology/emboss/default.nix
  83. 4
      pkgs/applications/version-management/git-and-tools/git/default.nix
  84. 122
      pkgs/applications/video/gnash/default.nix
  85. 6
      pkgs/applications/video/kodi/plugins.nix
  86. 15
      pkgs/applications/video/vokoscreen/default.nix
  87. 4
      pkgs/applications/virtualization/rkt/default.nix
  88. 23
      pkgs/applications/virtualization/virt-top/default.nix
  89. 4
      pkgs/applications/window-managers/jwm/default.nix
  90. 2
      pkgs/build-support/fetchurl/mirrors.nix
  91. 33
      pkgs/data/fonts/liberastika/default.nix
  92. 20
      pkgs/data/fonts/redhat-liberation-fonts/binary.nix
  93. 100
      pkgs/data/fonts/redhat-liberation-fonts/default.nix
  94. 4
      pkgs/desktops/gnome-2/platform/gnome-vfs/default.nix
  95. 4
      pkgs/desktops/kde-4.14/kdenetwork/krdc.nix
  96. 1
      pkgs/desktops/kde-5/applications/default.nix
  97. 6
      pkgs/desktops/kde-5/applications/gwenview.nix
  98. 26
      pkgs/desktops/kde-5/applications/okteta.nix
  99. 6
      pkgs/development/compilers/julia/0.5.nix
  100. 25
      pkgs/development/compilers/julia/0004-hardened-0.4.7.patch

16
.github/CONTRIBUTING.md

@ -14,14 +14,22 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
* Format the commits in the following way:
`(pkg-name | service-name): (from -> to | init at version | refactor | etc)`
```
(pkg-name | service-name): (from -> to | init at version | refactor | etc)
(Motivation for change. Additional information.)
```
Examples:
* nginx: init at 2.0.1
* firefox: 3.0 -> 3.1.1
* hydra service: add bazBaz option
Dual baz behavior is needed to do foo.
* nginx service: refactor config generation
The old config generation system used impure shell scripts and could break in specific circumstances (see #1234).
* `meta.description` should:
* Be capitalized
@ -30,6 +38,12 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
See the nixpkgs manual for more details on how to [Submit changes to nixpkgs](https://nixos.org/nixpkgs/manual/#chap-submitting-changes).
## Writing good commit messages
In addition to writing properly formatted commit messages, it's important to include relevant information so other developers can later understand *why* a change was made. While this information usually can be found by digging code, mailing list archives, pull request discussions or upstream changes, it may require a lot of work.
For package version upgrades and such a one-line commit message is usually sufficient.
## Reviewing contributions
See the nixpkgs manual for more details on how to [Review contributions](https://nixos.org/nixpkgs/manual/#sec-reviewing-contributions).

31
doc/cross-compilation.xml

@ -25,7 +25,7 @@
<!--============================================================-->
<section xml:id="sec-cross-packaging">
<title>Packing in a cross-friendly manner</title>
<title>Packaging in a cross-friendly manner</title>
<section>
<title>Platform parameters</title>
@ -105,14 +105,15 @@
This is the most important guiding principle behind cross-compilation with Nixpkgs, and will be called the <wordasword>sliding window principle</wordasword>.
In this manner, given the 3 platforms for one package, we can determine the three platforms for all its transitive dependencies.
</para>
<para>
Some examples will probably make this clearer.
If a package is being built with a <literal>(build, host, target)</literal> platform triple of <literal>(foo, bar, bar)</literal>, then its build-time dependencies would have a triple of <literal>(foo, foo, bar)</literal>, and <emphasis>those packages'</emphasis> build-time dependencies would have triple of <literal>(foo, foo, foo)</literal>.
In other words, it should take two "rounds" of following build-time dependency edges before one reaches a fixed point where, by the sliding window principle, the platform triple no longer changes.
Indeed, this happens with cross compilation, where only rounds of native dependencies starting with the second necessarily coincide with native packages.
</para>
<note><para>
The depending package's target platform is unconstrained by the sliding window principle, which makes sense in that one can in principle build cross compilers targeting arbitrary platforms.
</para></note>
<warning><para>
From the above, one would surmise that if a package is being built with a <literal>(build, host, target)</literal> platform triple of <literal>(foo, bar, bar)</literal>, then its build-time dependencies would have a triple of <literal>(foo, foo, bar)</literal>, and <emphasis>those packages'</emphasis> build-time dependencies would have triple of <literal>(foo, foo, foo)</literal>.
In other words, it should take two "rounds" of following build-time dependency edges before one reaches a fixed point where, by the sliding window principle, the platform triple no longer changes.
Unfortunately, at the moment, we do <emphasis>not</emphasis> implement this correctly, and after only one round of following build-time dependencies is the fixed point reached, with target incorrectly kept different than the others.
</para></warning>
<para>
How does this work in practice? Nixpkgs is now structured so that build-time dependencies are taken from from <varname>buildPackages</varname>, whereas run-time dependencies are taken from the top level attribute set.
For example, <varname>buildPackages.gcc</varname> should be used at build time, while <varname>gcc</varname> should be used at run time.
@ -131,9 +132,23 @@
<section xml:id="sec-cross-usage">
<title>Cross-building packages</title>
<note><para>
More information needs to moved from the old wiki, especially <link xlink:href="https://nixos.org/wiki/CrossCompiling" />, for this section.
</para></note>
<para>
Many sources (manual, wiki, etc) probably mention passing <varname>system</varname>, <varname>platform</varname>, and, optionally, <varname>crossSystem</varname> to nixpkgs:
<literal>import &lt;nixpkgs&gt; { system = ..; platform = ..; crossSystem = ..; }</literal>.
<varname>system</varname> and <varname>platform</varname> together determine the system on which packages are built, and <varname>crossSystem</varname> specifies the platform on which packages are ultimately intended to run, if it is different.
This still works, but with more recent changes, one can alternatively pass <varname>localSystem</varname>, containing <varname>system</varname> and <varname>platform</varname>, for symmetry.
</para>
<para>
To be written.
This is basically unchanged so see the old wiki for now.
One would think that <varname>localSystem</varname> and <varname>crossSystem</varname> overlap horribly with the three <varname>*Platforms</varname> (<varname>buildPlatform</varname>, <varname>hostPlatform,</varname> and <varname>targetPlatform</varname>; see <varname>stage.nix</varname> or the manual).
Actually, those identifiers are purposefully not used here to draw a subtle but important distinction:
While the granularity of having 3 platforms is necessary to properly *build* packages, it is overkill for specifying the user's *intent* when making a build plan or package set.
A simple "build vs deploy" dichotomy is adequate: the sliding window principle described in the previous section shows how to interpolate between the these two "end points" to get the 3 platform triple for each bootstrapping stage.
That means for any package a given package set, even those not bound on the top level but only reachable via dependencies or <varname>buildPackages</varname>, the three platforms will be defined as one of <varname>localSystem</varname> or <varname>crossSystem</varname>, with the former replacing the latter as one traverses build-time dependencies.
A last simple difference then is <varname>crossSystem</varname> should be null when one doesn't want to cross-compile, while the <varname>*Platform</varname>s are always non-null.
<varname>localSystem</varname> is always non-null.
</para>
</section>

5
lib/licenses.nix

@ -379,6 +379,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Mozilla Public License 2.0";
};
mspl = spdx {
spdxId = "MS-PL";
fullName = "Microsoft Public License";
};
msrla = {
fullName = "Microsoft Research License Agreement";
url = "http://research.microsoft.com/en-us/projects/pex/msr-la.txt";

3
lib/maintainers.nix

@ -81,6 +81,7 @@
c0dehero = "CodeHero <codehero@nerdpol.ch>";
calrama = "Moritz Maxeiner <moritz@ucworks.org>";
campadrenalin = "Philip Horger <campadrenalin@gmail.com>";
canndrew = "Andrew Cann <shum@canndrew.org>";
carlsverre = "Carl Sverre <accounts@carlsverre.com>";
cdepillabout = "Dennis Gosnell <cdep.illabout@gmail.com>";
cfouche = "Chaddaï Fouché <chaddai.fouche@gmail.com>";
@ -111,6 +112,7 @@
cwoac = "Oliver Matthews <oliver@codersoffortune.net>";
DamienCassou = "Damien Cassou <damien@cassou.me>";
danbst = "Danylo Hlynskyi <abcz2.uprola@gmail.com>";
dancek = "Hannu Hartikainen <hannu.hartikainen@gmail.com>";
danielfullmer = "Daniel Fullmer <danielrf12@gmail.com>";
dasuxullebt = "Christoph-Simon Senjak <christoph.senjak@googlemail.com>";
davidak = "David Kleuker <post@davidak.de>";
@ -296,6 +298,7 @@
mdaiter = "Matthew S. Daiter <mdaiter8121@gmail.com>";
meditans = "Carlo Nucera <meditans@gmail.com>";
meisternu = "Matt Miemiec <meister@krutt.org>";
metabar = "Celine Mercier <softs@metabarcoding.org>";
mguentner = "Maximilian Güntner <code@klandest.in>";
mic92 = "Jörg Thalheim <joerg@higgsboson.tk>";
michaelpj = "Michael Peyton Jones <michaelpj@gmail.com>";

24
nixos/doc/manual/release-notes/rl-1703.xml

@ -46,6 +46,7 @@ following incompatible changes:</para>
for what those parameters represent.
</para>
</listitem>
<listitem>
<para>
<literal>ansible</literal> now defaults to ansible version 2 as version 1
@ -54,6 +55,7 @@ following incompatible changes:</para>
vulnerability</link> unpatched by upstream.
</para>
</listitem>
<listitem>
<para>
<literal>gnome</literal> alias has been removed along with
@ -116,7 +118,6 @@ following incompatible changes:</para>
</listitem>
<listitem>
<para><literal>overridePackages</literal> function no longer exists.
It is replaced by <link
xlink:href="https://nixos.org/nixpkgs/manual/#sec-overlays-install">
@ -153,18 +154,39 @@ following incompatible changes:</para>
</para>
</listitem>
<listitem>
<para>
<literal>local_recipient_maps</literal> is not set to empty value by
Postfix service. It's an insecure default as stated by Postfix
documentation. Those who want to retain this setting need to set it via
<literal>services.postfix.extraConfig</literal>.
</para>
</listitem>
</itemizedlist>
<para>Other notable improvements:</para>
<itemizedlist>
<listitem>
<para>Module type system have a new extensible option types feature that
allow to extend certain types, such as enum, through multiple option
declarations of the same option across multiple modules.
</para>
</listitem>
<listitem>
<para>
<literal>jre</literal> now defaults to GTK+ UI by default. This
improves visual consistency and makes Java follow system font style,
improving the situation on HighDPI displays. This has a cost of increased
closure size; for server and other headless workloads it's recommended to
use <literal>jre_headless</literal>.
</para>
</listitem>
</itemizedlist>

2
nixos/modules/hardware/video/amdgpu-pro.nix

@ -21,6 +21,8 @@ in
config = mkIf enabled {
nixpkgs.config.xorg.abiCompat = "1.18";
services.xserver.drivers = singleton
{ name = "amdgpu"; modules = [ package ]; libPath = [ package ]; };

2
nixos/modules/hardware/video/ati.nix

@ -18,7 +18,7 @@ in
config = mkIf enabled {
nixpkgs.config.xorg.fglrxCompat = true;
nixpkgs.config.xorg.abiCompat = "1.17";
services.xserver.drivers = singleton
{ name = "fglrx"; modules = [ ati_x11 ]; libPath = [ "${ati_x11}/lib" ]; };

2
nixos/modules/hardware/video/bumblebee.nix

@ -76,7 +76,7 @@ in
config = mkIf cfg.enable {
boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ];
boot.kernelModules = optional useBbswitch [ "bbswitch" ];
boot.kernelModules = optional useBbswitch "bbswitch";
boot.extraModulePackages = optional useBbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11;
environment.systemPackages = [ bumblebee primus ];

16
nixos/modules/installer/tools/nixos-generate-config.pl

@ -208,9 +208,6 @@ foreach my $path (glob "/sys/bus/pci/devices/*") {
pciCheck $path;
}
push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
# Idem for USB devices.
sub usbCheck {
@ -277,6 +274,12 @@ if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
push @imports, "<nixpkgs/nixos/modules/profiles/qemu-guest.nix>";
}
# Also for Hyper-V.
if ($virt eq "microsoft") {
push @initrdAvailableKernelModules, "hv_storvsc";
$videoDriver = "fbdev";
}
# Pull in NixOS configuration for containers.
if ($virt eq "systemd-nspawn") {
@ -307,6 +310,7 @@ sub findStableDevPath {
return $dev;
}
push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
# Generate the swapDevices option from the currently activated swap
# devices.
@ -588,6 +592,12 @@ $bootLoaderConfig
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Enable CUPS to print documents.
# services.printing.enable = true;

2
nixos/modules/misc/ids.nix

@ -286,6 +286,7 @@
gogs = 268;
pdns-recursor = 269;
kresd = 270;
rpc = 271;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -541,6 +542,7 @@
couchpotato = 267;
gogs = 268;
kresd = 270;
#rpc = 271; # unused
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

3
nixos/modules/module-list.nix

@ -197,6 +197,7 @@
./services/hardware/bluetooth.nix
./services/hardware/brltty.nix
./services/hardware/freefall.nix
./services/hardware/illum.nix
./services/hardware/irqbalance.nix
./services/hardware/nvidia-optimus.nix
./services/hardware/pcscd.nix
@ -205,6 +206,7 @@
./services/hardware/tcsd.nix
./services/hardware/tlp.nix
./services/hardware/thinkfan.nix
./services/hardware/trezord.nix
./services/hardware/udev.nix
./services/hardware/udisks2.nix
./services/hardware/upower.nix
@ -339,6 +341,7 @@
./services/monitoring/zabbix-server.nix
./services/network-filesystems/cachefilesd.nix
./services/network-filesystems/drbd.nix
./services/network-filesystems/glusterfs.nix
./services/network-filesystems/ipfs.nix
./services/network-filesystems/netatalk.nix
./services/network-filesystems/nfsd.nix

3
nixos/modules/profiles/all-hardware.nix

@ -42,6 +42,9 @@
# Virtio (QEMU, KVM etc.) support.
"virtio_net" "virtio_pci" "virtio_blk" "virtio_scsi" "virtio_balloon" "virtio_console"
# Hyper-V support.
"hv_storvsc"
# Keyboards
"usbhid" "hid_apple" "hid_logitech_dj" "hid_lenovo_tpkbd" "hid_roccat"
];

4
nixos/modules/rename.nix

@ -172,6 +172,10 @@ with lib;
(mkRenamedOptionModule [ "services" "locate" "period" ] [ "services" "locate" "interval" ])
(mkRemovedOptionModule [ "services" "locate" "includeStore" ] "Use services.locate.prunePaths" )
# nfs
(mkRenamedOptionModule [ "services" "nfs" "lockdPort" ] [ "services" "nfs" "server" "lockdPort" ])
(mkRenamedOptionModule [ "services" "nfs" "statdPort" ] [ "services" "nfs" "server" "statdPort" ])
# Options that are obsolete and have no replacement.
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "")

38
nixos/modules/security/grsecurity.xml

@ -7,21 +7,20 @@
<title>Grsecurity/PaX</title>
<para>
Grsecurity/PaX is a set of patches against the Linux kernel that make it
harder to exploit bugs. The patchset includes protections such as
enforcement of non-executable memory, address space layout randomization,
and chroot jail hardening. These and other
Grsecurity/PaX is a set of patches against the Linux kernel that
implements an extensive suite of
<link xlink:href="https://grsecurity.net/features.php">features</link>
render entire classes of exploits inert without additional efforts on the
part of the adversary.
designed to increase the difficulty of exploiting kernel and
application bugs.
</para>
<para>
The NixOS grsecurity/PaX module is designed with casual users in mind and is
intended to be compatible with normal desktop usage, without unnecessarily
compromising security. The following sections describe the configuration
and administration of a grsecurity/PaX enabled NixOS system. For
more comprehensive coverage, please refer to the
intended to be compatible with normal desktop usage, without
<emphasis>unnecessarily</emphasis> compromising security. The
following sections describe the configuration and administration of
a grsecurity/PaX enabled NixOS system. For more comprehensive
coverage, please refer to the
<link xlink:href="https://en.wikibooks.org/wiki/Grsecurity">grsecurity wikibook</link>
and the
<link xlink:href="https://wiki.archlinux.org/index.php/Grsecurity">Arch
@ -35,7 +34,7 @@
and each configuration requires quite a bit of testing to ensure that the
resulting packages work as advertised. Defining additional package sets
would likely result in a large number of functionally broken packages, to
nobody's benefit.</para></note>.
nobody's benefit.</para></note>
</para>
<sect1 xml:id="sec-grsec-enable"><title>Enabling grsecurity/PaX</title>
@ -126,10 +125,10 @@
The NixOS kernel is built using upstream's recommended settings for a
desktop deployment that generally favours security over performance. This
section details deviations from upstream's recommendations that may
compromise operational security.
compromise security.
<warning><para>There may be additional problems not covered here!</para>
</warning>.
</warning>
</para>
<itemizedlist>
@ -159,8 +158,8 @@
<listitem><para>
The NixOS module conditionally weakens <command>chroot</command>
restrictions to accommodate NixOS lightweight containers and sandboxed Nix
builds. This is problematic if the deployment also runs a privileged
network facing process that <emphasis>relies</emphasis> on
builds. This can be problematic if the deployment also runs privileged
network facing processes that <emphasis>rely</emphasis> on
<command>chroot</command> for isolation.
</para></listitem>
@ -221,15 +220,18 @@
</para>
<para>
The wikibook provides an exhaustive listing of
The grsecurity/PaX wikibook provides an exhaustive listing of
<link xlink:href="https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options">kernel configuration options</link>.
</para>
<para>
The NixOS module makes several assumptions about the kernel and so
may be incompatible with your customised kernel. Currently, the only way
to work around incompatibilities is to eschew the NixOS module.
to work around these incompatibilities is to eschew the NixOS
module.
</para>
<para>
If not using the NixOS module, a custom grsecurity package set can
be specified inline instead, as in
<programlisting>
@ -290,7 +292,7 @@
<listitem><para>User initiated autoloading of modules (e.g., when
using fuse or loop devices) is disallowed; either load requisite modules
as root or add them to<option>boot.kernelModules</option>.</para></listitem>
as root or add them to <option>boot.kernelModules</option>.</para></listitem>
<listitem><para>Virtualization: KVM is the preferred virtualization
solution. Xen, Virtualbox, and VMWare are

51
nixos/modules/services/hardware/bluetooth.nix

@ -2,41 +2,9 @@
with lib;
let
bluez-bluetooth = if config.services.xserver.desktopManager.kde4.enable then pkgs.bluez else pkgs.bluez5;
configBluez = {
description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
ExecStart = "${getBin bluez-bluetooth}/bin/bluetoothd -n";
};
wantedBy = [ "bluetooth.target" ];
};
configBluez5 = {
description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
ExecStart = "${getBin bluez-bluetooth}/bin/bluetoothd -n";
NotifyAccess="main";
CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE";
LimitNPROC=1;
};
wantedBy = [ "bluetooth.target" ];
};
isBluez4 = config.services.xserver.desktopManager.kde4.enable;
bluez-bluetooth = if isBluez4 then pkgs.bluez4 else pkgs.bluez;
obexConfig = {
description = "Bluetooth OBEX service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez.obex";
ExecStart = "${getBin bluez-bluetooth}/bin/obexd";
};
};
bluezConfig = if config.services.xserver.desktopManager.kde4.enable then configBluez else configBluez5;
in
{
@ -58,10 +26,21 @@ in
config = mkIf config.hardware.bluetooth.enable {
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
services.udev.packages = [ bluez-bluetooth ];
services.dbus.packages = [ bluez-bluetooth ];
systemd.services."dbus-org.bluez" = bluezConfig;
systemd.services."dbus-org.bluez.obex" = obexConfig;
systemd.packages = [ bluez-bluetooth ];
systemd.services.bluetooth = {
wantedBy = [ "bluetooth.target" ];
aliases = [ "dbus-org.bluez.service" ];
};
systemd.user.services.obex = mkIf (!isBluez4) {
aliases = [ "dbus-org.bluez.obex.service" ];
};
};

35
nixos/modules/services/hardware/illum.nix

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.illum;
in {
options = {
services.illum = {
enable = mkOption {
default = false;
type = types.bool;
description = ''
Enable illum, a daemon for controlling screen brightness with brightness buttons.
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.illum = {
description = "Backlight Adjustment Service";
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.illum}/bin/illum-d";
};
};
}

2
nixos/modules/services/hardware/sane.nix

@ -51,7 +51,7 @@ in
Enable support for SANE scanners.
<note><para>
Users in the "scanner" group will gain access to the scanner.
Users in the "scanner" group will gain access to the scanner, or the "lp" group if it's also a printer.
</para></note>
'';
};

54
nixos/modules/services/hardware/trezord.nix

@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.trezord;
in {
### interface
options = {
services.trezord = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable Trezor bridge daemon, for use with Trezor hardware bitcoin wallets.
'';
};
};
};
### implementation
config = mkIf cfg.enable {
services.udev.packages = lib.singleton (pkgs.writeTextFile {
name = "trezord-udev-rules";
destination = "/etc/udev/rules.d/51-trezor.rules";
text = ''
SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0666", GROUP="dialout", SYMLINK+="trezor%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0666", GROUP="dialout"
'';
});
systemd.services.trezord = {
description = "TREZOR Bridge";
after = [ "systemd-udev-settle.service" "network.target" ];
wantedBy = [ "multi-user.target" ];
path = [];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.trezord}/bin/trezord -f";
User = "trezord";
};
};
users.users.trezord = {
group = "trezord";
description = "Trezor bridge daemon user";
};
users.groups.trezord = {};
};
}

2
nixos/modules/services/mail/postfix.nix

@ -79,8 +79,6 @@ let
relay_domains = ${concatStringsSep ", " cfg.relayDomains}
''
+ ''
local_recipient_maps =
relayhost = ${if cfg.lookupMX || cfg.relayHost == "" then
cfg.relayHost
else

1
nixos/modules/services/misc/gogs.nix

@ -208,6 +208,7 @@ in
group = "gogs";
home = cfg.stateDir;
createHome = true;
shell = pkgs.bash;
};
extraGroups.gogs.gid = config.ids.gids.gogs;
};

8
nixos/modules/services/misc/taskserver/default.nix

@ -125,10 +125,10 @@ let
server.key = ${cfg.dataDir}/keys/server.key
server.crl = ${cfg.dataDir}/keys/server.crl
'' else ''
ca.cert = ${cfg.pki.ca.cert}
server.cert = ${cfg.pki.server.cert}
server.key = ${cfg.pki.server.key}
server.crl = ${cfg.pki.server.crl}
ca.cert = ${cfg.pki.manual.ca.cert}
server.cert = ${cfg.pki.manual.server.cert}
server.key = ${cfg.pki.manual.server.key}
server.crl = ${cfg.pki.manual.server.crl}
''}
'' + cfg.extraConfig);

84
nixos/modules/services/network-filesystems/glusterfs.nix

@ -0,0 +1,84 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (pkgs) glusterfs;
cfg = config.services.glusterfs;
in
{
###### interface
options = {
services.glusterfs = {
enable = mkEnableOption "GlusterFS Daemon";
logLevel = mkOption {
type = types.enum ["DEBUG" "INFO" "WARNING" "ERROR" "CRITICAL" "TRACE" "NONE"];
description = "Log level used by the GlusterFS daemon";
default = "INFO";
};
extraFlags = mkOption {
type = types.listOf types.str;
description = "Extra flags passed to the GlusterFS daemon";
default = [];
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.glusterfs ];
services.rpcbind.enable = true;
systemd.services.glusterd = {
description = "GlusterFS, a clustered file-system server";
wantedBy = [ "multi-user.target" ];
requires = [ "rpcbind.service" ];
after = [ "rpcbind.service" "network.target" "local-fs.target" ];
before = [ "network-online.target" ];
preStart = ''
install -m 0755 -d /var/log/glusterfs
'';
serviceConfig = {
Type="forking";
PIDFile="/run/glusterd.pid";
LimitNOFILE=65536;
ExecStart="${glusterfs}/sbin/glusterd -p /run/glusterd.pid --log-level=${cfg.logLevel} ${toString cfg.extraFlags}";
KillMode="process";
};
};
systemd.services.glustereventsd = {
description = "Gluster Events Notifier";
wantedBy = [ "multi-user.target" ];
after = [ "syslog.target" "network.target" ];
serviceConfig = {
Type="simple";
Environment="PYTHONPATH=${glusterfs}/usr/lib/python2.7/site-packages";
PIDFile="/run/glustereventsd.pid";
ExecStart="${glusterfs}/sbin/glustereventsd --pid-file /run/glustereventsd.pid";
ExecReload="/bin/kill -SIGUSR2 $MAINPID";
KillMode="control-group";
};
};
};
}

97
nixos/modules/services/network-filesystems/nfsd.nix

@ -20,6 +20,7 @@ in
server = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the kernel's NFS server.
@ -27,6 +28,7 @@ in
};
exports = mkOption {
type = types.lines;
default = "";
description = ''
Contents of the /etc/exports file. See
@ -36,6 +38,7 @@ in
};
hostName = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Hostname or address on which NFS requests will be accepted.
@ -46,6 +49,7 @@ in
};
nproc = mkOption {
type = types.int;
default = 8;
description = ''
Number of NFS server threads. Defaults to the recommended value of 8.
@ -53,11 +57,13 @@ in
};
createMountPoints = mkOption {
type = types.bool;
default = false;
description = "Whether to create the mount points in the exports file at startup time.";
};
mountdPort = mkOption {
type = types.nullOr types.int;
default = null;
example = 4002;
description = ''
@ -66,11 +72,26 @@ in
};
lockdPort = mkOption {
default = 0;
type = types.nullOr types.int;
default = null;
example = 4001;
description = ''
Use a fixed port for the NFS lock manager kernel module
(<literal>lockd/nlockmgr</literal>). This is useful if the
NFS server is behind a firewall.
'';
};
statdPort = mkOption {
type = types.nullOr types.int;
default = null;
example = 4000;
description = ''
Fix the lockd port number. This can help setting firewall rules for NFS.
Use a fixed port for <command>rpc.statd</command>. This is
useful if the NFS server is behind a firewall.
'';
};
};
};
@ -82,60 +103,47 @@ in
config = mkIf cfg.enable {
services.rpcbind.enable = true;
services.nfs.extraConfig = ''
[nfsd]
threads=${toString cfg.nproc}
${optionalString (cfg.hostName != null) "host=${cfg.hostName}"}
boot.supportedFilesystems = [ "nfs" ]; # needed for statd and idmapd
environment.systemPackages = [ pkgs.nfs-utils ];
[mountd]
${optionalString (cfg.mountdPort != null) "port=${toString cfg.mountdPort}"}
environment.etc.exports.source = exports;
[statd]
${optionalString (cfg.statdPort != null) "port=${toString cfg.statdPort}"}
boot.kernelModules = [ "nfsd" ];
[lockd]
${optionalString (cfg.lockdPort != null) ''
port=${toString cfg.lockdPort}
udp-port=${toString cfg.lockdPort}
''}
'';
systemd.services.nfsd =
{ description = "NFS Server";
services.rpcbind.enable = true;
wantedBy = [ "multi-user.target" ];
boot.supportedFilesystems = [ "nfs" ]; # needed for statd and idmapd
requires = [ "rpcbind.service" "mountd.service" ];
after = [ "rpcbind.service" "mountd.service" "idmapd.service" ];
before = [ "statd.service" ];
environment.etc.exports.source = exports;
path = [ pkgs.nfs-utils ];
systemd.services.nfs-server =
{ enable = true;
wantedBy = [ "multi-user.target" ];
script =
preStart =
''
# Create a state directory required by NFSv4.
mkdir -p /var/lib/nfs/v4recovery
${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_tcpport=${builtins.toString cfg.lockdPort}
${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_udpport=${builtins.toString cfg.lockdPort}
rpc.nfsd \
${if cfg.hostName != null then "-H ${cfg.hostName}" else ""} \
${builtins.toString cfg.nproc}
'';
postStop = "rpc.nfsd 0";
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
};
systemd.services.mountd =
{ description = "NFSv3 Mount Daemon";
requires = [ "rpcbind.service" ];
after = [ "rpcbind.service" "local-fs.target" ];
path = [ pkgs.nfs-utils pkgs.sysvtools pkgs.utillinux ];
systemd.services.nfs-mountd =
{ enable = true;
restartTriggers = [ exports ];
preStart =
''
mkdir -p /var/lib/nfs
touch /var/lib/nfs/rmtab
mountpoint -q /proc/fs/nfsd || mount -t nfsd none /proc/fs/nfsd
${optionalString cfg.createMountPoints
''
@ -146,18 +154,7 @@ in
| xargs -d '\n' mkdir -p
''
}
exportfs -rav
'';
restartTriggers = [ exports ];
serviceConfig.Type = "forking";
serviceConfig.ExecStart = ''
@${pkgs.nfs-utils}/sbin/rpc.mountd rpc.mountd \
${if cfg.mountdPort != null then "-p ${toString cfg.mountdPort}" else ""}
'';
serviceConfig.Restart = "always";
};
};

47
nixos/modules/services/networking/chrony.nix

@ -12,6 +12,25 @@ let
cfg = config.services.chrony;
configFile = pkgs.writeText "chrony.conf" ''
${concatMapStringsSep "\n" (server: "server " + server) cfg.servers}
${optionalString
cfg.initstepslew.enabled
"initstepslew ${toString cfg.initstepslew.threshold} ${concatStringsSep " " cfg.initstepslew.servers}"
}
driftfile ${stateDir}/chrony.drift
keyfile ${keyFile}
${optionalString (!config.time.hardwareClockInLocalTime) "rtconutc"}
${cfg.extraConfig}
'';
chronyFlags = "-n -m -u chrony -f ${configFile} ${toString cfg.extraFlags}";
in
{
@ -58,6 +77,13 @@ in
<literal>chrony.conf</literal>
'';
};
extraFlags = mkOption {
default = [];
example = [ "-s" ];
type = types.listOf types.str;
description = "Extra flags passed to the chronyd command.";
};
};
};
@ -70,25 +96,6 @@ in
# Make chronyc available in the system path
environment.systemPackages = [ pkgs.chrony ];
environment.etc."chrony.conf".text =
''
${concatMapStringsSep "\n" (server: "server " + server) cfg.servers}
${optionalString
cfg.initstepslew.enabled
"initstepslew ${toString cfg.initstepslew.threshold} ${concatStringsSep " " cfg.initstepslew.servers}"
}
driftfile ${stateDir}/chrony.drift
keyfile ${keyFile}
generatecommandkey
${optionalString (!config.time.hardwareClockInLocalTime) "rtconutc"}
${cfg.extraConfig}
'';
users.extraGroups = singleton
{ name = "chrony";
gid = config.ids.gids.chrony;
@ -124,7 +131,7 @@ in
'';
serviceConfig =
{ ExecStart = "${pkgs.chrony}/bin/chronyd -n -m -u chrony";
{ ExecStart = "${pkgs.chrony}/bin/chronyd ${chronyFlags}";
};
};

5
nixos/modules/services/networking/cjdns.nix

@ -258,9 +258,8 @@ in
Restart = "always";
StartLimitInterval = 0;
RestartSec = 1;
CapabilityBoundingSet = "CAP_NET_ADMIN CAP_NET_RAW";
AmbientCapabilities = "CAP_NET_ADMIN CAP_NET_RAW";
ProtectSystem = "full";
CapabilityBoundingSet = "CAP_NET_ADMIN CAP_NET_RAW CAP_SETUID";
ProtectSystem = true;
MemoryDenyWriteExecute = true;
ProtectHome = true;
PrivateTmp = true;

177
nixos/modules/services/networking/dnschain.nix

@ -3,23 +3,28 @@
with lib;
let
cfg = config.services;
cfgs = config.services;
cfg = cfgs.dnschain;
dnschainConf = pkgs.writeText "dnschain.conf" ''
dataDir = "/var/lib/dnschain";
username = "dnschain";
configFile = pkgs.writeText "dnschain.conf" ''
[log]
level=info
level = info
[dns]
host = 127.0.0.1
port = 5333
host = ${cfg.dns.address}
port = ${toString cfg.dns.port}
oldDNSMethod = NO_OLD_DNS
# TODO: check what that address is acutally used for
externalIP = 127.0.0.1
externalIP = ${cfg.dns.address}
[http]
host = 127.0.0.1
port=8088
tlsPort=4443
host = ${cfg.api.hostname}
port = ${toString cfg.api.port}
tlsPort = ${toString cfg.api.tlsPort}
${cfg.extraConfig}
'';
in
@ -32,28 +37,81 @@ in
services.dnschain = {
enable = mkOption {
type = types.bool;
default = false;
enable = mkEnableOption ''
DNSChain, a blockchain based DNS + HTTP server.
To resolve .bit domains set <literal>services.namecoind.enable = true;</literal>
and an RPC username/password.
'';
dns.address = mkOption {
type = types.str;
default = "127.0.0.1";
description = ''
Whether to run dnschain. That implies running
namecoind as well, so make sure to configure
it appropriately.
The IP address that will be used to reach this machine.
Leave this unchanged if you do not wish to directly expose the DNSChain resolver.
'';
};
};
dns.port = mkOption {
type = types.int;
default = 5333;
description = ''
The port the DNSChain resolver will bind to.
'';
};
api.hostname = mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
The hostname (or IP address) the DNSChain API server will bind to.
'';
};
api.port = mkOption {
type = types.int;
default = 8080;
description = ''
The port the DNSChain API server (HTTP) will bind to.
'';
};
services.dnsmasq = {
resolveDnschainQueries = mkOption {
type = types.bool;
default = false;
api.tlsPort = mkOption {
type = types.int;
default = 4433;
description = ''
Resolve <literal>.bit</literal> top-level domains
with dnschain and namecoind.
The port the DNSChain API server (HTTPS) will bind to.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
[log]
level = debug
'';
description = ''
Additional options that will be appended to the configuration file.
'';
};
};
services.dnsmasq.resolveDNSChainQueries = mkOption {
type = types.bool;
default = false;
description = ''
Resolve <literal>.bit</literal> top-level domains using DNSChain and namecoin.
'';
};
services.pdns-recursor.resolveDNSChainQueries = mkOption {
type = types.bool;
default = false;
description = ''
Resolve <literal>.bit</literal> top-level domains using DNSChain and namecoin.
'';
};
};
@ -61,48 +119,47 @@ in
###### implementation
config = mkIf cfg.dnschain.enable {
services.namecoind.enable = true;
config = mkIf cfg.enable {
services.dnsmasq.servers = optionals cfg.dnsmasq.resolveDnschainQueries [ "/.bit/127.0.0.1#5333" ];
services.dnsmasq.servers = optionals cfgs.dnsmasq.resolveDNSChainQueries
[ "/.bit/127.0.0.1#${toString cfg.dns.port}"
"/.dns/127.0.0.1#${toString cfg.dns.port}"
];
users.extraUsers = singleton
{ name = "dnschain";
uid = config.ids.uids.dnschain;
extraGroups = [ "namecoin" ];
description = "Dnschain daemon user";
home = "/var/lib/dnschain";
createHome = true;
services.pdns-recursor.forwardZones = mkIf cfgs.pdns-recursor.resolveDNSChainQueries
{ bit = "127.0.0.1:${toString cfg.dns.port}";
dns = "127.0.0.1:${toString cfg.dns.port}";
};
users.extraUsers = singleton {
name = username;
description = "DNSChain daemon user";
home = dataDir;
createHome = true;
uid = config.ids.uids.dnschain;
extraGroups = optional cfgs.namecoind.enable "namecoin";
};
systemd.services.dnschain = {
description = "Dnschain Daemon";
after = [ "namecoind.target" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.openssl ];
preStart = ''
# Link configuration file into dnschain HOME directory
if [ "$(${pkgs.coreutils}/bin/realpath /var/lib/dnschain/.dnschain.conf)" != "${dnschainConf}" ]; then
rm -rf /var/lib/dnschain/.dnschain.conf
ln -s ${dnschainConf} /var/lib/dnschain/.dnschain.conf
fi
# Create empty namecoin.conf so that dnschain is not
# searching for /etc/namecoin/namecoin.conf
if [ ! -e /var/lib/dnschain/.namecoin/namecoin.conf ]; then
mkdir -p /var/lib/dnschain/.namecoin
touch /var/lib/dnschain/.namecoin/namecoin.conf
fi
'';
serviceConfig = {
Type = "simple";
User = "dnschain";
EnvironmentFile = config.services.namecoind.userFile;
ExecStart = "${pkgs.dnschain}/bin/dnschain --rpcuser=\${USER} --rpcpassword=\${PASSWORD} --rpcport=8336";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
ExecStop = "${pkgs.coreutils}/bin/kill -KILL $MAINPID";
};
description = "DNSChain daemon";
after = optional cfgs.namecoind.enable "namecoind.target";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "dnschain";
Restart = "on-failure";
ExecStart = "${pkgs.dnschain}/bin/dnschain";
};
preStart = ''
# Link configuration file into dnschain home directory
configPath=${dataDir}/.dnschain/dnschain.conf
mkdir -p ${dataDir}/.dnschain
if [ "$(realpath $configPath)" != "${configFile}" ]; then
rm -f $configPath
ln -s ${configFile} $configPath
fi
'';
};
};

4
nixos/modules/services/networking/firewall.nix

@ -38,9 +38,9 @@ let
cfg = config.networking.firewall;
kernelPackages = config.boot.kernelPackages;
inherit (config.boot.kernelPackages) kernel;
kernelHasRPFilter = kernelPackages.kernel.features.netfilterRPFilter or false;
kernelHasRPFilter = ((kernel.config.isEnabled or (x: false)) "IP_NF_MATCH_RPFILTER") || (kernel.features.netfilterRPFilter or false);