aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-01-10 20:09:37 +0000
committerKatharina Fey <kookie@spacekookie.de>2020-01-10 20:09:37 +0000
commit45431c078bf8f54aef7c9fae2e5913395ec82c31 (patch)
treefd8ff1346a963ddd72e782421f05b623f9759e2a /nixpkgs/nixos/modules
parentc86fea6086c212ea489cfb023a5f5c9c8f188810 (diff)
parent3ccbc8d89153ecf13f3eae7d9c106d91cd4ab9e5 (diff)
Merge commit '3ccbc8d89153ecf13f3eae7d9c106d91cd4ab9e5' into fuckthisshit
Diffstat (limited to 'nixpkgs/nixos/modules')
-rw-r--r--nixpkgs/nixos/modules/config/fonts/corefonts.nix36
-rw-r--r--nixpkgs/nixos/modules/config/fonts/fontconfig-ultimate.nix86
-rw-r--r--nixpkgs/nixos/modules/config/i18n.nix6
-rw-r--r--nixpkgs/nixos/modules/config/no-x-libs.nix1
-rw-r--r--nixpkgs/nixos/modules/config/pulseaudio.nix5
-rw-r--r--nixpkgs/nixos/modules/config/qt5.nix2
-rw-r--r--nixpkgs/nixos/modules/config/shells-environment.nix14
-rw-r--r--nixpkgs/nixos/modules/config/update-users-groups.pl4
-rw-r--r--nixpkgs/nixos/modules/config/users-groups.nix2
-rw-r--r--nixpkgs/nixos/modules/config/vpnc.nix41
-rw-r--r--nixpkgs/nixos/modules/config/xdg/sounds.nix6
-rw-r--r--nixpkgs/nixos/modules/hardware/brillo.nix22
-rw-r--r--nixpkgs/nixos/modules/hardware/video/displaylink.nix22
-rw-r--r--nixpkgs/nixos/modules/hardware/video/nvidia.nix7
-rw-r--r--nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix12
-rw-r--r--nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix2
-rw-r--r--nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix10
-rw-r--r--nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix6
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option.sh327
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option/CMakeLists.txt8
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option/default.nix11
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.cc83
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.hh9
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-option/nixos-option.cc618
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh13
-rw-r--r--nixpkgs/nixos/modules/installer/tools/tools.nix11
-rw-r--r--nixpkgs/nixos/modules/misc/ids.nix9
-rw-r--r--nixpkgs/nixos/modules/module-list.nix21
-rw-r--r--nixpkgs/nixos/modules/profiles/graphical.nix2
-rw-r--r--nixpkgs/nixos/modules/profiles/installation-device.nix3
-rw-r--r--nixpkgs/nixos/modules/programs/adb.nix3
-rw-r--r--nixpkgs/nixos/modules/programs/gnupg.nix41
-rw-r--r--nixpkgs/nixos/modules/programs/seahorse.nix2
-rw-r--r--nixpkgs/nixos/modules/programs/shadow.nix14
-rw-r--r--nixpkgs/nixos/modules/programs/ssh.nix11
-rw-r--r--nixpkgs/nixos/modules/programs/ssmtp.nix14
-rw-r--r--nixpkgs/nixos/modules/programs/x2goserver.nix1
-rw-r--r--nixpkgs/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix4
-rw-r--r--nixpkgs/nixos/modules/rename.nix24
-rw-r--r--nixpkgs/nixos/modules/security/acme.nix61
-rw-r--r--nixpkgs/nixos/modules/security/pam_mount.nix6
-rw-r--r--nixpkgs/nixos/modules/services/admin/oxidized.nix1
-rw-r--r--nixpkgs/nixos/modules/services/audio/jack.nix1
-rw-r--r--nixpkgs/nixos/modules/services/audio/mpd.nix2
-rw-r--r--nixpkgs/nixos/modules/services/audio/roon-server.nix3
-rw-r--r--nixpkgs/nixos/modules/services/backup/automysqlbackup.nix5
-rw-r--r--nixpkgs/nixos/modules/services/backup/znapzend.nix28
-rw-r--r--nixpkgs/nixos/modules/services/cluster/kubernetes/addons/dns.nix12
-rw-r--r--nixpkgs/nixos/modules/services/cluster/kubernetes/flannel.nix1
-rw-r--r--nixpkgs/nixos/modules/services/cluster/kubernetes/kubelet.nix4
-rw-r--r--nixpkgs/nixos/modules/services/cluster/kubernetes/proxy.nix9
-rw-r--r--nixpkgs/nixos/modules/services/computing/slurm/slurm.nix51
-rw-r--r--nixpkgs/nixos/modules/services/continuous-integration/buildkite-agent.nix1
-rw-r--r--nixpkgs/nixos/modules/services/continuous-integration/hydra/default.nix4
-rw-r--r--nixpkgs/nixos/modules/services/databases/mysql.nix12
-rw-r--r--nixpkgs/nixos/modules/services/databases/redis.nix21
-rw-r--r--nixpkgs/nixos/modules/services/databases/rethinkdb.nix1
-rw-r--r--nixpkgs/nixos/modules/services/desktops/geoclue2.nix41
-rw-r--r--nixpkgs/nixos/modules/services/desktops/neard.nix23
-rw-r--r--nixpkgs/nixos/modules/services/desktops/system-config-printer.nix3
-rw-r--r--nixpkgs/nixos/modules/services/desktops/tumbler.nix18
-rw-r--r--nixpkgs/nixos/modules/services/development/lorri.nix47
-rw-r--r--nixpkgs/nixos/modules/services/editors/infinoted.nix1
-rw-r--r--nixpkgs/nixos/modules/services/games/openarena.nix56
-rw-r--r--nixpkgs/nixos/modules/services/hardware/bluetooth.nix30
-rw-r--r--nixpkgs/nixos/modules/services/hardware/fancontrol.nix39
-rw-r--r--nixpkgs/nixos/modules/services/hardware/fwupd.nix6
-rw-r--r--nixpkgs/nixos/modules/services/hardware/tlp.nix2
-rw-r--r--nixpkgs/nixos/modules/services/hardware/trezord.nix16
-rw-r--r--nixpkgs/nixos/modules/services/hardware/udisks2.nix5
-rw-r--r--nixpkgs/nixos/modules/services/hardware/usbmuxd.nix1
-rw-r--r--nixpkgs/nixos/modules/services/hardware/vdr.nix1
-rw-r--r--nixpkgs/nixos/modules/services/mail/mailcatcher.nix9
-rw-r--r--nixpkgs/nixos/modules/services/mail/mailhog.nix1
-rw-r--r--nixpkgs/nixos/modules/services/mail/opensmtpd.nix18
-rw-r--r--nixpkgs/nixos/modules/services/mail/postfix.nix8
-rw-r--r--nixpkgs/nixos/modules/services/mail/roundcube.nix2
-rw-r--r--nixpkgs/nixos/modules/services/mail/rspamd.nix2
-rw-r--r--nixpkgs/nixos/modules/services/misc/airsonic.nix1
-rw-r--r--nixpkgs/nixos/modules/services/misc/beanstalkd.nix3
-rw-r--r--nixpkgs/nixos/modules/services/misc/docker-registry.nix6
-rw-r--r--nixpkgs/nixos/modules/services/misc/errbot.nix5
-rw-r--r--nixpkgs/nixos/modules/services/misc/gitea.nix1
-rw-r--r--nixpkgs/nixos/modules/services/misc/gitlab.nix9
-rw-r--r--nixpkgs/nixos/modules/services/misc/gollum.nix1
-rw-r--r--nixpkgs/nixos/modules/services/misc/jellyfin.nix5
-rw-r--r--nixpkgs/nixos/modules/services/misc/lidarr.nix15
-rw-r--r--nixpkgs/nixos/modules/services/misc/matrix-synapse.nix3
-rw-r--r--nixpkgs/nixos/modules/services/misc/nix-daemon.nix6
-rw-r--r--nixpkgs/nixos/modules/services/misc/osrm.nix1
-rw-r--r--nixpkgs/nixos/modules/services/misc/redmine.nix15
-rw-r--r--nixpkgs/nixos/modules/services/misc/zoneminder.nix2
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/collectd.nix40
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/fusion-inventory.nix1
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/grafana.nix2
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/netdata.nix3
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/osquery.nix91
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix3
-rw-r--r--nixpkgs/nixos/modules/services/monitoring/zabbix-agent.nix1
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/beegfs.nix357
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/ceph.nix72
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/orangefs/client.nix97
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/orangefs/server.nix225
-rw-r--r--nixpkgs/nixos/modules/services/network-filesystems/samba.nix24
-rw-r--r--nixpkgs/nixos/modules/services/networking/bind.nix6
-rw-r--r--nixpkgs/nixos/modules/services/networking/bitcoind.nix4
-rw-r--r--nixpkgs/nixos/modules/services/networking/connman.nix10
-rw-r--r--nixpkgs/nixos/modules/services/networking/dnscache.nix2
-rw-r--r--nixpkgs/nixos/modules/services/networking/dnschain.nix2
-rw-r--r--nixpkgs/nixos/modules/services/networking/dnscrypt-wrapper.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/dnsdist.nix5
-rw-r--r--nixpkgs/nixos/modules/services/networking/eternal-terminal.nix6
-rw-r--r--nixpkgs/nixos/modules/services/networking/go-shadowsocks2.nix30
-rw-r--r--nixpkgs/nixos/modules/services/networking/hans.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/haproxy.nix36
-rw-r--r--nixpkgs/nixos/modules/services/networking/jormungandr.nix102
-rw-r--r--nixpkgs/nixos/modules/services/networking/matterbridge.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/morty.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/nat.nix2
-rw-r--r--nixpkgs/nixos/modules/services/networking/networkmanager.nix109
-rw-r--r--nixpkgs/nixos/modules/services/networking/nghttpx/default.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/owamp.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/pdns-recursor.nix13
-rw-r--r--nixpkgs/nixos/modules/services/networking/smokeping.nix5
-rw-r--r--nixpkgs/nixos/modules/services/networking/stunnel.nix15
-rw-r--r--nixpkgs/nixos/modules/services/networking/syncthing.nix64
-rw-r--r--nixpkgs/nixos/modules/services/networking/thelounge.nix1
-rw-r--r--nixpkgs/nixos/modules/services/networking/tinydns.nix3
-rw-r--r--nixpkgs/nixos/modules/services/networking/trickster.nix112
-rw-r--r--nixpkgs/nixos/modules/services/networking/vsftpd.nix129
-rw-r--r--nixpkgs/nixos/modules/services/networking/wireguard.nix66
-rw-r--r--nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix9
-rw-r--r--nixpkgs/nixos/modules/services/networking/yggdrasil.nix187
-rw-r--r--nixpkgs/nixos/modules/services/networking/znc/default.nix2
-rw-r--r--nixpkgs/nixos/modules/services/printing/cupsd.nix2
-rw-r--r--nixpkgs/nixos/modules/services/scheduling/marathon.nix2
-rw-r--r--nixpkgs/nixos/modules/services/security/bitwarden_rs/default.nix5
-rw-r--r--nixpkgs/nixos/modules/services/security/oauth2_proxy.nix1
-rw-r--r--nixpkgs/nixos/modules/services/security/vault.nix5
-rw-r--r--nixpkgs/nixos/modules/services/torrent/magnetico.nix8
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/codimd.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/frab.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/gotify-server.nix49
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/limesurvey.nix5
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/matomo-doc.xml8
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/matomo.nix56
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/mediawiki.nix5
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/moinmoin.nix303
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/moodle.nix6
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/nextcloud.nix5
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/nexus.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/trac.nix79
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/virtlyst.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-apps/wordpress.nix5
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix255
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix6
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/hitch/default.nix5
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/nginx/location-options.nix3
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/nginx/vhost-options.nix2
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/phpfpm/default.nix6
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/traefik.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/ttyd.nix196
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/unit/default.nix1
-rw-r--r--nixpkgs/nixos/modules/services/web-servers/varnish/default.nix6
-rw-r--r--nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix2
-rw-r--r--nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix35
-rw-r--r--nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix16
-rw-r--r--nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix111
-rw-r--r--nixpkgs/nixos/modules/services/x11/desktop-managers/xfce4-14.nix152
-rw-r--r--nixpkgs/nixos/modules/services/x11/display-managers/default.nix12
-rw-r--r--nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix65
-rw-r--r--nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix2
-rwxr-xr-xnixpkgs/nixos/modules/services/x11/display-managers/set-session.py86
-rw-r--r--nixpkgs/nixos/modules/services/x11/display-managers/slim.nix160
-rw-r--r--nixpkgs/nixos/modules/services/x11/hardware/digimend.nix43
-rw-r--r--nixpkgs/nixos/modules/services/x11/hardware/libinput.nix8
-rw-r--r--nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix2
-rw-r--r--nixpkgs/nixos/modules/services/x11/xserver.nix1
-rw-r--r--nixpkgs/nixos/modules/system/activation/switch-to-configuration.pl12
-rw-r--r--nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix4
-rw-r--r--nixpkgs/nixos/modules/system/boot/networkd.nix8
-rw-r--r--nixpkgs/nixos/modules/system/boot/plymouth.nix10
-rw-r--r--nixpkgs/nixos/modules/system/boot/resolved.nix2
-rw-r--r--nixpkgs/nixos/modules/system/boot/systemd-unit-options.nix2
-rw-r--r--nixpkgs/nixos/modules/system/boot/systemd.nix2
-rw-r--r--nixpkgs/nixos/modules/system/boot/timesyncd.nix18
-rw-r--r--nixpkgs/nixos/modules/tasks/network-interfaces-systemd.nix11
-rw-r--r--nixpkgs/nixos/modules/testing/test-instrumentation.nix2
-rw-r--r--nixpkgs/nixos/modules/virtualisation/amazon-image.nix3
-rw-r--r--nixpkgs/nixos/modules/virtualisation/containers.nix2
-rw-r--r--nixpkgs/nixos/modules/virtualisation/digital-ocean-config.nix197
-rw-r--r--nixpkgs/nixos/modules/virtualisation/digital-ocean-image.nix69
-rw-r--r--nixpkgs/nixos/modules/virtualisation/digital-ocean-init.nix95
-rw-r--r--nixpkgs/nixos/modules/virtualisation/ec2-amis.nix18
-rw-r--r--nixpkgs/nixos/modules/virtualisation/libvirtd.nix3
-rw-r--r--nixpkgs/nixos/modules/virtualisation/openvswitch.nix13
-rw-r--r--nixpkgs/nixos/modules/virtualisation/qemu-vm.nix137
-rw-r--r--nixpkgs/nixos/modules/virtualisation/virtualbox-host.nix9
198 files changed, 4153 insertions, 2168 deletions
diff --git a/nixpkgs/nixos/modules/config/fonts/corefonts.nix b/nixpkgs/nixos/modules/config/fonts/corefonts.nix
deleted file mode 100644
index b9f69879a10..00000000000
--- a/nixpkgs/nixos/modules/config/fonts/corefonts.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-# This module is deprecated, since you can just say ‘fonts.fonts = [
-# pkgs.corefonts ];’ instead.
-
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-{
-
- options = {
-
- fonts = {
-
- enableCoreFonts = mkOption {
- visible = false;
- default = false;
- description = ''
- Whether to include Microsoft's proprietary Core Fonts. These fonts
- are redistributable, but only verbatim, among other restrictions.
- See <link xlink:href="http://corefonts.sourceforge.net/eula.htm"/>
- for details.
- '';
- };
-
- };
-
- };
-
-
- config = mkIf config.fonts.enableCoreFonts {
-
- fonts.fonts = [ pkgs.corefonts ];
-
- };
-
-}
diff --git a/nixpkgs/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixpkgs/nixos/modules/config/fonts/fontconfig-ultimate.nix
deleted file mode 100644
index 84d90899dff..00000000000
--- a/nixpkgs/nixos/modules/config/fonts/fontconfig-ultimate.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{ config, pkgs, lib, ... }:
-
-with lib;
-
-let cfg = config.fonts.fontconfig.ultimate;
-
- latestVersion = pkgs.fontconfig.configVersion;
-
- # The configuration to be included in /etc/font/
- confPkg = pkgs.runCommand "font-ultimate-conf" { preferLocalBuild = true; } ''
- support_folder=$out/etc/fonts/conf.d
- latest_folder=$out/etc/fonts/${latestVersion}/conf.d
-
- mkdir -p $support_folder
- mkdir -p $latest_folder
-
- # fontconfig ultimate substitutions
- ${optionalString (cfg.substitutions != "none") ''
- ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \
- $support_folder
- ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/presets/${cfg.substitutions}/*.conf \
- $latest_folder
- ''}
-
- # fontconfig ultimate various configuration files
- ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \
- $support_folder
- ln -s ${pkgs.fontconfig-ultimate}/etc/fonts/conf.d/*.conf \
- $latest_folder
- '';
-
-in
-{
-
- options = {
-
- fonts = {
-
- fontconfig = {
-
- ultimate = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Enable fontconfig-ultimate settings (formerly known as
- Infinality). Besides the customizable settings in this NixOS
- module, fontconfig-ultimate also provides many font-specific
- rendering tweaks.
- '';
- };
-
- substitutions = mkOption {
- type = types.enum ["free" "combi" "ms" "none"];
- default = "free";
- description = ''
- Font substitutions to replace common Type 1 fonts with nicer
- TrueType fonts. <literal>free</literal> uses free fonts,
- <literal>ms</literal> uses Microsoft fonts,
- <literal>combi</literal> uses a combination, and
- <literal>none</literal> disables the substitutions.
- '';
- };
-
- preset = mkOption {
- type = types.enum ["ultimate1" "ultimate2" "ultimate3" "ultimate4" "ultimate5" "osx" "windowsxp"];
- default = "ultimate3";
- description = ''
- FreeType rendering settings preset. Any of the presets may be
- customized by setting environment variables.
- '';
- };
- };
- };
- };
-
- };
-
- config = mkIf (config.fonts.fontconfig.enable && cfg.enable) {
-
- fonts.fontconfig.confPackages = [ confPkg ];
- environment.variables.INFINALITY_FT = cfg.preset;
-
- };
-
-}
diff --git a/nixpkgs/nixos/modules/config/i18n.nix b/nixpkgs/nixos/modules/config/i18n.nix
index dc7305b1ba2..d0db8fedecd 100644
--- a/nixpkgs/nixos/modules/config/i18n.nix
+++ b/nixpkgs/nixos/modules/config/i18n.nix
@@ -89,11 +89,7 @@ with lib;
};
consoleKeyMap = mkOption {
- type = mkOptionType {
- name = "string or path";
- check = t: (isString t || types.path.check t);
- };
-
+ type = with types; either str path;
default = "us";
example = "fr";
description = ''
diff --git a/nixpkgs/nixos/modules/config/no-x-libs.nix b/nixpkgs/nixos/modules/config/no-x-libs.nix
index 74cf74d7418..873b8073fed 100644
--- a/nixpkgs/nixos/modules/config/no-x-libs.nix
+++ b/nixpkgs/nixos/modules/config/no-x-libs.nix
@@ -34,7 +34,6 @@ with lib;
networkmanager-openvpn = super.networkmanager-openvpn.override { withGnome = false; };
networkmanager-vpnc = super.networkmanager-vpnc.override { withGnome = false; };
networkmanager-iodine = super.networkmanager-iodine.override { withGnome = false; };
- pinentry = super.pinentry.override { gtk2 = null; gcr = null; qt4 = null; qt5 = null; };
gobject-introspection = super.gobject-introspection.override { x11Support = false; };
}));
};
diff --git a/nixpkgs/nixos/modules/config/pulseaudio.nix b/nixpkgs/nixos/modules/config/pulseaudio.nix
index b3bc4a451aa..9baad9b5854 100644
--- a/nixpkgs/nixos/modules/config/pulseaudio.nix
+++ b/nixpkgs/nixos/modules/config/pulseaudio.nix
@@ -98,11 +98,12 @@ in {
description = ''
If false, a PulseAudio server is launched automatically for
each user that tries to use the sound system. The server runs
- with user privileges. This is the recommended and most secure
- way to use PulseAudio. If true, one system-wide PulseAudio
+ with user privileges. If true, one system-wide PulseAudio
server is launched on boot, running as the user "pulse", and
only users in the "audio" group will have access to the server.
Please read the PulseAudio documentation for more details.
+
+ Don't enable this option unless you know what you are doing.
'';
};
diff --git a/nixpkgs/nixos/modules/config/qt5.nix b/nixpkgs/nixos/modules/config/qt5.nix
index 7de1c0f5d55..d9dec74f155 100644
--- a/nixpkgs/nixos/modules/config/qt5.nix
+++ b/nixpkgs/nixos/modules/config/qt5.nix
@@ -10,7 +10,7 @@ let
isQtStyle = cfg.platformTheme == "gtk2" && cfg.style != "adwaita";
packages = if isQGnome then [ pkgs.qgnomeplatform pkgs.adwaita-qt ]
- else if isQtStyle then [ pkgs.qtstyleplugins ]
+ else if isQtStyle then [ pkgs.libsForQt5.qtstyleplugins ]
else throw "`qt5.platformTheme` ${cfg.platformTheme} and `qt5.style` ${cfg.style} are not compatible.";
in
diff --git a/nixpkgs/nixos/modules/config/shells-environment.nix b/nixpkgs/nixos/modules/config/shells-environment.nix
index d939cbb393e..a0a20228a74 100644
--- a/nixpkgs/nixos/modules/config/shells-environment.nix
+++ b/nixpkgs/nixos/modules/config/shells-environment.nix
@@ -118,6 +118,14 @@ in
type = with types; attrsOf (nullOr (either str path));
};
+ environment.homeBinInPath = mkOption {
+ description = ''
+ Include ~/bin/ in $PATH.
+ '';
+ default = false;
+ type = types.bool;
+ };
+
environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh";
defaultText = "\${config.system.build.binsh}/bin/sh";
@@ -186,8 +194,10 @@ in
${cfg.extraInit}
- # ~/bin if it exists overrides other bin directories.
- export PATH="$HOME/bin:$PATH"
+ ${optionalString cfg.homeBinInPath ''
+ # ~/bin if it exists overrides other bin directories.
+ export PATH="$HOME/bin:$PATH"
+ ''}
'';
system.activationScripts.binsh = stringAfter [ "stdio" ]
diff --git a/nixpkgs/nixos/modules/config/update-users-groups.pl b/nixpkgs/nixos/modules/config/update-users-groups.pl
index 59cea51c611..15e448b787a 100644
--- a/nixpkgs/nixos/modules/config/update-users-groups.pl
+++ b/nixpkgs/nixos/modules/config/update-users-groups.pl
@@ -56,12 +56,12 @@ sub allocGid {
$gidsUsed{$prevGid} = 1;
return $prevGid;
}
- return allocId(\%gidsUsed, \%gidsPrevUsed, 400, 499, 0, sub { my ($gid) = @_; getgrgid($gid) });
+ return allocId(\%gidsUsed, \%gidsPrevUsed, 400, 999, 0, sub { my ($gid) = @_; getgrgid($gid) });
}
sub allocUid {
my ($name, $isSystemUser) = @_;
- my ($min, $max, $up) = $isSystemUser ? (400, 499, 0) : (1000, 29999, 1);
+ my ($min, $max, $up) = $isSystemUser ? (400, 999, 0) : (1000, 29999, 1);
my $prevUid = $uidMap->{$name};
if (defined $prevUid && $prevUid >= $min && $prevUid <= $max && !defined $uidsUsed{$prevUid}) {
print STDERR "reviving user '$name' with UID $prevUid\n";
diff --git a/nixpkgs/nixos/modules/config/users-groups.nix b/nixpkgs/nixos/modules/config/users-groups.nix
index ba79bd3d6ec..ae3bdeb00e6 100644
--- a/nixpkgs/nixos/modules/config/users-groups.nix
+++ b/nixpkgs/nixos/modules/config/users-groups.nix
@@ -251,7 +251,7 @@ let
default = [];
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
description = ''
- The set of packages that should be made availabe to the user.
+ The set of packages that should be made available to the user.
This is in contrast to <option>environment.systemPackages</option>,
which adds packages to all users.
'';
diff --git a/nixpkgs/nixos/modules/config/vpnc.nix b/nixpkgs/nixos/modules/config/vpnc.nix
deleted file mode 100644
index 356e007c0a3..00000000000
--- a/nixpkgs/nixos/modules/config/vpnc.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ config, lib, ... }:
-
-with lib;
-
-let
- cfg = config.networking.vpnc;
- mkServiceDef = name: value:
- {
- name = "vpnc/${name}.conf";
- value = { text = value; };
- };
-
-in
-{
- options = {
- networking.vpnc = {
- services = mkOption {
- type = types.attrsOf types.str;
- default = {};
- example = literalExample ''
- { test = '''
- IPSec gateway 192.168.1.1
- IPSec ID someID
- IPSec secret secretKey
- Xauth username name
- Xauth password pass
- ''';
- }
- '';
- description =
- ''
- The names of cisco VPNs and their associated definitions
- '';
- };
- };
- };
-
- config.environment.etc = mapAttrs' mkServiceDef cfg.services;
-}
-
-
diff --git a/nixpkgs/nixos/modules/config/xdg/sounds.nix b/nixpkgs/nixos/modules/config/xdg/sounds.nix
index 148240d631c..14d6340fc33 100644
--- a/nixpkgs/nixos/modules/config/xdg/sounds.nix
+++ b/nixpkgs/nixos/modules/config/xdg/sounds.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
with lib;
{
@@ -14,6 +14,10 @@ with lib;
};
config = mkIf config.xdg.sounds.enable {
+ environment.systemPackages = [
+ pkgs.sound-theme-freedesktop
+ ];
+
environment.pathsToLink = [
"/share/sounds"
];
diff --git a/nixpkgs/nixos/modules/hardware/brillo.nix b/nixpkgs/nixos/modules/hardware/brillo.nix
new file mode 100644
index 00000000000..e970c948099
--- /dev/null
+++ b/nixpkgs/nixos/modules/hardware/brillo.nix
@@ -0,0 +1,22 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.hardware.brillo;
+in
+{
+ options = {
+ hardware.brillo = {
+ enable = mkEnableOption ''
+ Enable brillo in userspace.
+ This will allow brightness control from users in the video group.
+ '';
+ };
+ };
+
+
+ config = mkIf cfg.enable {
+ services.udev.packages = [ pkgs.brillo ];
+ environment.systemPackages = [ pkgs.brillo ];
+ };
+}
diff --git a/nixpkgs/nixos/modules/hardware/video/displaylink.nix b/nixpkgs/nixos/modules/hardware/video/displaylink.nix
index 669ac849cba..912f53da836 100644
--- a/nixpkgs/nixos/modules/hardware/video/displaylink.nix
+++ b/nixpkgs/nixos/modules/hardware/video/displaylink.nix
@@ -19,6 +19,21 @@ in
config = mkIf enabled {
boot.extraModulePackages = [ evdi ];
+ boot.kernelModules = [ "evdi" ];
+
+ environment.etc."X11/xorg.conf.d/40-displaylink.conf".text = ''
+ Section "OutputClass"
+ Identifier "DisplayLink"
+ MatchDriver "evdi"
+ Driver "modesetting"
+ Option "AccelMethod" "none"
+ EndSection
+ '';
+
+ # make the device available
+ services.xserver.displayManager.sessionCommands = ''
+ ${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 1 0
+ '';
# Those are taken from displaylink-installer.sh and from Arch Linux AUR package.
@@ -47,18 +62,13 @@ in
description = "DisplayLink Manager Service";
after = [ "display-manager.service" ];
conflicts = [ "getty@tty7.service" ];
- path = [ pkgs.kmod ];
serviceConfig = {
ExecStart = "${displaylink}/bin/DisplayLinkManager";
Restart = "always";
RestartSec = 5;
+ LogsDirectory = "displaylink";
};
-
- preStart = ''
- mkdir -p /var/log/displaylink
- modprobe evdi
- '';
};
};
diff --git a/nixpkgs/nixos/modules/hardware/video/nvidia.nix b/nixpkgs/nixos/modules/hardware/video/nvidia.nix
index 3ab2afc9740..fcb30187fa2 100644
--- a/nixpkgs/nixos/modules/hardware/video/nvidia.nix
+++ b/nixpkgs/nixos/modules/hardware/video/nvidia.nix
@@ -75,7 +75,7 @@ in
Note that this configuration will only be successful when a display manager
for which the <option>services.xserver.displayManager.setupCommands</option>
- option is supported is used; notably, SLiM is not supported.
+ option is supported is used.
'';
};
@@ -111,9 +111,10 @@ in
config = mkIf enabled {
assertions = [
{
- assertion = with config.services.xserver.displayManager; gdm.enable -> !gdm.wayland;
- message = "NVIDIA drivers don't support wayland, set services.xserver.displayManager.gdm.wayland=false";
+ assertion = with config.services.xserver.displayManager; gdm.nvidiaWayland -> cfg.modesetting.enable;
+ message = "You cannot use wayland with GDM without modesetting enabled for NVIDIA drivers, set `hardware.nvidia.modesetting.enable = true`";
}
+
{
assertion = !optimusCfg.enable ||
(optimusCfg.nvidiaBusId != "" && optimusCfg.intelBusId != "");
diff --git a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix
index 719ba5ffb12..e0b558dcb0d 100644
--- a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix
+++ b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix
@@ -22,17 +22,7 @@ with lib;
});
'';
- services.xserver = {
- enable = true;
-
- # Automatically login as nixos.
- displayManager.slim = {
- enable = true;
- defaultUser = "nixos";
- autoLogin = true;
- };
-
- };
+ services.xserver.enable = true;
# Provide networkmanager for easy wireless configuration.
networking.networkmanager.enable = true;
diff --git a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix
index 0b813bbf37b..23c3426bff0 100644
--- a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix
+++ b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix
@@ -10,8 +10,6 @@ with lib;
services.xserver.desktopManager.gnome3.enable = true;
- services.xserver.displayManager.slim.enable = mkForce false;
-
# Auto-login as root.
services.xserver.displayManager.gdm.autoLogin = {
enable = true;
diff --git a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
index 1dc7920ff64..e00d3f7535b 100644
--- a/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
+++ b/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
@@ -11,7 +11,15 @@ with lib;
services.xserver = {
desktopManager.plasma5 = {
enable = true;
- enableQt4Support = false;
+ };
+
+ # Automatically login as nixos.
+ displayManager.sddm = {
+ enable = true;
+ autoLogin = {
+ enable = true;
+ user = "nixos";
+ };
};
};
diff --git a/nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix b/nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix
index d510f3b2daf..7865b767f0b 100644
--- a/nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix
+++ b/nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix
@@ -140,7 +140,11 @@ in
export img=$out/sd-image/${config.sdImage.imageName}
echo "${pkgs.stdenv.buildPlatform.system}" > $out/nix-support/system
- echo "file sd-image $img" >> $out/nix-support/hydra-build-products
+ if test -n "$compressImage"; then
+ echo "file sd-image $img.bz2" >> $out/nix-support/hydra-build-products
+ else
+ echo "file sd-image $img" >> $out/nix-support/hydra-build-products
+ fi
# Gap in front of the first partition, in MiB
gap=8
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option.sh b/nixpkgs/nixos/modules/installer/tools/nixos-option.sh
deleted file mode 100644
index 4560e9c7403..00000000000
--- a/nixpkgs/nixos/modules/installer/tools/nixos-option.sh
+++ /dev/null
@@ -1,327 +0,0 @@
-#! @shell@ -e
-
-# FIXME: rewrite this in a more suitable language.
-
-usage () {
- exec man nixos-option
- exit 1
-}
-
-#####################
-# Process Arguments #
-#####################
-
-xml=false
-verbose=false
-nixPath=""
-
-option=""
-exit_code=0
-
-argfun=""
-for arg; do
- if test -z "$argfun"; then
- case $arg in
- -*)
- sarg="$arg"
- longarg=""
- while test "$sarg" != "-"; do
- case $sarg in
- --*) longarg=$arg; sarg="--";;
- -I) argfun="include_nixpath";;
- -*) usage;;
- esac
- # remove the first letter option
- sarg="-${sarg#??}"
- done
- ;;
- *) longarg=$arg;;
- esac
- for larg in $longarg; do
- case $larg in
- --xml) xml=true;;
- --verbose) verbose=true;;
- --help) usage;;
- -*) usage;;
- *) if test -z "$option"; then
- option="$larg"
- else
- usage
- fi;;
- esac
- done
- else
- case $argfun in
- set_*)
- var=$(echo $argfun | sed 's,^set_,,')
- eval $var=$arg
- ;;
- include_nixpath)
- nixPath="-I $arg $nixPath"
- ;;
- esac
- argfun=""
- fi
-done
-
-if $verbose; then
- set -x
-else
- set +x
-fi
-
-#############################
-# Process the configuration #
-#############################
-
-evalNix(){
- # disable `-e` flag, it's possible that the evaluation of `nix-instantiate` fails (e.g. due to broken pkgs)
- set +e
- result=$(nix-instantiate ${nixPath:+$nixPath} - --eval-only "$@" 2>&1)
- exit_code=$?
- set -e
-
- if test $exit_code -eq 0; then
- sed '/^warning: Nix search path/d' <<EOF
-$result
-EOF
- return 0;
- else
- sed -n '
- /^error/ { s/, at (string):[0-9]*:[0-9]*//; p; };
- /^warning: Nix search path/ { p; };
-' >&2 <<EOF
-$result
-EOF
- exit_code=1
- fi
-}
-
-header="let
- nixos = import <nixpkgs/nixos> {};
- nixpkgs = import <nixpkgs> {};
-in with nixpkgs.lib;
-"
-
-# This function is used for converting the option definition path given by
-# the user into accessors for reaching the definition and the declaration
-# corresponding to this option.
-generateAccessors(){
- if result=$(evalNix --strict --show-trace <<EOF
-$header
-
-let
- path = "${option:+$option}";
- pathList = splitString "." path;
-
- walkOptions = attrsNames: result:
- if attrsNames == [] then
- result
- else
- let name = head attrsNames; rest = tail attrsNames; in
- if isOption result.options then
- walkOptions rest {
- options = result.options.type.getSubOptions "";
- opt = ''(\${result.opt}.type.getSubOptions "")'';
- cfg = ''\${result.cfg}."\${name}"'';
- }
- else
- walkOptions rest {
- options = result.options.\${name};
- opt = ''\${result.opt}."\${name}"'';
- cfg = ''\${result.cfg}."\${name}"'';
- }
- ;
-
- walkResult = (if path == "" then x: x else walkOptions pathList) {
- options = nixos.options;
- opt = ''nixos.options'';
- cfg = ''nixos.config'';
- };
-
-in
- ''let option = \${walkResult.opt}; config = \${walkResult.cfg}; in''
-EOF
-)
- then
- echo $result
- else
- # In case of error we want to ignore the error message roduced by the
- # script above, as it is iterating over each attribute, which does not
- # produce a nice error message. The following code is a fallback
- # solution which is cause a nicer error message in the next
- # evaluation.
- echo "\"let option = nixos.options${option:+.$option}; config = nixos.config${option:+.$option}; in\""
- fi
-}
-
-header="$header
-$(eval echo $(generateAccessors))
-"
-
-evalAttr(){
- local prefix="$1"
- local strict="$2"
- local suffix="$3"
-
- # If strict is set, then set it to "true".
- test -n "$strict" && strict=true
-
- evalNix ${strict:+--strict} <<EOF
-$header
-
-let
- value = $prefix${suffix:+.$suffix};
- strict = ${strict:-false};
- cleanOutput = x: with nixpkgs.lib;
- if isDerivation x then x.outPath
- else if isFunction x then "<CODE>"
- else if strict then
- if isAttrs x then mapAttrs (n: cleanOutput) x
- else if isList x then map cleanOutput x
- else x
- else x;
-in
- cleanOutput value
-EOF
-}
-
-evalOpt(){
- evalAttr "option" "" "$@"
-}
-
-evalCfg(){
- local strict="$1"
- evalAttr "config" "$strict"
-}
-
-findSources(){
- local suffix=$1
- evalNix --strict <<EOF
-$header
-
-option.$suffix
-EOF
-}
-
-# Given a result from nix-instantiate, recover the list of attributes it
-# contains.
-attrNames() {
- local attributeset=$1
- # sed is used to replace un-printable subset by 0s, and to remove most of
- # the inner-attribute set, which reduce the likelyhood to encounter badly
- # pre-processed input.
- echo "builtins.attrNames $attributeset" | \
- sed 's,<[A-Z]*>,0,g; :inner; s/{[^\{\}]*};/0;/g; t inner;' | \
- evalNix --strict
-}
-
-# map a simple list which contains strings or paths.
-nixMap() {
- local fun="$1"
- local list="$2"
- local elem
- for elem in $list; do
- test $elem = '[' -o $elem = ']' && continue;
- $fun $elem
- done
-}
-
-# This duplicates the work made below, but it is useful for processing
-# the output of nixos-option with other tools such as nixos-gui.
-if $xml; then
- evalNix --xml --no-location <<EOF
-$header
-
-let
- sources = builtins.map (f: f.source);
- opt = option;
- cfg = config;
-in
-
-with nixpkgs.lib;
-
-let
- optStrict = v:
- let
- traverse = x :
- if isAttrs x then
- if x ? outPath then true
- else all id (mapAttrsFlatten (n: traverseNoAttrs) x)
- else traverseNoAttrs x;
- traverseNoAttrs = x:
- # do not continue in attribute sets
- if isAttrs x then true
- else if isList x then all id (map traverse x)
- else true;
- in assert traverse v; v;
-in
-
-if isOption opt then
- optStrict ({}
- // optionalAttrs (opt ? default) { inherit (opt) default; }
- // optionalAttrs (opt ? example) { inherit (opt) example; }
- // optionalAttrs (opt ? description) { inherit (opt) description; }
- // optionalAttrs (opt ? type) { typename = opt.type.description; }
- // optionalAttrs (opt ? options) { inherit (opt) options; }
- // {
- # to disambiguate the xml output.
- _isOption = true;
- declarations = sources opt.declarations;
- definitions = sources opt.definitions;
- value = cfg;
- })
-else
- opt
-EOF
- exit $?
-fi
-
-if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then
- echo "Value:"
- evalCfg 1
-
- echo
-
- echo "Default:"
- if default=$(evalOpt "default" - 2> /dev/null); then
- echo "$default"
- else
- echo "<None>"
- fi
- echo
- if example=$(evalOpt "example" - 2> /dev/null); then
- echo "Example:"
- echo "$example"
- echo
- fi
- echo "Description:"
- echo
- echo $(evalOpt "description")
-
- echo $desc;
-
- printPath () { echo " $1"; }
-
- echo "Declared by:"
- nixMap printPath "$(findSources "declarations")"
- echo
- echo "Defined by:"
- nixMap printPath "$(findSources "files")"
- echo
-
-else
- # echo 1>&2 "Warning: This value is not an option."
-
- result=$(evalCfg "")
- if [ ! -z "$result" ]; then
- names=$(attrNames "$result" 2> /dev/null)
- echo 1>&2 "This attribute set contains:"
- escapeQuotes () { eval echo "$1"; }
- nixMap escapeQuotes "$names"
- else
- echo 1>&2 "An error occurred while looking for attribute names. Are you sure that '$option' exists?"
- fi
-fi
-
-exit $exit_code
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option/CMakeLists.txt b/nixpkgs/nixos/modules/installer/tools/nixos-option/CMakeLists.txt
new file mode 100644
index 00000000000..e5834598c4f
--- /dev/null
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-option/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required (VERSION 2.6)
+project (nixos-option)
+
+add_executable(nixos-option nixos-option.cc libnix-copy-paste.cc)
+target_link_libraries(nixos-option PRIVATE -lnixmain -lnixexpr -lnixstore -lnixutil)
+target_compile_features(nixos-option PRIVATE cxx_std_17)
+
+install (TARGETS nixos-option DESTINATION bin)
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option/default.nix b/nixpkgs/nixos/modules/installer/tools/nixos-option/default.nix
new file mode 100644
index 00000000000..753fd92c7bb
--- /dev/null
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-option/default.nix
@@ -0,0 +1,11 @@
+{lib, stdenv, boost, cmake, pkgconfig, nix, ... }:
+stdenv.mkDerivation rec {
+ name = "nixos-option";
+ src = ./.;
+ nativeBuildInputs = [ cmake pkgconfig ];
+ buildInputs = [ boost nix ];
+ meta = {
+ license = stdenv.lib.licenses.lgpl2Plus;
+ maintainers = with lib.maintainers; [ chkno ];
+ };
+}
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.cc b/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.cc
new file mode 100644
index 00000000000..875c07da639
--- /dev/null
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.cc
@@ -0,0 +1,83 @@
+// These are useful methods inside the nix library that ought to be exported.
+// Since they are not, copy/paste them here.
+// TODO: Delete these and use the ones in the library as they become available.
+
+#include <nix/config.h> // for nix/globals.hh's reference to SYSTEM
+
+#include "libnix-copy-paste.hh"
+#include <boost/format/alt_sstream.hpp> // for basic_altstringbuf...
+#include <boost/format/alt_sstream_impl.hpp> // for basic_altstringbuf...
+#include <boost/format/format_class.hpp> // for basic_format
+#include <boost/format/format_fwd.hpp> // for format
+#include <boost/format/format_implementation.hpp> // for basic_format::basi...
+#include <boost/optional/optional.hpp> // for get_pointer
+#include <iostream> // for operator<<, basic_...
+#include <nix/types.hh> // for Strings, Error
+#include <string> // for string, basic_string
+
+using boost::format;
+using nix::Error;
+using nix::Strings;
+using std::string;
+
+// From nix/src/libexpr/attr-path.cc
+Strings parseAttrPath(const string & s)
+{
+ Strings res;
+ string cur;
+ string::const_iterator i = s.begin();
+ while (i != s.end()) {
+ if (*i == '.') {
+ res.push_back(cur);
+ cur.clear();
+ } else if (*i == '"') {
+ ++i;
+ while (1) {
+ if (i == s.end())
+ throw Error(format("missing closing quote in selection path '%1%'") % s);
+ if (*i == '"')
+ break;
+ cur.push_back(*i++);
+ }
+ } else
+ cur.push_back(*i);
+ ++i;
+ }
+ if (!cur.empty())
+ res.push_back(cur);
+ return res;
+}
+
+// From nix/src/nix/repl.cc
+bool isVarName(const string & s)
+{
+ if (s.size() == 0)
+ return false;
+ char c = s[0];
+ if ((c >= '0' && c <= '9') || c == '-' || c == '\'')
+ return false;
+ for (auto & i : s)
+ if (!((i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z') || (i >= '0' && i <= '9') || i == '_' || i == '-' ||
+ i == '\''))
+ return false;
+ return true;
+}
+
+// From nix/src/nix/repl.cc
+std::ostream & printStringValue(std::ostream & str, const char * string)
+{
+ str << "\"";
+ for (const char * i = string; *i; i++)
+ if (*i == '\"' || *i == '\\')
+ str << "\\" << *i;
+ else if (*i == '\n')
+ str << "\\n";
+ else if (*i == '\r')
+ str << "\\r";
+ else if (*i == '\t')
+ str << "\\t";
+ else
+ str << *i;
+ str << "\"";
+ return str;
+}
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.hh b/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.hh
new file mode 100644
index 00000000000..2274e9a0f85
--- /dev/null
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-option/libnix-copy-paste.hh
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <iostream>
+#include <nix/types.hh>
+#include <string>
+
+nix::Strings parseAttrPath(const std::string & s);
+bool isVarName(const std::string & s);
+std::ostream & printStringValue(std::ostream & str, const char * string);
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-option/nixos-option.cc b/nixpkgs/nixos/modules/installer/tools/nixos-option/nixos-option.cc
new file mode 100644
index 00000000000..9b92dc829cd
--- /dev/null
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-option/nixos-option.cc
@@ -0,0 +1,618 @@
+#include <nix/config.h> // for nix/globals.hh's reference to SYSTEM
+
+#include <exception> // for exception_ptr, current_exception
+#include <functional> // for function
+#include <iostream> // for operator<<, basic_ostream, ostrin...
+#include <iterator> // for next
+#include <list> // for _List_iterator
+#include <memory> // for allocator, unique_ptr, make_unique
+#include <new> // for operator new
+#include <nix/args.hh> // for argvToStrings, UsageError
+#include <nix/attr-path.hh> // for findAlongAttrPath
+#include <nix/attr-set.hh> // for Attr, Bindings, Bindings::iterator
+#include <nix/common-eval-args.hh> // for MixEvalArgs
+#include <nix/eval-inline.hh> // for EvalState::forceValue
+#include <nix/eval.hh> // for EvalState, initGC, operator<<
+#include <nix/globals.hh> // for initPlugins, Settings, settings
+#include <nix/nixexpr.hh> // for Pos
+#include <nix/shared.hh> // for getArg, LegacyArgs, printVersion
+#include <nix/store-api.hh> // for openStore
+#include <nix/symbol-table.hh> // for Symbol, SymbolTable
+#include <nix/types.hh> // for Error, Path, Strings, PathSet
+#include <nix/util.hh> // for absPath, baseNameOf
+#include <nix/value.hh> // for Value, Value::(anonymous), Value:...
+#include <string> // for string, operator+, operator==
+#include <utility> // for move
+#include <variant> // for get, holds_alternative, variant
+#include <vector> // for vector<>::iterator, vector
+
+#include "libnix-copy-paste.hh"
+
+using nix::absPath;
+using nix::Bindings;
+using nix::Error;
+using nix::EvalError;
+using nix::EvalState;
+using nix::Path;
+using nix::PathSet;
+using nix::Strings;
+using nix::Symbol;
+using nix::tAttrs;
+using nix::ThrownError;
+using nix::tLambda;
+using nix::tString;
+using nix::UsageError;
+using nix::Value;
+
+// An ostream wrapper to handle nested indentation
+class Out
+{
+ public:
+ class Separator
+ {};
+ const static Separator sep;
+ enum LinePolicy
+ {
+ ONE_LINE,
+ MULTI_LINE
+ };
+ explicit Out(std::ostream & ostream) : ostream(ostream), policy(ONE_LINE), writeSinceSep(true) {}
+ Out(Out & o, const std::string & start, const std::string & end, LinePolicy policy);
+ Out(Out & o, const std::string & start, const std::string & end, int count)
+ : Out(o, start, end, count < 2 ? ONE_LINE : MULTI_LINE)
+ {}
+ Out(const Out &) = delete;
+ Out(Out &&) = default;
+ Out & operator=(const Out &) = delete;
+ Out & operator=(Out &&) = delete;
+ ~Out() { ostream << end; }
+
+ private:
+ std::ostream & ostream;
+ std::string indentation;
+ std::string end;
+ LinePolicy policy;
+ bool writeSinceSep;
+ template <typename T> friend Out & operator<<(Out & o, T thing);
+};
+
+template <typename T> Out & operator<<(Out & o, T thing)
+{
+ if (!o.writeSinceSep && o.policy == Out::MULTI_LINE) {
+ o.ostream << o.indentation;
+ }
+ o.writeSinceSep = true;
+ o.ostream << thing;
+ return o;
+}
+
+template <> Out & operator<<<Out::Separator>(Out & o, Out::Separator /* thing */)
+{
+ o.ostream << (o.policy == Out::ONE_LINE ? " " : "\n");
+ o.writeSinceSep = false;
+ return o;
+}
+
+Out::Out(Out & o, const std::string & start, const std::string & end, LinePolicy policy)
+ : ostream(o.ostream), indentation(policy == ONE_LINE ? o.indentation : o.indentation + " "),
+ end(policy == ONE_LINE ? end : o.indentation + end), policy(policy), writeSinceSep(true)
+{
+ o << start;
+ *this << Out::sep;
+}
+
+// Stuff needed for evaluation
+struct Context
+{
+ Context(EvalState & state, Bindings & autoArgs, Value optionsRoot, Value configRoot)
+ : state(state), autoArgs(autoArgs), optionsRoot(optionsRoot), configRoot(configRoot),
+ underscoreType(state.symbols.create("_type"))
+ {}
+ EvalState & state;
+ Bindings & autoArgs;
+ Value optionsRoot;
+ Value configRoot;
+ Symbol underscoreType;
+};
+
+Value evaluateValue(Context & ctx, Value & v)
+{
+ ctx.state.forceValue(v);
+ if (ctx.autoArgs.empty()) {
+ return v;
+ }
+ Value called{};
+ ctx.state.autoCallFunction(ctx.autoArgs, v, called);
+ return called;
+}
+
+bool isOption(Context & ctx, const Value & v)
+{
+ if (v.type != tAttrs) {
+ return false;
+ }
+ const auto & atualType = v.attrs->find(ctx.underscoreType);
+ if (atualType == v.attrs->end()) {
+ return false;
+ }
+ try {
+ Value evaluatedType = evaluateValue(ctx, *atualType->value);
+ if (evaluatedType.type != tString) {
+ return false;
+ }
+ return static_cast<std::string>(evaluatedType.string.s) == "option";
+ } catch (Error &) {
+ return false;
+ }
+}
+
+// Add quotes to a component of a path.
+// These are needed for paths like:
+// fileSystems."/".fsType
+// systemd.units."dbus.service".text
+std::string quoteAttribute(const std::string & attribute)
+{
+ if (isVarName(attribute)) {
+ return attribute;
+ }
+ std::ostringstream buf;
+ printStringValue(buf, attribute.c_str());
+ return buf.str();
+}
+
+const std::string appendPath(const std::string & prefix, const std::string & suffix)
+{
+ if (prefix.empty()) {
+ return quoteAttribute(suffix);
+ }
+ return prefix + "." + quoteAttribute(suffix);
+}
+
+bool forbiddenRecursionName(std::string name) { return (!name.empty() && name[0] == '_') || name == "haskellPackages"; }
+
+void recurse(const std::function<bool(const std::string & path, std::variant<Value, std::exception_ptr>)> & f,
+ Context & ctx, Value v, const std::string & path)
+{
+ std::variant<Value, std::exception_ptr> evaluated;
+ try {
+ evaluated = evaluateValue(ctx, v);
+ } catch (Error &) {
+ evaluated = std::current_exception();
+ }
+ if (!f(path, evaluated)) {
+ return;
+ }
+ if (std::holds_alternative<std::exception_ptr>(evaluated)) {
+ return;
+ }
+ const Value & evaluated_value = std::get<Value>(evaluated);
+ if (evaluated_value.type != tAttrs) {
+ return;
+ }
+ for (const auto & child : evaluated_value.attrs->lexicographicOrder()) {
+ if (forbiddenRecursionName(child->name)) {
+ continue;
+ }
+ recurse(f, ctx, *child->value, appendPath(path, child->name));
+ }
+}
+
+// Calls f on all the option names
+void mapOptions(const std::function<void(const std::string & path)> & f, Context & ctx, Value root)
+{
+ recurse(
+ [f, &ctx](const std::string & path, std::variant<Value, std::exception_ptr> v) {
+ bool isOpt = std::holds_alternative<std::exception_ptr>(v) || isOption(ctx, std::get<Value>(v));
+ if (isOpt) {
+ f(path);
+ }
+ return !isOpt;
+ },
+ ctx, root, "");
+}
+
+// Calls f on all the config values inside one option.
+// Simple options have one config value inside, like sound.enable = true.
+// Compound options have multiple config values. For example, the option
+// "users.users" has about 1000 config values inside it:
+// users.users.avahi.createHome = false;
+// users.users.avahi.cryptHomeLuks = null;
+// users.users.avahi.description = "`avahi-daemon' privilege separation user";
+// ...
+// users.users.avahi.openssh.authorizedKeys.keyFiles = [ ];
+// users.users.avahi.openssh.authorizedKeys.keys = [ ];
+// ...
+// users.users.avahi.uid = 10;
+// users.users.avahi.useDefaultShell = false;
+// users.users.cups.createHome = false;
+// ...
+// users.users.cups.useDefaultShell = false;
+// users.users.gdm = ... ... ...
+// users.users.messagebus = ... .. ...
+// users.users.nixbld1 = ... .. ...
+// ...
+// users.users.systemd-timesync = ... .. ...
+void mapConfigValuesInOption(
+ const std::function<void(const std::string & path, std::variant<Value, std::exception_ptr> v)> & f,
+ const std::string & path, Context & ctx)
+{
+ Value * option;
+ try {
+ option = findAlongAttrPath(ctx.state, path, ctx.autoArgs, ctx.configRoot);
+ } catch (Error &) {
+ f(path, std::current_exception());
+ return;
+ }
+ recurse(
+ [f, ctx](const std::string & path, std::variant<Value, std::exception_ptr> v) {
+ bool leaf = std::holds_alternative<std::exception_ptr>(v) || std::get<Value>(v).type != tAttrs ||
+ ctx.state.isDerivation(std::get<Value>(v));
+ if (!leaf) {
+ return true; // Keep digging
+ }
+ f(path, v);
+ return false;
+ },
+ ctx, *option, path);
+}
+
+std::string describeError(const Error & e) { return "«error: " + e.msg() + "»"; }
+
+void describeDerivation(Context & ctx, Out & out, Value v)
+{
+ // Copy-pasted from nix/src/nix/repl.cc :(
+ Bindings::iterator i = v.attrs->find(ctx.state.sDrvPath);
+ PathSet pathset;
+ try {
+ Path drvPath = i != v.attrs->end() ? ctx.state.coerceToPath(*i->pos, *i->value, pathset) : "???";
+ out << "«derivation " << drvPath << "»";
+ } catch (Error & e) {
+ out << describeError(e);
+ }
+}
+
+Value parseAndEval(EvalState & state, const std::string & expression, const std::string & path)
+{
+ Value v{};
+ state.eval(state.parseExprFromString(expression, absPath(path)), v);
+ return v;
+}
+
+void printValue(Context & ctx, Out & out, std::variant<Value, std::exception_ptr> maybeValue, const std::string & path);
+
+void printList(Context & ctx, Out & out, Value & v)
+{
+ Out listOut(out, "[", "]", v.listSize());
+ for (unsigned int n = 0; n < v.listSize(); ++n) {
+ printValue(ctx, listOut, *v.listElems()[n], "");
+ listOut << Out::sep;
+ }
+}
+
+void printAttrs(Context & ctx, Out & out, Value & v, const std::string & path)
+{
+ Out attrsOut(out, "{", "}", v.attrs->size());
+ for (const auto & a : v.attrs->lexicographicOrder()) {
+ std::string name = a->name;
+ attrsOut << name << " = ";
+ printValue(ctx, attrsOut, *a->value, appendPath(path, name));
+ attrsOut << ";" << Out::sep;
+ }
+}
+
+void multiLineStringEscape(Out & out, const std::string & s)
+{
+ int i;
+ for (i = 1; i < s.size(); i++) {
+ if (s[i - 1] == '$' && s[i] == '{') {
+ out << "''${";
+ i++;
+ } else if (s[i - 1] == '\'' && s[i] == '\'') {
+ out << "'''";
+ i++;
+ } else {
+ out << s[i - 1];
+ }
+ }
+ if (i == s.size()) {
+ out << s[i - 1];
+ }
+}
+
+void printMultiLineString(Out & out, const Value & v)
+{
+ std::string s = v.string.s;
+ Out strOut(out, "''", "''", Out::MULTI_LINE);
+ std::string::size_type begin = 0;
+ while (begin < s.size()) {
+ std::string::size_type end = s.find('\n', begin);
+ if (end == std::string::npos) {
+ multiLineStringEscape(strOut, s.substr(begin, s.size() - begin));
+ break;
+ }
+ multiLineStringEscape(strOut, s.substr(begin, end - begin));
+ strOut << Out::sep;
+ begin = end + 1;
+ }
+}
+
+void printValue(Context & ctx, Out & out, std::variant<Value, std::exception_ptr> maybeValue, const std::string & path)
+{
+ try {
+ if (auto ex = std::get_if<std::exception_ptr>(&maybeValue)) {
+ std::rethrow_exception(*ex);
+ }
+ Value v = evaluateValue(ctx, std::get<Value>(maybeValue));
+ if (ctx.state.isDerivation(v)) {
+ describeDerivation(ctx, out, v);
+ } else if (v.isList()) {
+ printList(ctx, out, v);
+ } else if (v.type == tAttrs) {
+ printAttrs(ctx, out, v, path);
+ } else if (v.type == tString && std::string(v.string.s).find('\n') != std::string::npos) {
+ printMultiLineString(out, v);
+ } else {
+ ctx.state.forceValueDeep(v);
+ out << v;
+ }
+ } catch (ThrownError & e) {
+ if (e.msg() == "The option `" + path + "' is used but not defined.") {
+ // 93% of errors are this, and just letting this message through would be
+ // misleading. These values may or may not actually be "used" in the
+ // config. The thing throwing the error message assumes that if anything
+ // ever looks at this value, it is a "use" of this value. But here in
+ // nixos-option, we are looking at this value only to print it.
+ // In order to avoid implying that this undefined value is actually
+ // referenced, eat the underlying error message and emit "«not defined»".
+ out << "«not defined»";
+ } else {
+ out << describeError(e);
+ }
+ } catch (Error & e) {
+ out << describeError(e);
+ }
+}
+
+void printConfigValue(Context & ctx, Out & out, const std::string & path, std::variant<Value, std::exception_ptr> v)
+{
+ out << path << " = ";
+ printValue(ctx, out, std::move(v), path);
+ out << ";\n";
+}
+
+void printAll(Context & ctx, Out & out)
+{
+ mapOptions(
+ [&ctx, &out](const std::string & optionPath) {
+ mapConfigValuesInOption(
+ [&ctx, &out](const std::string & configPath, std::variant<Value, std::exception_ptr> v) {
+ printConfigValue(ctx, out, configPath, v);
+ },
+ optionPath, ctx);
+ },
+ ctx, ctx.optionsRoot);
+}
+
+void printAttr(Context & ctx, Out & out, const std::string & path, Value & root)
+{
+ try {
+ printValue(ctx, out, *findAlongAttrPath(ctx.state, path, ctx.autoArgs, root), path);
+ } catch (Error & e) {
+ out << describeError(e);
+ }
+}
+
+bool hasExample(Context & ctx, Value & option)
+{
+ try {
+ findAlongAttrPath(ctx.state, "example", ctx.autoArgs, option);
+ return true;
+ } catch (Error &) {
+ return false;
+ }
+}
+
+void printOption(Context & ctx, Out & out, const std::string & path, Value & option)
+{
+ out << "Value:\n";
+ printAttr(ctx, out, path, ctx.configRoot);
+
+ out << "\n\nDefault:\n";
+ printAttr(ctx, out, "default", option);
+
+ out << "\n\nType:\n";
+ printAttr(ctx, out, "type.description", option);
+
+ if (hasExample(ctx, option)) {
+ out << "\n\nExample:\n";
+ printAttr(ctx, out, "example", option);
+ }
+
+ out << "\n\nDescription:\n";
+ printAttr(ctx, out, "description", option);
+
+ out << "\n\nDeclared by:\n";
+ printAttr(ctx, out, "declarations", option);
+
+ out << "\n\nDefined by:\n";
+ printAttr(ctx, out, "files", option);
+ out << "\n";
+}
+
+void printListing(Out & out, Value & v)
+{
+ out << "This attribute set contains:\n";
+ for (const auto & a : v.attrs->lexicographicOrder()) {
+ std::string name = a->name;
+ if (!name.empty() && name[0] != '_') {
+ out << name << "\n";
+ }
+ }
+}
+
+bool optionTypeIs(Context & ctx, Value & v, const std::string & soughtType)
+{
+ try {
+ const auto & typeLookup = v.attrs->find(ctx.state.sType);
+ if (typeLookup == v.attrs->end()) {
+ return false;
+ }
+ Value type = evaluateValue(ctx, *typeLookup->value);
+ if (type.type != tAttrs) {
+ return false;
+ }
+ const auto & nameLookup = type.attrs->find(ctx.state.sName);
+ if (nameLookup == type.attrs->end()) {
+ return false;
+ }
+ Value name = evaluateValue(ctx, *nameLookup->value);
+ if (name.type != tString) {
+ return false;
+ }
+ return name.string.s == soughtType;
+ } catch (Error &) {
+ return false;
+ }
+}
+
+bool isAggregateOptionType(Context & ctx, Value & v)
+{
+ return optionTypeIs(ctx, v, "attrsOf") || optionTypeIs(ctx, v, "listOf") || optionTypeIs(ctx, v, "loaOf");
+}
+
+MakeError(OptionPathError, EvalError);
+
+Value getSubOptions(Context & ctx, Value & option)
+{
+ Value getSubOptions = evaluateValue(ctx, *findAlongAttrPath(ctx.state, "type.getSubOptions", ctx.autoArgs, option));
+ if (getSubOptions.type != tLambda) {
+ throw OptionPathError("Option's type.getSubOptions isn't a function");
+ }
+ Value emptyString{};
+ nix::mkString(emptyString, "");
+ Value v;
+ ctx.state.callFunction(getSubOptions, emptyString, v, nix::Pos{});
+ return v;
+}
+
+// Carefully walk an option path, looking for sub-options when a path walks past
+// an option value.
+Value findAlongOptionPath(Context & ctx, const std::string & path)
+{
+ Strings tokens = parseAttrPath(path);
+ Value v = ctx.optionsRoot;
+ for (auto i = tokens.begin(); i != tokens.end(); i++) {
+ const auto & attr = *i;
+ try {
+ bool lastAttribute = std::next(i) == tokens.end();
+ v = evaluateValue(ctx, v);
+ if (attr.empty()) {
+ throw OptionPathError("empty attribute name");
+ }
+ if (isOption(ctx, v) && optionTypeIs(ctx, v, "submodule")) {
+ v = getSubOptions(ctx, v);
+ }
+ if (isOption(ctx, v) && isAggregateOptionType(ctx, v) && !lastAttribute) {
+ v = getSubOptions(ctx, v);
+ // Note that we've consumed attr, but didn't actually use it. This is the path component that's looked
+ // up in the list or attribute set that doesn't name an option -- the "root" in "users.users.root.name".
+ } else if (v.type != tAttrs) {
+ throw OptionPathError("Value is %s while a set was expected", showType(v));
+ } else {
+ const auto & next = v.attrs->find(ctx.state.symbols.create(attr));
+ if (next == v.attrs->end()) {
+ throw OptionPathError("Attribute not found", attr, path);
+ }
+ v = *next->value;
+ }
+ } catch (OptionPathError & e) {
+ throw OptionPathError("At '%s' in path '%s': %s", attr, path, e.msg());
+ }
+ }
+ return v;
+}
+
+void printOne(Context & ctx, Out & out, const std::string & path)
+{
+ try {
+ Value option = findAlongOptionPath(ctx, path);
+ option = evaluateValue(ctx, option);
+ if (isOption(ctx, option)) {
+ printOption(ctx, out, path, option);
+ } else {
+ printListing(out, option);
+ }
+ } catch (Error & e) {
+ std::cerr << "error: " << e.msg()
+ << "\nAn error occurred while looking for attribute names. Are "
+ "you sure that '"
+ << path << "' exists?\n";
+ }
+}
+
+int main(int argc, char ** argv)
+{
+ bool all = false;
+ std::string path = ".";
+ std::string optionsExpr = "(import <nixpkgs/nixos> {}).options";
+ std::string configExpr = "(import <nixpkgs/nixos> {}).config";
+ std::vector<std::string> args;
+
+ struct MyArgs : nix::LegacyArgs, nix::MixEvalArgs
+ {
+ using nix::LegacyArgs::LegacyArgs;
+ };
+
+ MyArgs myArgs(nix::baseNameOf(argv[0]), [&](Strings::iterator & arg, const Strings::iterator & end) {
+ if (*arg == "--help") {
+ nix::showManPage("nixos-option");
+ } else if (*arg == "--version") {
+ nix::printVersion("nixos-option");
+ } else if (*arg == "--all") {
+ all = true;
+ } else if (*arg == "--path") {
+ path = nix::getArg(*arg, arg, end);
+ } else if (*arg == "--options_expr") {
+ optionsExpr = nix::getArg(*arg, arg, end);
+ } else if (*arg == "--config_expr") {
+ configExpr = nix::getArg(*arg, arg, end);
+ } else if (!arg->empty() && arg->at(0) == '-') {
+ return false;
+ } else {
+ args.push_back(*arg);
+ }
+ return true;
+ });
+
+ myArgs.parseCmdline(nix::argvToStrings(argc, argv));
+
+ nix::initPlugins();
+ nix::initGC();
+ nix::settings.readOnlyMode = true;
+ auto store = nix::openStore();
+ auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
+
+ Value optionsRoot = parseAndEval(*state, optionsExpr, path);
+ Value configRoot = parseAndEval(*state, configExpr, path);
+
+ Context ctx{*state, *myArgs.getAutoArgs(*state), optionsRoot, configRoot};
+ Out out(std::cout);
+
+ if (all) {
+ if (!args.empty()) {
+ throw UsageError("--all cannot be used with arguments");
+ }
+ printAll(ctx, out);
+ } else {
+ if (args.empty()) {
+ printOne(ctx, out, "");
+ }
+ for (const auto & arg : args) {
+ printOne(ctx, out, arg);
+ }
+ }
+
+ ctx.state.printStats();
+
+ return 0;
+}
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh b/nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh
index ea434ca8741..c53dc1000c4 100644
--- a/nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -22,6 +22,7 @@ repair=
profile=/nix/var/nix/profiles/system
buildHost=
targetHost=
+maybeSudo=
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
@@ -89,6 +90,11 @@ while [ "$#" -gt 0 ]; do
targetHost="$1"
shift 1
;;
+ --use-remote-sudo)
+ # note the trailing space
+ maybeSudo="sudo "
+ shift 1
+ ;;
*)
echo "$0: unknown option \`$i'"
exit 1
@@ -96,7 +102,6 @@ while [ "$#" -gt 0 ]; do
esac
done
-
if [ -z "$buildHost" -a -n "$targetHost" ]; then
buildHost="$targetHost"
fi
@@ -111,9 +116,9 @@ buildHostCmd() {
if [ -z "$buildHost" ]; then
"$@"
elif [ -n "$remoteNix" ]; then
- ssh $SSHOPTS "$buildHost" env PATH="$remoteNix:$PATH" "$@"
+ ssh $SSHOPTS "$buildHost" env PATH="$remoteNix:$PATH" "$maybeSudo$@"
else
- ssh $SSHOPTS "$buildHost" "$@"
+ ssh $SSHOPTS "$buildHost" "$maybeSudo$@"
fi
}
@@ -121,7 +126,7 @@ targetHostCmd() {
if [ -z "$targetHost" ]; then
"$@"
else
- ssh $SSHOPTS "$targetHost" "$@"
+ ssh $SSHOPTS "$targetHost" "$maybeSudo$@"
fi
}
diff --git a/nixpkgs/nixos/modules/installer/tools/tools.nix b/nixpkgs/nixos/modules/installer/tools/tools.nix
index 32926005959..e4db39b5c81 100644
--- a/nixpkgs/nixos/modules/installer/tools/tools.nix
+++ b/nixpkgs/nixos/modules/installer/tools/tools.nix
@@ -41,10 +41,7 @@ let
inherit (config.system.nixos-generate-config) configuration;
};
- nixos-option = makeProg {
- name = "nixos-option";
- src = ./nixos-option.sh;
- };
+ nixos-option = pkgs.callPackage ./nixos-option { };
nixos-version = makeProg {
name = "nixos-version";
@@ -120,7 +117,11 @@ in
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
- # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
+ # programs.gnupg.agent = {
+ # enable = true;
+ # enableSSHSupport = true;
+ # pinentryFlavor = "gnome3";
+ # };
# List services that you want to enable:
diff --git a/nixpkgs/nixos/modules/misc/ids.nix b/nixpkgs/nixos/modules/misc/ids.nix
index 3e8a5b07a5e..f8b188e7b1c 100644
--- a/nixpkgs/nixos/modules/misc/ids.nix
+++ b/nixpkgs/nixos/modules/misc/ids.nix
@@ -11,6 +11,9 @@
{ lib, ... }:
+let
+ inherit (lib) types;
+in
{
options = {
@@ -19,6 +22,7 @@
description = ''
The user IDs used in NixOS.
'';
+ type = types.attrsOf types.int;
};
ids.gids = lib.mkOption {
@@ -26,6 +30,7 @@
description = ''
The group IDs used in NixOS.
'';
+ type = types.attrsOf types.int;
};
};
@@ -128,7 +133,7 @@
tcpcryptd = 93; # tcpcryptd uses a hard-coded uid. We patch it in Nixpkgs to match this choice.
firebird = 95;
#keys = 96; # unused
- haproxy = 97;
+ #haproxy = 97; # DynamicUser as of 2019-11-08
mongodb = 98;
openldap = 99;
#users = 100; # unused
@@ -443,7 +448,7 @@
#tcpcryptd = 93; # unused
firebird = 95;
keys = 96;
- haproxy = 97;
+ #haproxy = 97; # DynamicUser as of 2019-11-08
#mongodb = 98; # unused
openldap = 99;
munin = 102;
diff --git a/nixpkgs/nixos/modules/module-list.nix b/nixpkgs/nixos/modules/module-list.nix
index 5214126ff7e..076e1654818 100644
--- a/nixpkgs/nixos/modules/module-list.nix
+++ b/nixpkgs/nixos/modules/module-list.nix
@@ -1,9 +1,7 @@
[
./config/debug-info.nix
- ./config/fonts/corefonts.nix
./config/fonts/fontconfig.nix
./config/fonts/fontconfig-penultimate.nix
- ./config/fonts/fontconfig-ultimate.nix
./config/fonts/fontdir.nix
./config/fonts/fonts.nix
./config/fonts/ghostscript.nix
@@ -37,13 +35,13 @@
./config/terminfo.nix
./config/unix-odbc-drivers.nix
./config/users-groups.nix
- ./config/vpnc.nix
./config/vte.nix
./config/zram.nix
./hardware/acpilight.nix
./hardware/all-firmware.nix
./hardware/bladeRF.nix
./hardware/brightnessctl.nix
+ ./hardware/brillo.nix
./hardware/ckb-next.nix
./hardware/cpu/amd-microcode.nix
./hardware/cpu/intel-microcode.nix
@@ -227,6 +225,7 @@
./services/backup/rsnapshot.nix
./services/backup/tarsnap.nix
./services/backup/tsm.nix
+ ./services/backup/zfs-replication.nix
./services/backup/znapzend.nix
./services/cluster/hadoop/default.nix
./services/cluster/kubernetes/addons/dns.nix
@@ -308,6 +307,7 @@
./services/desktops/gnome3/sushi.nix
./services/desktops/gnome3/tracker.nix
./services/desktops/gnome3/tracker-miners.nix
+ ./services/desktops/neard.nix
./services/desktops/profile-sync-daemon.nix
./services/desktops/system-config-printer.nix
./services/desktops/telepathy.nix
@@ -316,11 +316,13 @@
./services/development/bloop.nix
./services/development/hoogle.nix
./services/development/jupyter/default.nix
+ ./services/development/lorri.nix
./services/editors/emacs.nix
./services/editors/infinoted.nix
./services/games/factorio.nix
./services/games/minecraft-server.nix
./services/games/minetest-server.nix
+ ./services/games/openarena.nix
./services/games/terraria.nix
./services/hardware/acpid.nix
./services/hardware/actkbd.nix
@@ -517,7 +519,6 @@
./services/monitoring/munin.nix
./services/monitoring/nagios.nix
./services/monitoring/netdata.nix
- ./services/monitoring/osquery.nix
./services/monitoring/prometheus/default.nix
./services/monitoring/prometheus/alertmanager.nix
./services/monitoring/prometheus/exporters.nix
@@ -537,7 +538,6 @@
./services/monitoring/zabbix-agent.nix
./services/monitoring/zabbix-proxy.nix
./services/monitoring/zabbix-server.nix
- ./services/network-filesystems/beegfs.nix
./services/network-filesystems/cachefilesd.nix
./services/network-filesystems/davfs2.nix
./services/network-filesystems/drbd.nix
@@ -548,6 +548,8 @@
./services/network-filesystems/nfsd.nix
./services/network-filesystems/openafs/client.nix
./services/network-filesystems/openafs/server.nix
+ ./services/network-filesystems/orangefs/server.nix
+ ./services/network-filesystems/orangefs/client.nix
./services/network-filesystems/rsyncd.nix
./services/network-filesystems/samba.nix
./services/network-filesystems/tahoe.nix
@@ -601,6 +603,7 @@
./services/networking/gdomap.nix
./services/networking/git-daemon.nix
./services/networking/gnunet.nix
+ ./services/networking/go-shadowsocks2.nix
./services/networking/gogoclient.nix
./services/networking/gvpe.nix
./services/networking/hans.nix
@@ -614,7 +617,6 @@
./services/networking/iodine.nix
./services/networking/iperf3.nix
./services/networking/ircd-hybrid/default.nix
- ./services/networking/jormungandr.nix
./services/networking/iwd.nix
./services/networking/keepalived/default.nix
./services/networking/keybase.nix
@@ -713,6 +715,7 @@
./services/networking/tinc.nix
./services/networking/tinydns.nix
./services/networking/tftpd.nix
+ ./services/networking/trickster.nix
./services/networking/tox-bootstrapd.nix
./services/networking/tox-node.nix
./services/networking/toxvpn.nix
@@ -729,6 +732,7 @@
./services/networking/xinetd.nix
./services/networking/xl2tpd.nix
./services/networking/xrdp.nix
+ ./services/networking/yggdrasil.nix
./services/networking/zerobin.nix
./services/networking/zeronet.nix
./services/networking/zerotierone.nix
@@ -793,6 +797,7 @@
./services/web-apps/cryptpad.nix
./services/web-apps/documize.nix
./services/web-apps/frab.nix
+ ./services/web-apps/gotify-server.nix
./services/web-apps/icingaweb2/icingaweb2.nix
./services/web-apps/icingaweb2/module-monitoring.nix
./services/web-apps/limesurvey.nix
@@ -804,8 +809,10 @@
./services/web-apps/nexus.nix
./services/web-apps/pgpkeyserver-lite.nix
./services/web-apps/matomo.nix
+ ./services/web-apps/moinmoin.nix
./services/web-apps/restya-board.nix
./services/web-apps/tt-rss.nix
+ ./services/web-apps/trac.nix
./services/web-apps/selfoss.nix
./services/web-apps/shiori.nix
./services/web-apps/virtlyst.nix
@@ -833,6 +840,7 @@
./services/web-servers/shellinabox.nix
./services/web-servers/tomcat.nix
./services/web-servers/traefik.nix
+ ./services/web-servers/ttyd.nix
./services/web-servers/uwsgi.nix
./services/web-servers/varnish/default.nix
./services/web-servers/zope2.nix
@@ -856,6 +864,7 @@
./services/x11/hardware/multitouch.nix
./services/x11/hardware/synaptics.nix
./services/x11/hardware/wacom.nix
+ ./services/x11/hardware/digimend.nix
./services/x11/hardware/cmt.nix
./services/x11/gdk-pixbuf.nix
./services/x11/redshift.nix
diff --git a/nixpkgs/nixos/modules/profiles/graphical.nix b/nixpkgs/nixos/modules/profiles/graphical.nix
index 649f5564ac6..d80456cede5 100644
--- a/nixpkgs/nixos/modules/profiles/graphical.nix
+++ b/nixpkgs/nixos/modules/profiles/graphical.nix
@@ -9,14 +9,12 @@
displayManager.sddm.enable = true;
desktopManager.plasma5 = {
enable = true;
- enableQt4Support = false;
};
libinput.enable = true; # for touchpad support on many laptops
};
# Enable sound in virtualbox appliances.
hardware.pulseaudio.enable = true;
- hardware.pulseaudio.systemWide = true; # Needed since we run plasma as root.
environment.systemPackages = [ pkgs.glxinfo pkgs.firefox ];
}
diff --git a/nixpkgs/nixos/modules/profiles/installation-device.nix b/nixpkgs/nixos/modules/profiles/installation-device.nix
index fd30220ce1c..4596e163404 100644
--- a/nixpkgs/nixos/modules/profiles/installation-device.nix
+++ b/nixpkgs/nixos/modules/profiles/installation-device.nix
@@ -31,9 +31,6 @@ with lib;
# Let the user play Rogue on TTY 8 during the installation.
#services.rogue.enable = true;
- # Disable some other stuff we don't need.
- services.udisks2.enable = mkDefault false;
-
# Use less privileged nixos user
users.users.nixos = {
isNormalUser = true;
diff --git a/nixpkgs/nixos/modules/programs/adb.nix b/nixpkgs/nixos/modules/programs/adb.nix
index 250d8c252a3..83bcfe886aa 100644
--- a/nixpkgs/nixos/modules/programs/adb.nix
+++ b/nixpkgs/nixos/modules/programs/adb.nix
@@ -23,7 +23,8 @@ with lib;
###### implementation
config = mkIf config.programs.adb.enable {
services.udev.packages = [ pkgs.android-udev-rules ];
- environment.systemPackages = [ pkgs.androidenv.androidPkgs_9_0.platform-tools ];
+ # Give platform-tools lower priority so mke2fs+friends are taken from other packages first
+ environment.systemPackages = [ (lowPrio pkgs.androidenv.androidPkgs_9_0.platform-tools) ];
users.groups.adbusers = {};
};
}
diff --git a/nixpkgs/nixos/modules/programs/gnupg.nix b/nixpkgs/nixos/modules/programs/gnupg.nix
index bcbc994efe9..2d262d90657 100644
--- a/nixpkgs/nixos/modules/programs/gnupg.nix
+++ b/nixpkgs/nixos/modules/programs/gnupg.nix
@@ -6,6 +6,19 @@ let
cfg = config.programs.gnupg;
+ xserverCfg = config.services.xserver;
+
+ defaultPinentryFlavor =
+ if xserverCfg.desktopManager.lxqt.enable
+ || xserverCfg.desktopManager.plasma5.enable then
+ "qt"
+ else if xserverCfg.desktopManager.xfce.enable then
+ "gtk2"
+ else if xserverCfg.enable || config.programs.sway.enable then
+ "gnome3"
+ else
+ null;
+
in
{
@@ -54,6 +67,20 @@ in
'';
};
+ agent.pinentryFlavor = mkOption {
+ type = types.nullOr (types.enum pkgs.pinentry.flavors);
+ example = "gnome3";
+ description = ''
+ Which pinentry interface to use. If not null, the path to the
+ pinentry binary will be passed to gpg-agent via commandline and
+ thus overrides the pinentry option in gpg-agent.conf in the user's
+ home directory.
+ If not set at all, it'll pick an appropriate flavor depending on the
+ system configuration (qt flavor for lxqt and plasma5, gtk2 for xfce
+ 4.12, gnome3 on all other systems with X enabled, ncurses otherwise).
+ '';
+ };
+
dirmngr.enable = mkOption {
type = types.bool;
default = false;
@@ -64,6 +91,16 @@ in
};
config = mkIf cfg.agent.enable {
+ programs.gnupg.agent.pinentryFlavor = mkDefault defaultPinentryFlavor;
+
+ # This overrides the systemd user unit shipped with the gnupg package
+ systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) {
+ serviceConfig.ExecStart = [ "" ''
+ ${pkgs.gnupg}/bin/gpg-agent --supervised \
+ --pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry
+ '' ];
+ };
+
systemd.user.sockets.gpg-agent = {
wantedBy = [ "sockets.target" ];
};
@@ -83,7 +120,9 @@ in
systemd.user.sockets.dirmngr = mkIf cfg.dirmngr.enable {
wantedBy = [ "sockets.target" ];
};
-
+
+ services.dbus.packages = mkIf (cfg.agent.pinentryFlavor == "gnome3") [ pkgs.gcr ];
+
environment.systemPackages = with pkgs; [ cfg.package ];
systemd.packages = [ cfg.package ];
diff --git a/nixpkgs/nixos/modules/programs/seahorse.nix b/nixpkgs/nixos/modules/programs/seahorse.nix
index c08b0a85374..b229d2a2c0d 100644
--- a/nixpkgs/nixos/modules/programs/seahorse.nix
+++ b/nixpkgs/nixos/modules/programs/seahorse.nix
@@ -31,6 +31,8 @@ with lib;
config = mkIf config.programs.seahorse.enable {
+ programs.ssh.askPassword = mkDefault "${pkgs.gnome3.seahorse}/libexec/seahorse/ssh-askpass";
+
environment.systemPackages = [
pkgs.gnome3.seahorse
];
diff --git a/nixpkgs/nixos/modules/programs/shadow.nix b/nixpkgs/nixos/modules/programs/shadow.nix
index 8ec4169207d..7eaf79d864e 100644
--- a/nixpkgs/nixos/modules/programs/shadow.nix
+++ b/nixpkgs/nixos/modules/programs/shadow.nix
@@ -6,17 +6,27 @@ with lib;
let
+ /*
+ There are three different sources for user/group id ranges, each of which gets
+ used by different programs:
+ - The login.defs file, used by the useradd, groupadd and newusers commands
+ - The update-users-groups.pl file, used by NixOS in the activation phase to
+ decide on which ids to use for declaratively defined users without a static
+ id
+ - Systemd compile time options -Dsystem-uid-max= and -Dsystem-gid-max=, used
+ by systemd for features like ConditionUser=@system and systemd-sysusers
+ */
loginDefs =
''
DEFAULT_HOME yes
SYS_UID_MIN 400
- SYS_UID_MAX 499
+ SYS_UID_MAX 999
UID_MIN 1000
UID_MAX 29999
SYS_GID_MIN 400
- SYS_GID_MAX 499
+ SYS_GID_MAX 999
GID_MIN 1000
GID_MAX 29999
diff --git a/nixpkgs/nixos/modules/programs/ssh.nix b/nixpkgs/nixos/modules/programs/ssh.nix
index 733b8f7636f..80198990ed1 100644
--- a/nixpkgs/nixos/modules/programs/ssh.nix
+++ b/nixpkgs/nixos/modules/programs/ssh.nix
@@ -115,6 +115,16 @@ in
'';
};
+ agentPKCS11Whitelist = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "\${pkgs.opensc}/lib/opensc-pkcs11.so";
+ description = ''
+ A pattern-list of acceptable paths for PKCS#11 shared libraries
+ that may be used with the -s option to ssh-add.
+ '';
+ };
+
package = mkOption {
type = types.package;
default = pkgs.openssh;
@@ -241,6 +251,7 @@ in
ExecStart =
"${cfg.package}/bin/ssh-agent " +
optionalString (cfg.agentTimeout != null) ("-t ${cfg.agentTimeout} ") +
+ optionalString (cfg.agentPKCS11Whitelist != null) ("-P ${cfg.agentPKCS11Whitelist} ") +
"-a %t/ssh-agent";
StandardOutput = "null";
Type = "forking";
diff --git a/nixpkgs/nixos/modules/programs/ssmtp.nix b/nixpkgs/nixos/modules/programs/ssmtp.nix
index 0e060e3f522..e45748af205 100644
--- a/nixpkgs/nixos/modules/programs/ssmtp.nix
+++ b/nixpkgs/nixos/modules/programs/ssmtp.nix
@@ -8,18 +8,16 @@
with lib;
let
-
- cfg = config.networking.defaultMailServer;
+ cfg = config.services.ssmtp;
in
-
{
options = {
- networking.defaultMailServer = {
+ services.ssmtp = {
- directDelivery = mkOption {
+ enable = mkOption {
type = types.bool;
default = false;
description = ''
@@ -29,7 +27,7 @@ in
<command>sendmail</command> or <command>postfix</command> on
your machine, set this option to <literal>true</literal>, and
set the option
- <option>networking.defaultMailServer.hostName</option> to the
+ <option>services.ssmtp.hostName</option> to the
host name of your preferred mail server.
'';
};
@@ -129,9 +127,9 @@ in
};
- config = mkIf cfg.directDelivery {
+ config = mkIf cfg.enable {
- networking.defaultMailServer.authPassFile = mkIf (cfg.authPass != "")
+ services.ssmtp.authPassFile = mkIf (cfg.authPass != "")
(mkDefault (toString (pkgs.writeTextFile {
name = "ssmtp-authpass";
text = cfg.authPass;
diff --git a/nixpkgs/nixos/modules/programs/x2goserver.nix b/nixpkgs/nixos/modules/programs/x2goserver.nix
index 77a1a0da799..7d74231e956 100644
--- a/nixpkgs/nixos/modules/programs/x2goserver.nix
+++ b/nixpkgs/nixos/modules/programs/x2goserver.nix
@@ -69,6 +69,7 @@ in {
users.users.x2go = {
home = "/var/lib/x2go/db";
group = "x2go";
+ isSystemUser = true;
};
security.wrappers.x2gosqliteWrapper = {
diff --git a/nixpkgs/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix b/nixpkgs/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
index 7184e5d9b9a..c84d26a7921 100644
--- a/nixpkgs/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
+++ b/nixpkgs/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
@@ -81,7 +81,7 @@ in
];
programs.zsh.interactiveShellInit = with pkgs;
- lib.concatStringsSep "\n" ([
+ lib.mkAfter (lib.concatStringsSep "\n" ([
"source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
] ++ optional (length(cfg.highlighters) > 0)
"ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})"
@@ -95,6 +95,6 @@ in
styles: design:
"ZSH_HIGHLIGHT_STYLES[${styles}]='${design}'"
) cfg.styles)
- );
+ ));
};
}
diff --git a/nixpkgs/nixos/modules/rename.nix b/nixpkgs/nixos/modules/rename.nix
index df8ebe50584..e392fef54dd 100644
--- a/nixpkgs/nixos/modules/rename.nix
+++ b/nixpkgs/nixos/modules/rename.nix
@@ -10,6 +10,9 @@ with lib;
(mkRenamedOptionModule [ "networking" "enableRalinkFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
(mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
(mkRenamedOptionModule [ "networking" "networkmanager" "useDnsmasq" ] [ "networking" "networkmanager" "dns" ])
+ (mkRenamedOptionModule [ "networking" "connman" ] [ "services" "connman" ])
+ (mkRenamedOptionModule [ "networking" "defaultMailServer" ] [ "services" "ssmtp" ])
+ (mkRenamedOptionModule [ "services" "ssmtp" "directDelivery" ] [ "services" "ssmtp" "enable" ])
(mkChangedOptionModule [ "services" "printing" "gutenprint" ] [ "services" "printing" "drivers" ]
(config:
let enabled = getAttrFromPath [ "services" "printing" "gutenprint" ] config;
@@ -135,7 +138,8 @@ with lib;
# piwik was renamed to matomo
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
(mkRenamedOptionModule [ "services" "piwik" "webServerUser" ] [ "services" "matomo" "webServerUser" ])
- (mkRenamedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] [ "services" "matomo" "phpfpmProcessManagerConfig" ])
+ (mkRemovedOptionModule [ "services" "piwik" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
+ (mkRemovedOptionModule [ "services" "matomo" "phpfpmProcessManagerConfig" ] "Use services.phpfpm.pools.<name>.settings")
(mkRenamedOptionModule [ "services" "piwik" "nginx" ] [ "services" "matomo" "nginx" ])
# tarsnap
@@ -233,6 +237,8 @@ with lib;
(mkRemovedOptionModule [ "services" "mysql" "rootPassword" ] "Use socket authentication or set the password outside of the nix store.")
(mkRemovedOptionModule [ "services" "zabbixServer" "dbPassword" ] "Use services.zabbixServer.database.passwordFile instead.")
(mkRemovedOptionModule [ "systemd" "generator-packages" ] "Use systemd.packages instead.")
+ (mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.fonts = [ pkgs.corefonts ]; instead.")
+ (mkRemovedOptionModule [ "networking" "vpnc" ] "Use environment.etc.\"vpnc/service.conf\" instead.")
# ZSH
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
@@ -277,6 +283,13 @@ with lib;
# BLCR
(mkRemovedOptionModule [ "environment.blcr.enable" ] "The BLCR module has been removed")
+ # beegfs
+ (mkRemovedOptionModule [ "services.beegfsEnable" ] "The BeeGFS module has been removed")
+ (mkRemovedOptionModule [ "services.beegfs" ] "The BeeGFS module has been removed")
+
+ # osquery
+ (mkRemovedOptionModule [ "services.osquery" ] "The osquery module has been removed")
+
# Redis
(mkRemovedOptionModule [ "services" "redis" "user" ] "The redis module now is hardcoded to the redis user.")
(mkRemovedOptionModule [ "services" "redis" "dbpath" ] "The redis module now uses /var/lib/redis as data directory.")
@@ -290,5 +303,14 @@ with lib;
(opt: mkRemovedOptionModule [ "services" "prometheus" "${opt}" ] ''
The prometheus exporters are now configured using `services.prometheus.exporters'.
See the 18.03 release notes for more information.
+ '' ))
+
+ ++ (forEach [ "enable" "substitutions" "preset" ]
+ (opt: mkRemovedOptionModule [ "fonts" "fontconfig" "ultimate" "${opt}" ] ''
+ The fonts.fontconfig.ultimate module and configuration is obsolete.
+ The repository has since been archived and activity has ceased.
+ https://github.com/bohoomil/fontconfig-ultimate/issues/171.
+ No action should be needed for font configuration, as the fonts.fontconfig
+ module is already used by default.
'' ));
}
diff --git a/nixpkgs/nixos/modules/security/acme.nix b/nixpkgs/nixos/modules/security/acme.nix
index b321c04e574..9563029f030 100644
--- a/nixpkgs/nixos/modules/security/acme.nix
+++ b/nixpkgs/nixos/modules/security/acme.nix
@@ -20,6 +20,16 @@ let
'';
};
+ server = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ ACME Directory Resource URI. Defaults to let's encrypt
+ production endpoint,
+ https://acme-v02.api.letsencrypt.org/directory, if unset.
+ '';
+ };
+
domain = mkOption {
type = types.str;
default = name;
@@ -69,9 +79,9 @@ let
plugins = mkOption {
type = types.listOf (types.enum [
"cert.der" "cert.pem" "chain.pem" "external.sh"
- "fullchain.pem" "full.pem" "key.der" "key.pem" "account_key.json"
+ "fullchain.pem" "full.pem" "key.der" "key.pem" "account_key.json" "account_reg.json"
]);
- default = [ "fullchain.pem" "full.pem" "key.pem" "account_key.json" ];
+ default = [ "fullchain.pem" "full.pem" "key.pem" "account_key.json" "account_reg.json" ];
description = ''
Plugins to enable. With default settings simp_le will
store public certificate bundle in <filename>fullchain.pem</filename>,
@@ -109,7 +119,15 @@ in
{
###### interface
-
+ imports = [
+ (mkRemovedOptionModule [ "security" "acme" "production" ] ''
+ Use security.acme.server to define your staging ACME server URL instead.
+
+ To use the let's encrypt staging server, use security.acme.server =
+ "https://acme-staging-v02.api.letsencrypt.org/directory".
+ ''
+ )
+ ];
options = {
security.acme = {
@@ -129,6 +147,16 @@ in
'';
};
+ server = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ ACME Directory Resource URI. Defaults to let's encrypt
+ production endpoint,
+ <literal>https://acme-v02.api.letsencrypt.org/directory</literal>, if unset.
+ '';
+ };
+
preliminarySelfsigned = mkOption {
type = types.bool;
default = true;
@@ -142,20 +170,6 @@ in
'';
};
- production = mkOption {
- type = types.bool;
- default = true;
- description = ''
- If set to true, use Let's Encrypt's production environment
- instead of the staging environment. The main benefit of the
- staging environment is to get much higher rate limits.
-
- See
- <literal>https://letsencrypt.org/docs/staging-environment</literal>
- for more detail.
- '';
- };
-
certs = mkOption {
default = { };
type = with types; attrsOf (submodule certOpts);
@@ -198,13 +212,24 @@ in
++ optionals (data.email != null) [ "--email" data.email ]
++ concatMap (p: [ "-f" p ]) data.plugins
++ concatLists (mapAttrsToList (name: root: [ "-d" (if root == null then name else "${name}:${root}")]) data.extraDomains)
- ++ optionals (!cfg.production) ["--server" "https://acme-staging.api.letsencrypt.org/directory"];
+ ++ optionals (cfg.server != null || data.server != null) ["--server" (if data.server == null then cfg.server else data.server)];
acmeService = {
description = "Renew ACME Certificate for ${cert}";
after = [ "network.target" "network-online.target" ];
wants = [ "network-online.target" ];
+ # simp_le uses requests, which uses certifi under the hood,
+ # which doesn't respect the system trust store.
+ # At least in the acme test, we provision a fake CA, impersonating the LE endpoint.
+ # REQUESTS_CA_BUNDLE is a way to teach python requests to use something else
+ environment.REQUESTS_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt";
serviceConfig = {
Type = "oneshot";
+ # With RemainAfterExit the service is considered active even
+ # after the main process having exited, which means when it
+ # gets changed, the activation phase restarts it, meaning
+ # the permissions of the StateDirectory get adjusted
+ # according to the specified group
+ RemainAfterExit = true;
SuccessExitStatus = [ "0" "1" ];
User = data.user;
Group = data.group;
diff --git a/nixpkgs/nixos/modules/security/pam_mount.nix b/nixpkgs/nixos/modules/security/pam_mount.nix
index 8b131c54a2a..75f58462d13 100644
--- a/nixpkgs/nixos/modules/security/pam_mount.nix
+++ b/nixpkgs/nixos/modules/security/pam_mount.nix
@@ -50,9 +50,6 @@ in
<pam_mount>
<debug enable="0" />
- ${concatStrings (map userVolumeEntry (attrValues extraUserVolumes))}
- ${concatStringsSep "\n" cfg.extraVolumes}
-
<!-- if activated, requires ofl from hxtools to be present -->
<logout wait="0" hup="no" term="no" kill="no" />
<!-- set PATH variable for pam_mount module -->
@@ -64,6 +61,9 @@ in
<cryptmount>${pkgs.pam_mount}/bin/mount.crypt %(VOLUME) %(MNTPT)</cryptmount>
<cryptumount>${pkgs.pam_mount}/bin/umount.crypt %(MNTPT)</cryptumount>
<pmvarrun>${pkgs.pam_mount}/bin/pmvarrun -u %(USER) -o %(OPERATION)</pmvarrun>
+
+ ${concatStrings (map userVolumeEntry (attrValues extraUserVolumes))}
+ ${concatStringsSep "\n" cfg.extraVolumes}
</pam_mount>
'';
}];
diff --git a/nixpkgs/nixos/modules/services/admin/oxidized.nix b/nixpkgs/nixos/modules/services/admin/oxidized.nix
index 39112c3970d..da81be3f23e 100644
--- a/nixpkgs/nixos/modules/services/admin/oxidized.nix
+++ b/nixpkgs/nixos/modules/services/admin/oxidized.nix
@@ -89,6 +89,7 @@ in
group = cfg.group;
home = cfg.dataDir;
createHome = true;
+ isSystemUser = true;
};
systemd.services.oxidized = {
diff --git a/nixpkgs/nixos/modules/services/audio/jack.nix b/nixpkgs/nixos/modules/services/audio/jack.nix
index aa3351f401a..ceff366d0bb 100644
--- a/nixpkgs/nixos/modules/services/audio/jack.nix
+++ b/nixpkgs/nixos/modules/services/audio/jack.nix
@@ -223,6 +223,7 @@ in {
group = "jackaudio";
extraGroups = [ "audio" ];
description = "JACK Audio system service user";
+ isSystemUser = true;
};
# http://jackaudio.org/faq/linux_rt_config.html
security.pam.loginLimits = [
diff --git a/nixpkgs/nixos/modules/services/audio/mpd.nix b/nixpkgs/nixos/modules/services/audio/mpd.nix
index 0df8f9688d2..7932d094197 100644
--- a/nixpkgs/nixos/modules/services/audio/mpd.nix
+++ b/nixpkgs/nixos/modules/services/audio/mpd.nix
@@ -18,7 +18,6 @@ let
''}
state_file "${cfg.dataDir}/state"
sticker_file "${cfg.dataDir}/sticker.sql"
- log_file "syslog"
user "${cfg.user}"
group "${cfg.group}"
@@ -181,6 +180,7 @@ in {
ProtectKernelModules = true;
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX AF_NETLINK";
RestrictNamespaces = true;
+ Restart = "always";
};
};
diff --git a/nixpkgs/nixos/modules/services/audio/roon-server.nix b/nixpkgs/nixos/modules/services/audio/roon-server.nix
index 4eda3c5708d..6aed485638c 100644
--- a/nixpkgs/nixos/modules/services/audio/roon-server.nix
+++ b/nixpkgs/nixos/modules/services/audio/roon-server.nix
@@ -66,7 +66,8 @@ in {
if cfg.user == "roon-server" then {
isSystemUser = true;
description = "Roon Server user";
- groups = [ cfg.group "audio" ];
+ group = cfg.group;
+ extraGroups = [ "audio" ];
}
else {};
};
diff --git a/nixpkgs/nixos/modules/services/backup/automysqlbackup.nix b/nixpkgs/nixos/modules/services/backup/automysqlbackup.nix
index 1884f3536a9..e3a8d1f7993 100644
--- a/nixpkgs/nixos/modules/services/backup/automysqlbackup.nix
+++ b/nixpkgs/nixos/modules/services/backup/automysqlbackup.nix
@@ -99,7 +99,10 @@ in
environment.systemPackages = [ pkg ];
- users.users.${user}.group = group;
+ users.users.${user} = {
+ group = group;
+ isSystemUser = true;
+ };
users.groups.${group} = { };
systemd.tmpfiles.rules = [
diff --git a/nixpkgs/nixos/modules/services/backup/znapzend.nix b/nixpkgs/nixos/modules/services/backup/znapzend.nix
index f317078ddda..203631a577f 100644
--- a/nixpkgs/nixos/modules/services/backup/znapzend.nix
+++ b/nixpkgs/nixos/modules/services/backup/znapzend.nix
@@ -34,6 +34,8 @@ let
description = "string of the form number{b|k|M|G}";
};
+ enabledFeatures = concatLists (mapAttrsToList (name: enabled: optional enabled name) cfg.features);
+
# Type for a string that must contain certain other strings (the list parameter).
# Note that these would need regex escaping.
stringContainingStrings = list: let
@@ -354,6 +356,22 @@ in
'';
default = false;
};
+
+ features.recvu = mkEnableOption ''
+ recvu feature which uses <literal>-u</literal> on the receiving end to keep the destination
+ filesystem unmounted.
+ '';
+ features.compressed = mkEnableOption ''
+ compressed feature which adds the options <literal>-Lce</literal> to
+ the <command>zfs send</command> command. When this is enabled, make
+ sure that both the sending and receiving pool have the same relevant
+ features enabled. Using <literal>-c</literal> will skip unneccessary
+ decompress-compress stages, <literal>-L</literal> is for large block
+ support and -e is for embedded data support. see
+ <citerefentry><refentrytitle>znapzend</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ and <citerefentry><refentrytitle>zfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ for more info.
+ '';
};
};
@@ -381,12 +399,22 @@ in
'';
serviceConfig = {
+ # znapzendzetup --import apparently tries to connect to the backup
+ # host 3 times with a timeout of 30 seconds, leading to a startup
+ # delay of >90s when the host is down, which is just above the default
+ # service timeout of 90 seconds. Increase the timeout so it doesn't
+ # make the service fail in that case.
+ TimeoutStartSec = 180;
+ # Needs to have write access to ZFS
+ User = "root";
ExecStart = let
args = concatStringsSep " " [
"--logto=${cfg.logTo}"
"--loglevel=${cfg.logLevel}"
(optionalString cfg.noDestroy "--nodestroy")
(optionalString cfg.autoCreation "--autoCreation")
+ (optionalString (enabledFeatures != [])
+ "--features=${concatStringsSep "," enabledFeatures}")
]; in "${pkgs.znapzend}/bin/znapzend ${args}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "on-failure";
diff --git a/nixpkgs/nixos/modules/services/cluster/kubernetes/addons/dns.nix b/nixpkgs/nixos/modules/services/cluster/kubernetes/addons/dns.nix
index 47e588de3c9..f12e866930d 100644
--- a/nixpkgs/nixos/modules/services/cluster/kubernetes/addons/dns.nix
+++ b/nixpkgs/nixos/modules/services/cluster/kubernetes/addons/dns.nix
@@ -3,7 +3,7 @@
with lib;
let
- version = "1.5.0";
+ version = "1.6.4";
cfg = config.services.kubernetes.addons.dns;
ports = {
dns = 10053;
@@ -55,9 +55,9 @@ in {
type = types.attrs;
default = {
imageName = "coredns/coredns";
- imageDigest = "sha256:e83beb5e43f8513fa735e77ffc5859640baea30a882a11cc75c4c3244a737d3c";
+ imageDigest = "sha256:493ee88e1a92abebac67cbd4b5658b4730e0f33512461442d8d9214ea6734a9b";
finalImageTag = version;
- sha256 = "15sbmhrxjxidj0j0cccn1qxpg6al175w43m6ngspl0mc132zqc9q";
+ sha256 = "0fm9zdjavpf5hni8g7fkdd3csjbhd7n7py7llxjc66sbii087028";
};
};
};
@@ -68,7 +68,7 @@ in {
services.kubernetes.addonManager.bootstrapAddons = {
coredns-cr = {
- apiVersion = "rbac.authorization.k8s.io/v1beta1";
+ apiVersion = "rbac.authorization.k8s.io/v1";
kind = "ClusterRole";
metadata = {
labels = {
@@ -94,7 +94,7 @@ in {
};
coredns-crb = {
- apiVersion = "rbac.authorization.k8s.io/v1beta1";
+ apiVersion = "rbac.authorization.k8s.io/v1";
kind = "ClusterRoleBinding";
metadata = {
annotations = {
@@ -170,7 +170,7 @@ in {
};
coredns-deploy = {
- apiVersion = "extensions/v1beta1";
+ apiVersion = "apps/v1";
kind = "Deployment";
metadata = {
labels = {
diff --git a/nixpkgs/nixos/modules/services/cluster/kubernetes/flannel.nix b/nixpkgs/nixos/modules/services/cluster/kubernetes/flannel.nix
index d799e638fc9..548ffed1ddb 100644
--- a/nixpkgs/nixos/modules/services/cluster/kubernetes/flannel.nix
+++ b/nixpkgs/nixos/modules/services/cluster/kubernetes/flannel.nix
@@ -40,6 +40,7 @@ in
cni.config = mkDefault [{
name = "mynet";
type = "flannel";
+ cniVersion = "0.3.1";
delegate = {
isDefaultGateway = true;
bridge = "docker0";
diff --git a/nixpkgs/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixpkgs/nixos/modules/services/cluster/kubernetes/kubelet.nix
index 250da4c807e..62d893dfefc 100644
--- a/nixpkgs/nixos/modules/services/cluster/kubernetes/kubelet.nix
+++ b/nixpkgs/nixos/modules/services/cluster/kubernetes/kubelet.nix
@@ -92,7 +92,7 @@ in
default = [];
example = literalExample ''
[{
- "cniVersion": "0.2.0",
+ "cniVersion": "0.3.1",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
@@ -106,7 +106,7 @@ in
]
}
} {
- "cniVersion": "0.2.0",
+ "cniVersion": "0.3.1",
"type": "loopback"
}]
'';
diff --git a/nixpkgs/nixos/modules/services/cluster/kubernetes/proxy.nix b/nixpkgs/nixos/modules/services/cluster/kubernetes/proxy.nix
index bd4bf04ea83..3943c908840 100644
--- a/nixpkgs/nixos/modules/services/cluster/kubernetes/proxy.nix
+++ b/nixpkgs/nixos/modules/services/cluster/kubernetes/proxy.nix
@@ -31,6 +31,12 @@ in
type = listOf str;
};
+ hostname = mkOption {
+ description = "Kubernetes proxy hostname override.";
+ default = config.networking.hostName;
+ type = str;
+ };
+
kubeconfig = top.lib.mkKubeConfigOptions "Kubernetes proxy";
verbosity = mkOption {
@@ -59,6 +65,7 @@ in
"--cluster-cidr=${top.clusterCidr}"} \
${optionalString (cfg.featureGates != [])
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
+ --hostname-override=${cfg.hostname} \
--kubeconfig=${top.lib.mkKubeConfig "kube-proxy" cfg.kubeconfig} \
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
${cfg.extraOpts}
@@ -69,6 +76,8 @@ in
};
};
+ services.kubernetes.proxy.hostname = with config.networking; mkDefault hostName;
+
services.kubernetes.pki.certs = {
kubeProxyClient = top.lib.mkCert {
name = "kube-proxy-client";
diff --git a/nixpkgs/nixos/modules/services/computing/slurm/slurm.nix b/nixpkgs/nixos/modules/services/computing/slurm/slurm.nix
index d1a1383e45b..c70d999ca96 100644
--- a/nixpkgs/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixpkgs/nixos/modules/services/computing/slurm/slurm.nix
@@ -18,7 +18,7 @@ let
${optionalString (cfg.controlAddr != null) ''controlAddr=${cfg.controlAddr}''}
${toString (map (x: "NodeName=${x}\n") cfg.nodeName)}
${toString (map (x: "PartitionName=${x}\n") cfg.partitionName)}
- PlugStackConfig=${plugStackConfig}
+ PlugStackConfig=${plugStackConfig}/plugstack.conf
ProctrackType=${cfg.procTrackType}
${cfg.extraConfig}
'';
@@ -39,6 +39,8 @@ let
DbdHost=${cfg.dbdserver.dbdHost}
SlurmUser=${cfg.user}
StorageType=accounting_storage/mysql
+ StorageUser=${cfg.dbdserver.storageUser}
+ ${optionalString (cfg.dbdserver.storagePass != null) "StoragePass=${cfg.dbdserver.storagePass}"}
${cfg.dbdserver.extraConfig}
'';
@@ -48,7 +50,6 @@ let
name = "etc-slurm";
paths = [ configFile cgroupConfig plugStackConfig ] ++ cfg.extraConfigPaths;
};
-
in
{
@@ -86,6 +87,37 @@ in
'';
};
+ storageUser = mkOption {
+ type = types.str;
+ default = cfg.user;
+ description = ''
+ Database user name.
+ '';
+ };
+
+ storagePass = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ Database password. Note that this password will be publicable
+ readable in the nix store. Use <option>configFile</option>
+ to store the and config file and password outside the nix store.
+ '';
+ };
+
+ configFile = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ Path to <literal>slurmdbd.conf</literal>. The password for the database connection
+ is stored in the config file. Use this option to specfify a path
+ outside the nix store. If this option is unset a configuration file
+ will be generated. See also:
+ <citerefentry><refentrytitle>slurmdbd.conf</refentrytitle>
+ <manvolnum>8</manvolnum></citerefentry>.
+ '';
+ };
+
extraConfig = mkOption {
type = types.lines;
default = "";
@@ -112,7 +144,7 @@ in
package = mkOption {
type = types.package;
- default = pkgs.slurm;
+ default = pkgs.slurm.override { enableX11 = ! cfg.enableSrunX11; };
defaultText = "pkgs.slurm";
example = literalExample "pkgs.slurm-full";
description = ''
@@ -178,9 +210,14 @@ in
If enabled srun will accept the option "--x11" to allow for X11 forwarding
from within an interactive session or a batch job. This activates the
slurm-spank-x11 module. Note that this option also enables
- 'services.openssh.forwardX11' on the client.
+ <option>services.openssh.forwardX11</option> on the client.
This option requires slurm to be compiled without native X11 support.
+ The default behavior is to re-compile the slurm package with native X11
+ support disabled if this option is set to true.
+
+ To use the native X11 support add <literal>PrologFlags=X11</literal> in <option>extraConfig</option>.
+ Note that this method will only work RSA SSH host keys.
'';
};
@@ -356,7 +393,11 @@ in
requires = [ "munged.service" "mysql.service" ];
# slurm strips the last component off the path
- environment.SLURM_CONF = "${slurmdbdConf}/slurm.conf";
+ environment.SLURM_CONF =
+ if (cfg.dbdserver.configFile == null) then
+ "${slurmdbdConf}/slurm.conf"
+ else
+ cfg.dbdserver.configFile;
serviceConfig = {
Type = "forking";
diff --git a/nixpkgs/nixos/modules/services/continuous-integration/buildkite-agent.nix b/nixpkgs/nixos/modules/services/continuous-integration/buildkite-agent.nix
index 12cc3d2b1cc..32f361454bc 100644
--- a/nixpkgs/nixos/modules/services/continuous-integration/buildkite-agent.nix
+++ b/nixpkgs/nixos/modules/services/continuous-integration/buildkite-agent.nix
@@ -191,6 +191,7 @@ in
createHome = true;
description = "Buildkite agent user";
extraGroups = [ "keys" ];
+ isSystemUser = true;
};
environment.systemPackages = [ cfg.package ];
diff --git a/nixpkgs/nixos/modules/services/continuous-integration/hydra/default.nix b/nixpkgs/nixos/modules/services/continuous-integration/hydra/default.nix
index 2da10a9a5e2..30c5550f71c 100644
--- a/nixpkgs/nixos/modules/services/continuous-integration/hydra/default.nix
+++ b/nixpkgs/nixos/modules/services/continuous-integration/hydra/default.nix
@@ -242,8 +242,8 @@ in
environment.variables = hydraEnv;
nix.extraOptions = ''
- gc-keep-outputs = true
- gc-keep-derivations = true
+ keep-outputs = true
+ keep-derivations = true
# The default (`true') slows Nix down a lot since the build farm
# has so many GC roots.
diff --git a/nixpkgs/nixos/modules/services/databases/mysql.nix b/nixpkgs/nixos/modules/services/databases/mysql.nix
index 39192d05948..5549cfa5cf4 100644
--- a/nixpkgs/nixos/modules/services/databases/mysql.nix
+++ b/nixpkgs/nixos/modules/services/databases/mysql.nix
@@ -8,15 +8,11 @@ let
mysql = cfg.package;
- isMariaDB =
- let
- pName = _p: (builtins.parseDrvName (_p.name)).name;
- in pName mysql == pName pkgs.mariadb;
+ isMariaDB = lib.getName mysql == lib.getName pkgs.mariadb;
+
isMysqlAtLeast57 =
- let
- pName = _p: (builtins.parseDrvName (_p.name)).name;
- in (pName mysql == pName pkgs.mysql57)
- && ((builtins.compareVersions mysql.version "5.7") >= 0);
+ (lib.getName mysql == lib.getName pkgs.mysql57)
+ && (builtins.compareVersions mysql.version "5.7" >= 0);
mysqldOptions =
"--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}";
diff --git a/nixpkgs/nixos/modules/services/databases/redis.nix b/nixpkgs/nixos/modules/services/databases/redis.nix
index 9c389d80a6d..95128a641d9 100644
--- a/nixpkgs/nixos/modules/services/databases/redis.nix
+++ b/nixpkgs/nixos/modules/services/databases/redis.nix
@@ -185,27 +185,22 @@ in
###### implementation
config = mkIf config.services.redis.enable {
-
- boot.kernel.sysctl = mkIf cfg.vmOverCommit {
- "vm.overcommit_memory" = "1";
- };
+ boot.kernel.sysctl = (mkMerge [
+ { "vm.nr_hugepages" = "0"; }
+ ( mkIf cfg.vmOverCommit { "vm.overcommit_memory" = "1"; } )
+ ]);
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
};
- users.users.redis.description = "Redis database user";
+ users.users.redis = {
+ description = "Redis database user";
+ isSystemUser = true;
+ };
environment.systemPackages = [ cfg.package ];
- systemd.services.disable-transparent-huge-pages = {
- description = "Disable Transparent Huge Pages (required by Redis)";
- before = [ "redis.service" ];
- wantedBy = [ "redis.service" ];
- script = "echo never > /sys/kernel/mm/transparent_hugepage/enabled";
- serviceConfig.Type = "oneshot";
- };
-
systemd.services.redis =
{ description = "Redis Server";
diff --git a/nixpkgs/nixos/modules/services/databases/rethinkdb.nix b/nixpkgs/nixos/modules/services/databases/rethinkdb.nix
index 4828e594b32..f18fbaf5b06 100644
--- a/nixpkgs/nixos/modules/services/databases/rethinkdb.nix
+++ b/nixpkgs/nixos/modules/services/databases/rethinkdb.nix
@@ -99,6 +99,7 @@ in
users.users.rethinkdb = mkIf (cfg.user == "rethinkdb")
{ name = "rethinkdb";
description = "RethinkDB server user";
+ isSystemUser = true;
};
users.groups = optionalAttrs (cfg.group == "rethinkdb") (singleton
diff --git a/nixpkgs/nixos/modules/services/desktops/geoclue2.nix b/nixpkgs/nixos/modules/services/desktops/geoclue2.nix
index 6007dddf50c..542b2ead410 100644
--- a/nixpkgs/nixos/modules/services/desktops/geoclue2.nix
+++ b/nixpkgs/nixos/modules/services/desktops/geoclue2.nix
@@ -188,34 +188,41 @@ in
systemd.packages = [ package ];
- users.users.geoclue = {
- isSystemUser = true;
- home = "/var/lib/geoclue";
- group = "geoclue";
- description = "Geoinformation service";
- };
-
- users.groups.geoclue = {};
+ # we cannot use DynamicUser as we need the the geoclue user to exist for the dbus policy to work
+ users = {
+ users.geoclue = {
+ isSystemUser = true;
+ home = "/var/lib/geoclue";
+ group = "geoclue";
+ description = "Geoinformation service";
+ };
- systemd.tmpfiles.rules = [
- "d /var/lib/geoclue 0755 geoclue geoclue"
- ];
+ groups.geoclue = {};
+ };
- # restart geoclue service when the configuration changes
- systemd.services.geoclue.restartTriggers = [
- config.environment.etc."geoclue/geoclue.conf".source
- ];
+ systemd.services.geoclue = {
+ # restart geoclue service when the configuration changes
+ restartTriggers = [
+ config.environment.etc."geoclue/geoclue.conf".source
+ ];
+ serviceConfig.StateDirectory = "geoclue";
+ };
# this needs to run as a user service, since it's associated with the
# user who is making the requests
systemd.user.services = mkIf cfg.enableDemoAgent {
geoclue-agent = {
description = "Geoclue agent";
- script = "${package}/libexec/geoclue-2.0/demos/agent";
# this should really be `partOf = [ "geoclue.service" ]`, but
# we can't be part of a system service, and the agent should
# be okay with the main service coming and going
wantedBy = [ "default.target" ];
+ serviceConfig = {
+ Type = "exec";
+ ExecStart = "${package}/libexec/geoclue-2.0/demos/agent";
+ Restart = "on-failure";
+ PrivateTmp = true;
+ };
};
};
@@ -256,4 +263,6 @@ in
};
} // mapAttrs' appConfigToINICompatible cfg.appConfig);
};
+
+ meta.maintainers = with lib.maintainers; [ worldofpeace ];
}
diff --git a/nixpkgs/nixos/modules/services/desktops/neard.nix b/nixpkgs/nixos/modules/services/desktops/neard.nix
new file mode 100644
index 00000000000..9b0f8d1b3a7
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/desktops/neard.nix
@@ -0,0 +1,23 @@
+# neard service.
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ ###### interface
+ options = {
+ services.neard = {
+ enable = mkEnableOption "neard, NFC daemon";
+ };
+ };
+
+
+ ###### implementation
+ config = mkIf config.services.neard.enable {
+ environment.systemPackages = [ pkgs.neard ];
+
+ services.dbus.packages = [ pkgs.neard ];
+
+ systemd.packages = [ pkgs.neard ];
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/desktops/system-config-printer.nix b/nixpkgs/nixos/modules/services/desktops/system-config-printer.nix
index 8a80be266b2..09c68c587b4 100644
--- a/nixpkgs/nixos/modules/services/desktops/system-config-printer.nix
+++ b/nixpkgs/nixos/modules/services/desktops/system-config-printer.nix
@@ -33,6 +33,9 @@ with lib;
pkgs.system-config-printer
];
+ # for $out/bin/install-printer-driver
+ services.packagekit.enable = true;
+
};
}
diff --git a/nixpkgs/nixos/modules/services/desktops/tumbler.nix b/nixpkgs/nixos/modules/services/desktops/tumbler.nix
index d18088d4634..a833e99ff8c 100644
--- a/nixpkgs/nixos/modules/services/desktops/tumbler.nix
+++ b/nixpkgs/nixos/modules/services/desktops/tumbler.nix
@@ -7,12 +7,17 @@ with lib;
let
cfg = config.services.tumbler;
- tumbler = cfg.package;
in
{
+ imports = [
+ (mkRemovedOptionModule
+ [ "services" "tumbler" "package" ]
+ "")
+ ];
+
###### interface
options = {
@@ -21,13 +26,6 @@ in
enable = mkEnableOption "Tumbler, A D-Bus thumbnailer service";
- package = mkOption {
- type = types.package;
- default = pkgs.xfce4-14.tumbler;
- description = "Which tumbler package to use";
- example = pkgs.xfce4-12.tumbler;
- };
-
};
};
@@ -37,11 +35,11 @@ in
config = mkIf cfg.enable {
- environment.systemPackages = [
+ environment.systemPackages = with pkgs.xfce; [
tumbler
];
- services.dbus.packages = [
+ services.dbus.packages = with pkgs.xfce; [
tumbler
];
diff --git a/nixpkgs/nixos/modules/services/development/lorri.nix b/nixpkgs/nixos/modules/services/development/lorri.nix
new file mode 100644
index 00000000000..68264ee869d
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/development/lorri.nix
@@ -0,0 +1,47 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.services.lorri;
+ socketPath = "lorri/daemon.socket";
+in {
+ options = {
+ services.lorri = {
+ enable = lib.mkOption {
+ default = false;
+ type = lib.types.bool;
+ description = ''
+ Enables the daemon for `lorri`, a nix-shell replacement for project
+ development. The socket-activated daemon starts on the first request
+ issued by the `lorri` command.
+ '';
+ };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ systemd.user.sockets.lorri = {
+ description = "Socket for Lorri Daemon";
+ wantedBy = [ "sockets.target" ];
+ socketConfig = {
+ ListenStream = "%t/${socketPath}";
+ RuntimeDirectory = "lorri";
+ };
+ };
+
+ systemd.user.services.lorri = {
+ description = "Lorri Daemon";
+ requires = [ "lorri.socket" ];
+ after = [ "lorri.socket" ];
+ path = with pkgs; [ config.nix.package gnutar gzip ];
+ serviceConfig = {
+ ExecStart = "${pkgs.lorri}/bin/lorri daemon";
+ PrivateTmp = true;
+ ProtectSystem = "strict";
+ ProtectHome = "read-only";
+ Restart = "on-failure";
+ };
+ };
+
+ environment.systemPackages = [ pkgs.lorri ];
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/editors/infinoted.nix b/nixpkgs/nixos/modules/services/editors/infinoted.nix
index 9cc8d421270..be366761694 100644
--- a/nixpkgs/nixos/modules/services/editors/infinoted.nix
+++ b/nixpkgs/nixos/modules/services/editors/infinoted.nix
@@ -115,6 +115,7 @@ in {
{ name = "infinoted";
description = "Infinoted user";
group = cfg.group;
+ isSystemUser = true;
};
users.groups = optional (cfg.group == "infinoted")
{ name = "infinoted";
diff --git a/nixpkgs/nixos/modules/services/games/openarena.nix b/nixpkgs/nixos/modules/services/games/openarena.nix
new file mode 100644
index 00000000000..8c014d78809
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/games/openarena.nix
@@ -0,0 +1,56 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.openarena;
+in
+{
+ options = {
+ services.openarena = {
+ enable = mkEnableOption "OpenArena";
+
+ openPorts = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to open firewall ports for OpenArena";
+ };
+
+ extraFlags = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''Extra flags to pass to <command>oa_ded</command>'';
+ example = [
+ "+set dedicated 2"
+ "+set sv_hostname 'My NixOS OpenArena Server'"
+ # Load a map. Mandatory for clients to be able to connect.
+ "+map oa_dm1"
+ ];
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ networking.firewall = mkIf cfg.openPorts {
+ allowedUDPPorts = [ 27960 ];
+ };
+
+ systemd.services.openarena = {
+ description = "OpenArena";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ serviceConfig = {
+ DynamicUser = true;
+ StateDirectory = "openarena";
+ ExecStart = "${pkgs.openarena}/bin/oa_ded +set fs_basepath ${pkgs.openarena}/openarena-0.8.8 +set fs_homepath /var/lib/openarena ${concatStringsSep " " cfg.extraFlags}";
+ Restart = "on-failure";
+
+ # Hardening
+ CapabilityBoundingSet = "";
+ NoNewPrivileges = true;
+ PrivateDevices = true;
+ };
+ };
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/hardware/bluetooth.nix b/nixpkgs/nixos/modules/services/hardware/bluetooth.nix
index c5f9d1f9b72..7b13beea1ca 100644
--- a/nixpkgs/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixpkgs/nixos/modules/services/hardware/bluetooth.nix
@@ -36,17 +36,25 @@ in {
'';
};
+ config = mkOption {
+ type = with types; attrsOf (attrsOf (oneOf [ bool int str ]));
+ example = {
+ General = {
+ ControllerMode = "bredr";
+ };
+ };
+ description = "Set configuration for system-wide bluetooth (/etc/bluetooth/main.conf).";
+ };
+
extraConfig = mkOption {
- type = types.lines;
- default = "";
+ type = with types; nullOr lines;
+ default = null;
example = ''
[General]
ControllerMode = bredr
'';
description = ''
Set additional configuration for system-wide bluetooth (/etc/bluetooth/main.conf).
-
- NOTE: We already include [Policy], so any configuration under the Policy group should come first.
'';
};
};
@@ -56,16 +64,18 @@ in {
###### implementation
config = mkIf cfg.enable {
+ warnings = optional (cfg.extraConfig != null) "hardware.bluetooth.`extraConfig` is deprecated, please use hardware.bluetooth.`config`.";
+
+ hardware.bluetooth.config = {
+ Policy = {
+ AutoEnable = mkDefault cfg.powerOnBoot;
+ };
+ };
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
environment.etc = singleton {
- source = pkgs.writeText "main.conf" ''
- [Policy]
- AutoEnable=${lib.boolToString cfg.powerOnBoot}
-
- ${cfg.extraConfig}
- '';
+ source = pkgs.writeText "main.conf" (generators.toINI { } cfg.config + optionalString (cfg.extraConfig != null) cfg.extraConfig);
target = "bluetooth/main.conf";
};
diff --git a/nixpkgs/nixos/modules/services/hardware/fancontrol.nix b/nixpkgs/nixos/modules/services/hardware/fancontrol.nix
index 616e4add31e..bb4541a784d 100644
--- a/nixpkgs/nixos/modules/services/hardware/fancontrol.nix
+++ b/nixpkgs/nixos/modules/services/hardware/fancontrol.nix
@@ -4,42 +4,41 @@ with lib;
let
cfg = config.hardware.fancontrol;
- configFile = pkgs.writeText "fan.conf" cfg.config;
-
-in {
+ configFile = pkgs.writeText "fancontrol.conf" cfg.config;
+in{
options.hardware.fancontrol = {
- enable = mkEnableOption "fancontrol (requires fancontrol.config)";
+ enable = mkEnableOption "software fan control (requires fancontrol.config)";
config = mkOption {
- type = types.lines;
default = null;
+ type = types.lines;
+ description = "Fancontrol configuration file content. See <citerefentry><refentrytitle>pwmconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry> from the lm_sensors package.";
example = ''
# Configuration file generated by pwmconfig
- INTERVAL=1
- DEVPATH=hwmon0=devices/platform/nct6775.656 hwmon1=devices/pci0000:00/0000:00:18.3
- DEVNAME=hwmon0=nct6779 hwmon1=k10temp
- FCTEMPS=hwmon0/pwm2=hwmon1/temp1_input
- FCFANS=hwmon0/pwm2=hwmon0/fan2_input
- MINTEMP=hwmon0/pwm2=25
- MAXTEMP=hwmon0/pwm2=60
- MINSTART=hwmon0/pwm2=25
- MINSTOP=hwmon0/pwm2=10
- MINPWM=hwmon0/pwm2=0
- MAXPWM=hwmon0/pwm2=255
+ INTERVAL=10
+ DEVPATH=hwmon3=devices/virtual/thermal/thermal_zone2 hwmon4=devices/platform/f71882fg.656
+ DEVNAME=hwmon3=soc_dts1 hwmon4=f71869a
+ FCTEMPS=hwmon4/device/pwm1=hwmon3/temp1_input
+ FCFANS= hwmon4/device/pwm1=hwmon4/device/fan1_input
+ MINTEMP=hwmon4/device/pwm1=35
+ MAXTEMP=hwmon4/device/pwm1=65
+ MINSTART=hwmon4/device/pwm1=150
+ MINSTOP=hwmon4/device/pwm1=0
'';
- description = "Contents for configuration file. See <citerefentry><refentrytitle>pwmconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry>.";
};
};
-
config = mkIf cfg.enable {
systemd.services.fancontrol = {
- description = "Fan speed control from lm_sensors";
+ unitConfig.Documentation = "man:fancontrol(8)";
+ description = "software fan control";
wantedBy = [ "multi-user.target" ];
+ after = [ "lm_sensors.service" ];
+
serviceConfig = {
Type = "simple";
- ExecStart = "${pkgs.lm_sensors}/bin/fancontrol ${configFile}";
+ ExecStart = "${pkgs.lm_sensors}/sbin/fancontrol ${configFile}";
};
};
};
diff --git a/nixpkgs/nixos/modules/services/hardware/fwupd.nix b/nixpkgs/nixos/modules/services/hardware/fwupd.nix
index 6c341bcbf24..51877970a8b 100644
--- a/nixpkgs/nixos/modules/services/hardware/fwupd.nix
+++ b/nixpkgs/nixos/modules/services/hardware/fwupd.nix
@@ -74,7 +74,7 @@ in {
default = false;
description = ''
Whether to enable test remote. This is used by
- <link xlink:href="https://github.com/hughsie/fwupd/blob/master/data/installed-tests/README.md">installed tests</link>.
+ <link xlink:href="https://github.com/fwupd/fwupd/blob/master/data/installed-tests/README.md">installed tests</link>.
'';
};
@@ -115,10 +115,6 @@ in {
services.udev.packages = [ cfg.package ];
systemd.packages = [ cfg.package ];
-
- systemd.tmpfiles.rules = [
- "d /var/lib/fwupd 0755 root root -"
- ];
};
meta = {
diff --git a/nixpkgs/nixos/modules/services/hardware/tlp.nix b/nixpkgs/nixos/modules/services/hardware/tlp.nix
index 4f8af797828..adc1881a525 100644
--- a/nixpkgs/nixos/modules/services/hardware/tlp.nix
+++ b/nixpkgs/nixos/modules/services/hardware/tlp.nix
@@ -37,7 +37,7 @@ in
enable = mkOption {
type = types.bool;
default = false;
- description = "Whether to enable the TLP daemon.";
+ description = "Whether to enable the TLP power management daemon.";
};
extraConfig = mkOption {
diff --git a/nixpkgs/nixos/modules/services/hardware/trezord.nix b/nixpkgs/nixos/modules/services/hardware/trezord.nix
index 62824ed7350..c517e9fbb2b 100644
--- a/nixpkgs/nixos/modules/services/hardware/trezord.nix
+++ b/nixpkgs/nixos/modules/services/hardware/trezord.nix
@@ -44,20 +44,7 @@ in {
### 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 = ''
- # TREZOR v1 (One)
- SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0660", GROUP="trezord", TAG+="uaccess", SYMLINK+="trezor%n"
- KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0660", GROUP="trezord", TAG+="uaccess"
-
- # TREZOR v2 (T)
- SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c0", MODE="0660", GROUP="trezord", TAG+="uaccess", SYMLINK+="trezor%n"
- SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c1", MODE="0660", GROUP="trezord", TAG+="uaccess", SYMLINK+="trezor%n"
- KERNEL=="hidraw*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="53c1", MODE="0660", GROUP="trezord", TAG+="uaccess"
- '';
- });
+ services.udev.packages = [ pkgs.trezor-udev-rules ];
systemd.services.trezord = {
description = "TREZOR Bridge";
@@ -74,6 +61,7 @@ in {
users.users.trezord = {
group = "trezord";
description = "Trezor bridge daemon user";
+ isSystemUser = true;
};
users.groups.trezord = {};
diff --git a/nixpkgs/nixos/modules/services/hardware/udisks2.nix b/nixpkgs/nixos/modules/services/hardware/udisks2.nix
index ed8703be921..e898f326058 100644
--- a/nixpkgs/nixos/modules/services/hardware/udisks2.nix
+++ b/nixpkgs/nixos/modules/services/hardware/udisks2.nix
@@ -34,10 +34,7 @@ with lib;
services.dbus.packages = [ pkgs.udisks2 ];
- system.activationScripts.udisks2 =
- ''
- mkdir -m 0755 -p /var/lib/udisks2
- '';
+ systemd.tmpfiles.rules = [ "d /var/lib/udisks2 0755 root root -" ];
services.udev.packages = [ pkgs.udisks2 ];
diff --git a/nixpkgs/nixos/modules/services/hardware/usbmuxd.nix b/nixpkgs/nixos/modules/services/hardware/usbmuxd.nix
index 93ced0b9f04..39bbcaf4627 100644
--- a/nixpkgs/nixos/modules/services/hardware/usbmuxd.nix
+++ b/nixpkgs/nixos/modules/services/hardware/usbmuxd.nix
@@ -47,6 +47,7 @@ in
name = cfg.user;
description = "usbmuxd user";
group = cfg.group;
+ isSystemUser = true;
};
users.groups = optional (cfg.group == defaultUserGroup) {
diff --git a/nixpkgs/nixos/modules/services/hardware/vdr.nix b/nixpkgs/nixos/modules/services/hardware/vdr.nix
index 6e246f70f51..8a6cde51b06 100644
--- a/nixpkgs/nixos/modules/services/hardware/vdr.nix
+++ b/nixpkgs/nixos/modules/services/hardware/vdr.nix
@@ -66,6 +66,7 @@ in {
users.users.vdr = {
group = "vdr";
home = libDir;
+ isSystemUser = true;
};
users.groups.vdr = {};
diff --git a/nixpkgs/nixos/modules/services/mail/mailcatcher.nix b/nixpkgs/nixos/modules/services/mail/mailcatcher.nix
index f5b4508b335..84f06ed199d 100644
--- a/nixpkgs/nixos/modules/services/mail/mailcatcher.nix
+++ b/nixpkgs/nixos/modules/services/mail/mailcatcher.nix
@@ -25,6 +25,13 @@ in
description = "The port address of the http server.";
};
+ http.path = mkOption {
+ type = with types; nullOr str;
+ default = null;
+ description = "Prefix to all HTTP paths.";
+ example = "/mailcatcher";
+ };
+
smtp.ip = mkOption {
type = types.str;
default = "127.0.0.1";
@@ -53,7 +60,7 @@ in
serviceConfig = {
DynamicUser = true;
Restart = "always";
- ExecStart = "${pkgs.mailcatcher}/bin/mailcatcher --foreground --no-quit --http-ip ${cfg.http.ip} --http-port ${toString cfg.http.port} --smtp-ip ${cfg.smtp.ip} --smtp-port ${toString cfg.smtp.port}";
+ ExecStart = "${pkgs.mailcatcher}/bin/mailcatcher --foreground --no-quit --http-ip ${cfg.http.ip} --http-port ${toString cfg.http.port} --smtp-ip ${cfg.smtp.ip} --smtp-port ${toString cfg.smtp.port}" + optionalString (cfg.http.path != null) " --http-path ${cfg.http.path}";
AmbientCapabilities = optionalString (cfg.http.port < 1024 || cfg.smtp.port < 1024) "cap_net_bind_service";
};
};
diff --git a/nixpkgs/nixos/modules/services/mail/mailhog.nix b/nixpkgs/nixos/modules/services/mail/mailhog.nix
index b78f4c8e0e6..0f998c6d0ea 100644
--- a/nixpkgs/nixos/modules/services/mail/mailhog.nix
+++ b/nixpkgs/nixos/modules/services/mail/mailhog.nix
@@ -27,6 +27,7 @@ in {
users.users.mailhog = {
name = cfg.user;
description = "MailHog service user";
+ isSystemUser = true;
};
systemd.services.mailhog = {
diff --git a/nixpkgs/nixos/modules/services/mail/opensmtpd.nix b/nixpkgs/nixos/modules/services/mail/opensmtpd.nix
index a870550ba50..1fabe2da45c 100644
--- a/nixpkgs/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixpkgs/nixos/modules/services/mail/opensmtpd.nix
@@ -101,6 +101,12 @@ in {
};
};
+ systemd.tmpfiles.rules = [
+ "d /var/spool/smtpd 711 root - - -"
+ "d /var/spool/smtpd/offline 770 root smtpq - -"
+ "d /var/spool/smtpd/purge 700 smtpq root - -"
+ ];
+
systemd.services.opensmtpd = let
procEnv = pkgs.buildEnv {
name = "opensmtpd-procs";
@@ -110,18 +116,6 @@ in {
in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
- preStart = ''
- mkdir -p /var/spool/smtpd
- chmod 711 /var/spool/smtpd
-
- mkdir -p /var/spool/smtpd/offline
- chown root.smtpq /var/spool/smtpd/offline
- chmod 770 /var/spool/smtpd/offline
-
- mkdir -p /var/spool/smtpd/purge
- chown smtpq.root /var/spool/smtpd/purge
- chmod 700 /var/spool/smtpd/purge
- '';
serviceConfig.ExecStart = "${cfg.package}/sbin/smtpd -d -f ${conf} ${args}";
environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
};
diff --git a/nixpkgs/nixos/modules/services/mail/postfix.nix b/nixpkgs/nixos/modules/services/mail/postfix.nix
index d5fd76da970..df438a0c69d 100644
--- a/nixpkgs/nixos/modules/services/mail/postfix.nix
+++ b/nixpkgs/nixos/modules/services/mail/postfix.nix
@@ -631,6 +631,14 @@ in
setgid = true;
};
+ security.wrappers.mailq = {
+ program = "mailq";
+ source = "${pkgs.postfix}/bin/mailq";
+ group = setgidGroup;
+ setuid = false;
+ setgid = true;
+ };
+
security.wrappers.postqueue = {
program = "postqueue";
source = "${pkgs.postfix}/bin/postqueue";
diff --git a/nixpkgs/nixos/modules/services/mail/roundcube.nix b/nixpkgs/nixos/modules/services/mail/roundcube.nix
index bdedfa1bb70..36dda619ad0 100644
--- a/nixpkgs/nixos/modules/services/mail/roundcube.nix
+++ b/nixpkgs/nixos/modules/services/mail/roundcube.nix
@@ -160,7 +160,7 @@ in
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create role ${cfg.database.username} with login password '${cfg.database.password}'";
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
fi
- PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
+ PGPASSWORD="${cfg.database.password}" ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
-f ${cfg.package}/SQL/postgres.initial.sql \
-h ${cfg.database.host} ${cfg.database.dbname}
touch /var/lib/roundcube/db-created
diff --git a/nixpkgs/nixos/modules/services/mail/rspamd.nix b/nixpkgs/nixos/modules/services/mail/rspamd.nix
index 4db35d9e89a..7ef23ad1726 100644
--- a/nixpkgs/nixos/modules/services/mail/rspamd.nix
+++ b/nixpkgs/nixos/modules/services/mail/rspamd.nix
@@ -60,7 +60,7 @@ let
};
type = mkOption {
type = types.nullOr (types.enum [
- "normal" "controller" "fuzzy_storage" "rspamd_proxy" "lua" "proxy"
+ "normal" "controller" "fuzzy" "rspamd_proxy" "lua" "proxy"
]);
description = ''
The type of this worker. The type <literal>proxy</literal> is
diff --git a/nixpkgs/nixos/modules/services/misc/airsonic.nix b/nixpkgs/nixos/modules/services/misc/airsonic.nix
index 919d3b2f6e6..c296e048cea 100644
--- a/nixpkgs/nixos/modules/services/misc/airsonic.nix
+++ b/nixpkgs/nixos/modules/services/misc/airsonic.nix
@@ -148,6 +148,7 @@ in {
name = cfg.user;
home = cfg.home;
createHome = true;
+ isSystemUser = true;
};
};
}
diff --git a/nixpkgs/nixos/modules/services/misc/beanstalkd.nix b/nixpkgs/nixos/modules/services/misc/beanstalkd.nix
index 06e881406b5..bcd133c9741 100644
--- a/nixpkgs/nixos/modules/services/misc/beanstalkd.nix
+++ b/nixpkgs/nixos/modules/services/misc/beanstalkd.nix
@@ -44,7 +44,8 @@ in
serviceConfig = {
DynamicUser = true;
Restart = "always";
- ExecStart = "${pkg}/bin/beanstalkd -l ${cfg.listen.address} -p ${toString cfg.listen.port}";
+ ExecStart = "${pkg}/bin/beanstalkd -l ${cfg.listen.address} -p ${toString cfg.listen.port} -b $STATE_DIRECTORY";
+ StateDirectory = "beanstalkd";
};
};
diff --git a/nixpkgs/nixos/modules/services/misc/docker-registry.nix b/nixpkgs/nixos/modules/services/misc/docker-registry.nix
index c87607d2666..89bac4f47d7 100644
--- a/nixpkgs/nixos/modules/services/misc/docker-registry.nix
+++ b/nixpkgs/nixos/modules/services/misc/docker-registry.nix
@@ -145,11 +145,13 @@ in {
};
users.users.docker-registry =
- if cfg.storagePath != null
+ (if cfg.storagePath != null
then {
createHome = true;
home = cfg.storagePath;
}
- else {};
+ else {}) // {
+ isSystemUser = true;
+ };
};
}
diff --git a/nixpkgs/nixos/modules/services/misc/errbot.nix b/nixpkgs/nixos/modules/services/misc/errbot.nix
index 256adce2f02..b447ba5d438 100644
--- a/nixpkgs/nixos/modules/services/misc/errbot.nix
+++ b/nixpkgs/nixos/modules/services/misc/errbot.nix
@@ -76,7 +76,10 @@ in {
};
config = mkIf (cfg.instances != {}) {
- users.users.errbot.group = "errbot";
+ users.users.errbot = {
+ group = "errbot";
+ isSystemUser = true;
+ };
users.groups.errbot = {};
systemd.services = mapAttrs' (name: instanceCfg: nameValuePair "errbot-${name}" (
diff --git a/nixpkgs/nixos/modules/services/misc/gitea.nix b/nixpkgs/nixos/modules/services/misc/gitea.nix
index 4992b13c9d4..c8c59fb256e 100644
--- a/nixpkgs/nixos/modules/services/misc/gitea.nix
+++ b/nixpkgs/nixos/modules/services/misc/gitea.nix
@@ -409,6 +409,7 @@ in
home = cfg.stateDir;
useDefaultShell = true;
group = "gitea";
+ isSystemUser = true;
};
};
diff --git a/nixpkgs/nixos/modules/services/misc/gitlab.nix b/nixpkgs/nixos/modules/services/misc/gitlab.nix
index 34be9d69a46..07ea9c45843 100644
--- a/nixpkgs/nixos/modules/services/misc/gitlab.nix
+++ b/nixpkgs/nixos/modules/services/misc/gitlab.nix
@@ -608,6 +608,8 @@ in {
# objects owners and extensions; for now we tack on what's needed
# here.
systemd.services.postgresql.postStart = mkAfter (optionalString databaseActuallyCreateLocally ''
+ set -eu
+
$PSQL -tAc "SELECT 1 FROM pg_database WHERE datname = '${cfg.databaseName}'" | grep -q 1 || $PSQL -tAc 'CREATE DATABASE "${cfg.databaseName}" OWNER "${cfg.databaseUsername}"'
current_owner=$($PSQL -tAc "SELECT pg_catalog.pg_get_userbyid(datdba) FROM pg_catalog.pg_database WHERE datname = '${cfg.databaseName}'")
if [[ "$current_owner" != "${cfg.databaseUsername}" ]]; then
@@ -666,7 +668,6 @@ in {
"d ${gitlabConfig.production.shared.path}/artifacts 0750 ${cfg.user} ${cfg.group} -"
"d ${gitlabConfig.production.shared.path}/lfs-objects 0750 ${cfg.user} ${cfg.group} -"
"d ${gitlabConfig.production.shared.path}/pages 0750 ${cfg.user} ${cfg.group} -"
- "L+ ${cfg.statePath}/lib - - - - ${cfg.packages.gitlab}/share/gitlab/lib"
"L+ /run/gitlab/config - - - - ${cfg.statePath}/config"
"L+ /run/gitlab/log - - - - ${cfg.statePath}/log"
"L+ /run/gitlab/tmp - - - - ${cfg.statePath}/tmp"
@@ -740,7 +741,6 @@ in {
gitlab-workhorse
];
serviceConfig = {
- PermissionsStartOnly = true; # preStart must be run as root
Type = "simple";
User = cfg.user;
Group = cfg.group;
@@ -782,13 +782,18 @@ in {
ExecStartPre = let
preStartFullPrivileges = ''
shopt -s dotglob nullglob
+ set -eu
+
chown --no-dereference '${cfg.user}':'${cfg.group}' '${cfg.statePath}'/*
chown --no-dereference '${cfg.user}':'${cfg.group}' '${cfg.statePath}'/config/*
'';
preStart = ''
+ set -eu
+
cp -f ${cfg.packages.gitlab}/share/gitlab/VERSION ${cfg.statePath}/VERSION
rm -rf ${cfg.statePath}/db/*
rm -rf ${cfg.statePath}/config/initializers/*
+ rm -f ${cfg.statePath}/lib
cp -rf --no-preserve=mode ${cfg.packages.gitlab}/share/gitlab/config.dist/* ${cfg.statePath}/config
cp -rf --no-preserve=mode ${cfg.packages.gitlab}/share/gitlab/db/* ${cfg.statePath}/db
diff --git a/nixpkgs/nixos/modules/services/misc/gollum.nix b/nixpkgs/nixos/modules/services/misc/gollum.nix
index 7653b415bf0..f4a9c72b154 100644
--- a/nixpkgs/nixos/modules/services/misc/gollum.nix
+++ b/nixpkgs/nixos/modules/services/misc/gollum.nix
@@ -71,6 +71,7 @@ in
group = config.users.users.gollum.name;
description = "Gollum user";
createHome = false;
+ isSystemUser = true;
};
users.groups.gollum = { };
diff --git a/nixpkgs/nixos/modules/services/misc/jellyfin.nix b/nixpkgs/nixos/modules/services/misc/jellyfin.nix
index 55559206568..6ecdfb57dc3 100644
--- a/nixpkgs/nixos/modules/services/misc/jellyfin.nix
+++ b/nixpkgs/nixos/modules/services/misc/jellyfin.nix
@@ -41,7 +41,10 @@ in
};
users.users = mkIf (cfg.user == "jellyfin") {
- jellyfin.group = cfg.group;
+ jellyfin = {
+ group = cfg.group;
+ isSystemUser = true;
+ };
};
users.groups = mkIf (cfg.group == "jellyfin") {
diff --git a/nixpkgs/nixos/modules/services/misc/lidarr.nix b/nixpkgs/nixos/modules/services/misc/lidarr.nix
index 40755c16217..8ff1adadcf2 100644
--- a/nixpkgs/nixos/modules/services/misc/lidarr.nix
+++ b/nixpkgs/nixos/modules/services/misc/lidarr.nix
@@ -10,6 +10,12 @@ in
services.lidarr = {
enable = mkEnableOption "Lidarr";
+ dataDir = mkOption {
+ type = types.str;
+ default = "/var/lib/lidarr/.config/Lidarr";
+ description = "The directory where Lidarr stores its data files.";
+ };
+
package = mkOption {
type = types.package;
default = pkgs.lidarr;
@@ -44,6 +50,10 @@ in
};
config = mkIf cfg.enable {
+ systemd.tmpfiles.rules = [
+ "d '${cfg.dataDir}' 0700 ${cfg.user} ${cfg.group} - -"
+ ];
+
systemd.services.lidarr = {
description = "Lidarr";
after = [ "network.target" ];
@@ -53,11 +63,8 @@ in
Type = "simple";
User = cfg.user;
Group = cfg.group;
- ExecStart = "${cfg.package}/bin/Lidarr";
+ ExecStart = "${cfg.package}/bin/Lidarr -nobrowser -data='${cfg.dataDir}'";
Restart = "on-failure";
-
- StateDirectory = "lidarr";
- StateDirectoryMode = "0770";
};
};
diff --git a/nixpkgs/nixos/modules/services/misc/matrix-synapse.nix b/nixpkgs/nixos/modules/services/misc/matrix-synapse.nix
index 0f4eb2ccfca..50661b873f6 100644
--- a/nixpkgs/nixos/modules/services/misc/matrix-synapse.nix
+++ b/nixpkgs/nixos/modules/services/misc/matrix-synapse.nix
@@ -407,6 +407,9 @@ in {
"192.168.0.0/16"
"100.64.0.0/10"
"169.254.0.0/16"
+ "::1/128"
+ "fe80::/64"
+ "fc00::/7"
];
description = ''
List of IP address CIDR ranges that the URL preview spider is denied
diff --git a/nixpkgs/nixos/modules/services/misc/nix-daemon.nix b/nixpkgs/nixos/modules/services/misc/nix-daemon.nix
index ff4e4f5b97d..dcec4d4fc6c 100644
--- a/nixpkgs/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixpkgs/nixos/modules/services/misc/nix-daemon.nix
@@ -61,7 +61,7 @@ let
'' else ''
echo "Checking that Nix can read nix.conf..."
ln -s $out ./nix.conf
- NIX_CONF_DIR=$PWD ${cfg.package}/bin/nix show-config ${optionalString isNix23 "--no-net"} >/dev/null
+ NIX_CONF_DIR=$PWD ${cfg.package}/bin/nix show-config ${optionalString isNix23 "--no-net --option experimental-features nix-command"} >/dev/null
'')
);
@@ -152,8 +152,8 @@ in
type = types.lines;
default = "";
example = ''
- gc-keep-outputs = true
- gc-keep-derivations = true
+ keep-outputs = true
+ keep-derivations = true
'';
description = "Additional text appended to <filename>nix.conf</filename>.";
};
diff --git a/nixpkgs/nixos/modules/services/misc/osrm.nix b/nixpkgs/nixos/modules/services/misc/osrm.nix
index f89f37ccd9d..79c347ab7e0 100644
--- a/nixpkgs/nixos/modules/services/misc/osrm.nix
+++ b/nixpkgs/nixos/modules/services/misc/osrm.nix
@@ -59,6 +59,7 @@ in
group = config.users.users.osrm.name;
description = "OSRM user";
createHome = false;
+ isSystemUser = true;
};
users.groups.osrm = { };
diff --git a/nixpkgs/nixos/modules/services/misc/redmine.nix b/nixpkgs/nixos/modules/services/misc/redmine.nix
index 24b9e27ac2d..bf9a6914a48 100644
--- a/nixpkgs/nixos/modules/services/misc/redmine.nix
+++ b/nixpkgs/nixos/modules/services/misc/redmine.nix
@@ -62,20 +62,11 @@ in
services.redmine = {
enable = mkEnableOption "Redmine";
- # default to the 4.x series not forcing major version upgrade of those on the 3.x series
package = mkOption {
type = types.package;
- default = if versionAtLeast config.system.stateVersion "19.03"
- then pkgs.redmine_4
- else pkgs.redmine
- ;
- defaultText = "pkgs.redmine";
- description = ''
- Which Redmine package to use. This defaults to version 3.x if
- <literal>system.stateVersion &lt; 19.03</literal> and version 4.x
- otherwise.
- '';
- example = "pkgs.redmine_4.override { ruby = pkgs.ruby_2_4; }";
+ default = pkgs.redmine;
+ description = "Which Redmine package to use.";
+ example = "pkgs.redmine.override { ruby = pkgs.ruby_2_4; }";
};
user = mkOption {
diff --git a/nixpkgs/nixos/modules/services/misc/zoneminder.nix b/nixpkgs/nixos/modules/services/misc/zoneminder.nix
index 3bff04e7127..d7f7324580c 100644
--- a/nixpkgs/nixos/modules/services/misc/zoneminder.nix
+++ b/nixpkgs/nixos/modules/services/misc/zoneminder.nix
@@ -265,7 +265,7 @@ in {
}
location /cache/ {
- alias /var/cache/${dirName};
+ alias /var/cache/${dirName}/;
}
location ~ \.php$ {
diff --git a/nixpkgs/nixos/modules/services/monitoring/collectd.nix b/nixpkgs/nixos/modules/services/monitoring/collectd.nix
index 6a4c678eb21..731ac743b7c 100644
--- a/nixpkgs/nixos/modules/services/monitoring/collectd.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/collectd.nix
@@ -16,13 +16,29 @@ let
NotifyLevel "OKAY"
</Plugin>
+ ${concatStrings (mapAttrsToList (plugin: pluginConfig: ''
+ LoadPlugin ${plugin}
+ <Plugin "${plugin}">
+ ${pluginConfig}
+ </Plugin>
+ '') cfg.plugins)}
+
${concatMapStrings (f: ''
- Include "${f}"
+ Include "${f}"
'') cfg.include}
${cfg.extraConfig}
'';
+ package =
+ if cfg.buildMinimalPackage
+ then minimalPackage
+ else cfg.package;
+
+ minimalPackage = cfg.package.override {
+ enabledPlugins = [ "syslog" ] ++ builtins.attrNames cfg.plugins;
+ };
+
in {
options.services.collectd = with types; {
enable = mkEnableOption "collectd agent";
@@ -33,7 +49,15 @@ in {
description = ''
Which collectd package to use.
'';
- type = package;
+ type = types.package;
+ };
+
+ buildMinimalPackage = mkOption {
+ default = false;
+ description = ''
+ Build a minimal collectd package with only the configured `services.collectd.plugins`
+ '';
+ type = types.bool;
};
user = mkOption {
@@ -68,6 +92,15 @@ in {
type = listOf str;
};
+ plugins = mkOption {
+ default = {};
+ example = { cpu = ""; memory = ""; network = "Server 192.168.1.1 25826"; };
+ description = ''
+ Attribute set of plugin names to plugin config segments
+ '';
+ type = types.attrsOf types.str;
+ };
+
extraConfig = mkOption {
default = "";
description = ''
@@ -89,7 +122,7 @@ in {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
- ExecStart = "${cfg.package}/sbin/collectd -C ${conf} -f";
+ ExecStart = "${package}/sbin/collectd -C ${conf} -f";
User = cfg.user;
Restart = "on-failure";
RestartSec = 3;
@@ -98,6 +131,7 @@ in {
users.users = optional (cfg.user == "collectd") {
name = "collectd";
+ isSystemUser = true;
};
};
}
diff --git a/nixpkgs/nixos/modules/services/monitoring/fusion-inventory.nix b/nixpkgs/nixos/modules/services/monitoring/fusion-inventory.nix
index b90579bb70c..fe19ed56195 100644
--- a/nixpkgs/nixos/modules/services/monitoring/fusion-inventory.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/fusion-inventory.nix
@@ -49,6 +49,7 @@ in {
users.users = singleton {
name = "fusion-inventory";
description = "FusionInventory user";
+ isSystemUser = true;
};
systemd.services.fusion-inventory = {
diff --git a/nixpkgs/nixos/modules/services/monitoring/grafana.nix b/nixpkgs/nixos/modules/services/monitoring/grafana.nix
index bf1084eecc3..0f8bc2471e3 100644
--- a/nixpkgs/nixos/modules/services/monitoring/grafana.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/grafana.nix
@@ -43,7 +43,7 @@ let
ANALYTICS_REPORTING_ENABLED = boolToString cfg.analytics.reporting.enable;
- SMTP_ENABLE = boolToString cfg.smtp.enable;
+ SMTP_ENABLED = boolToString cfg.smtp.enable;
SMTP_HOST = cfg.smtp.host;
SMTP_USER = cfg.smtp.user;
SMTP_PASSWORD = cfg.smtp.password;
diff --git a/nixpkgs/nixos/modules/services/monitoring/netdata.nix b/nixpkgs/nixos/modules/services/monitoring/netdata.nix
index 463b1b882ac..3ffde8e9bce 100644
--- a/nixpkgs/nixos/modules/services/monitoring/netdata.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/netdata.nix
@@ -138,7 +138,7 @@ in {
description = "Real time performance monitoring";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
- path = (with pkgs; [ gawk curl ]) ++ lib.optional cfg.python.enable
+ path = (with pkgs; [ curl gawk which ]) ++ lib.optional cfg.python.enable
(pkgs.python3.withPackages cfg.python.extraPackages);
serviceConfig = {
Environment="PYTHONPATH=${pkgs.netdata}/libexec/netdata/python.d/python_modules";
@@ -181,6 +181,7 @@ in {
users.users = optional (cfg.user == defaultUser) {
name = defaultUser;
+ isSystemUser = true;
};
users.groups = optional (cfg.group == defaultUser) {
diff --git a/nixpkgs/nixos/modules/services/monitoring/osquery.nix b/nixpkgs/nixos/modules/services/monitoring/osquery.nix
deleted file mode 100644
index c8c625577d3..00000000000
--- a/nixpkgs/nixos/modules/services/monitoring/osquery.nix
+++ /dev/null
@@ -1,91 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with builtins;
-with lib;
-
-let
- cfg = config.services.osquery;
-
-in
-
-{
-
- options = {
-
- services.osquery = {
-
- enable = mkEnableOption "osquery";
-
- loggerPath = mkOption {
- type = types.path;
- description = "Base directory used for logging.";
- default = "/var/log/osquery";
- };
-
- pidfile = mkOption {
- type = types.path;
- description = "Path used for pid file.";
- default = "/var/osquery/osqueryd.pidfile";
- };
-
- utc = mkOption {
- type = types.bool;
- description = "Attempt to convert all UNIX calendar times to UTC.";
- default = true;
- };
-
- databasePath = mkOption {
- type = types.path;
- description = "Path used for database file.";
- default = "/var/osquery/osquery.db";
- };
-
- extraConfig = mkOption {
- type = types.attrs // {
- merge = loc: foldl' (res: def: recursiveUpdate res def.value) {};
- };
- description = "Extra config to be recursively merged into the JSON config file.";
- default = { };
- };
- };
-
- };
-
- config = mkIf cfg.enable {
-
- environment.systemPackages = [ pkgs.osquery ];
-
- environment.etc."osquery/osquery.conf".text = toJSON (
- recursiveUpdate {
- options = {
- config_plugin = "filesystem";
- logger_plugin = "filesystem";
- logger_path = cfg.loggerPath;
- database_path = cfg.databasePath;
- utc = cfg.utc;
- };
- } cfg.extraConfig
- );
-
- systemd.services.osqueryd = {
- description = "The osquery Daemon";
- after = [ "network.target" "syslog.service" ];
- wantedBy = [ "multi-user.target" ];
- path = [ pkgs.osquery ];
- preStart = ''
- mkdir -p ${escapeShellArg cfg.loggerPath}
- mkdir -p "$(dirname ${escapeShellArg cfg.pidfile})"
- mkdir -p "$(dirname ${escapeShellArg cfg.databasePath})"
- '';
- serviceConfig = {
- TimeoutStartSec = "infinity";
- ExecStart = "${pkgs.osquery}/bin/osqueryd --logger_path ${escapeShellArg cfg.loggerPath} --pidfile ${escapeShellArg cfg.pidfile} --database_path ${escapeShellArg cfg.databasePath}";
- KillMode = "process";
- KillSignal = "SIGTERM";
- Restart = "on-failure";
- };
- };
-
- };
-
-}
diff --git a/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix
index 35b513bac57..53f32b8fadc 100644
--- a/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -197,6 +197,9 @@ in
services.prometheus.exporters.minio.minioAccessSecret = mkDefault config.services.minio.secretKey;
})] ++ [(mkIf config.services.rspamd.enable {
services.prometheus.exporters.rspamd.url = mkDefault "http://localhost:11334/stat";
+ })] ++ [(mkIf config.services.nginx.enable {
+ systemd.services.prometheus-nginx-exporter.after = [ "nginx.service" ];
+ systemd.services.prometheus-nginx-exporter.requires = [ "nginx.service" ];
})] ++ (mapAttrsToList (name: conf:
mkExporterConf {
inherit name;
diff --git a/nixpkgs/nixos/modules/services/monitoring/zabbix-agent.nix b/nixpkgs/nixos/modules/services/monitoring/zabbix-agent.nix
index 856b9432892..b3383ed628b 100644
--- a/nixpkgs/nixos/modules/services/monitoring/zabbix-agent.nix
+++ b/nixpkgs/nixos/modules/services/monitoring/zabbix-agent.nix
@@ -131,6 +131,7 @@ in
users.users.${user} = {
description = "Zabbix Agent daemon user";
inherit group;
+ isSystemUser = true;
};
users.groups.${group} = { };
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/beegfs.nix b/nixpkgs/nixos/modules/services/network-filesystems/beegfs.nix
deleted file mode 100644
index 2e03a422665..00000000000
--- a/nixpkgs/nixos/modules/services/network-filesystems/beegfs.nix
+++ /dev/null
@@ -1,357 +0,0 @@
-{ config, lib, pkgs, ...} :
-
-with lib;
-
-let
- cfg = config.services.beegfs;
-
- # functions for the generations of config files
-
- configMgmtd = name: cfg: pkgs.writeText "mgmt-${name}.conf" ''
- storeMgmtdDirectory = ${cfg.mgmtd.storeDir}
- storeAllowFirstRunInit = false
- connAuthFile = ${cfg.connAuthFile}
- connPortShift = ${toString cfg.connPortShift}
-
- ${cfg.mgmtd.extraConfig}
- '';
-
- configAdmon = name: cfg: pkgs.writeText "admon-${name}.conf" ''
- sysMgmtdHost = ${cfg.mgmtdHost}
- connAuthFile = ${cfg.connAuthFile}
- connPortShift = ${toString cfg.connPortShift}
-
- ${cfg.admon.extraConfig}
- '';
-
- configMeta = name: cfg: pkgs.writeText "meta-${name}.conf" ''
- storeMetaDirectory = ${cfg.meta.storeDir}
- sysMgmtdHost = ${cfg.mgmtdHost}
- connAuthFile = ${cfg.connAuthFile}
- connPortShift = ${toString cfg.connPortShift}
- storeAllowFirstRunInit = false
-
- ${cfg.meta.extraConfig}
- '';
-
- configStorage = name: cfg: pkgs.writeText "storage-${name}.conf" ''
- storeStorageDirectory = ${cfg.storage.storeDir}
- sysMgmtdHost = ${cfg.mgmtdHost}
- connAuthFile = ${cfg.connAuthFile}
- connPortShift = ${toString cfg.connPortShift}
- storeAllowFirstRunInit = false
-
- ${cfg.storage.extraConfig}
- '';
-
- configHelperd = name: cfg: pkgs.writeText "helperd-${name}.conf" ''
- connAuthFile = ${cfg.connAuthFile}
- ${cfg.helperd.extraConfig}
- '';
-
- configClientFilename = name : "/etc/beegfs/client-${name}.conf";
-
- configClient = name: cfg: ''
- sysMgmtdHost = ${cfg.mgmtdHost}
- connAuthFile = ${cfg.connAuthFile}
- connPortShift = ${toString cfg.connPortShift}
-
- ${cfg.client.extraConfig}
- '';
-
- serviceList = [
- { service = "admon"; cfgFile = configAdmon; }
- { service = "meta"; cfgFile = configMeta; }
- { service = "mgmtd"; cfgFile = configMgmtd; }
- { service = "storage"; cfgFile = configStorage; }
- ];
-
- # functions to generate systemd.service entries
-
- systemdEntry = service: cfgFile: (mapAttrs' ( name: cfg:
- (nameValuePair "beegfs-${service}-${name}" (mkIf cfg.${service}.enable {
- wantedBy = [ "multi-user.target" ];
- requires = [ "network-online.target" ];
- after = [ "network-online.target" ];
- serviceConfig = rec {
- ExecStart = ''
- ${pkgs.beegfs}/bin/beegfs-${service} \
- cfgFile=${cfgFile name cfg} \
- pidFile=${PIDFile}
- '';
- PIDFile = "/run/beegfs-${service}-${name}.pid";
- TimeoutStopSec = "300";
- };
- }))) cfg);
-
- systemdHelperd = mapAttrs' ( name: cfg:
- (nameValuePair "beegfs-helperd-${name}" (mkIf cfg.client.enable {
- wantedBy = [ "multi-user.target" ];
- requires = [ "network-online.target" ];
- after = [ "network-online.target" ];
- serviceConfig = rec {
- ExecStart = ''
- ${pkgs.beegfs}/bin/beegfs-helperd \
- cfgFile=${configHelperd name cfg} \
- pidFile=${PIDFile}
- '';
- PIDFile = "/run/beegfs-helperd-${name}.pid";
- TimeoutStopSec = "300";
- };
- }))) cfg;
-
- # wrappers to beegfs tools. Avoid typing path of config files
- utilWrappers = mapAttrsToList ( name: cfg:
- ( pkgs.runCommand "beegfs-utils-${name}" {
- nativeBuildInputs = [ pkgs.makeWrapper ];
- preferLocalBuild = true;
- } ''
- mkdir -p $out/bin
-
- makeWrapper ${pkgs.beegfs}/bin/beegfs-check-servers \
- $out/bin/beegfs-check-servers-${name} \
- --add-flags "-c ${configClientFilename name}" \
- --prefix PATH : ${lib.makeBinPath [ pkgs.beegfs ]}
-
- makeWrapper ${pkgs.beegfs}/bin/beegfs-ctl \
- $out/bin/beegfs-ctl-${name} \
- --add-flags "--cfgFile=${configClientFilename name}"
-
- makeWrapper ${pkgs.beegfs}/bin/beegfs-ctl \
- $out/bin/beegfs-df-${name} \
- --add-flags "--cfgFile=${configClientFilename name}" \
- --add-flags --listtargets \
- --add-flags --hidenodeid \
- --add-flags --pools \
- --add-flags --spaceinfo
-
- makeWrapper ${pkgs.beegfs}/bin/beegfs-fsck \
- $out/bin/beegfs-fsck-${name} \
- --add-flags "--cfgFile=${configClientFilename name}"
- ''
- )) cfg;
-in
-{
- ###### interface
-
- options = {
- services.beegfsEnable = mkEnableOption "BeeGFS";
-
- services.beegfs = mkOption {
- default = {};
- description = ''
- BeeGFS configurations. Every mount point requires a separate configuration.
- '';
- type = with types; attrsOf (submodule ({ ... } : {
- options = {
- mgmtdHost = mkOption {
- type = types.str;
- default = null;
- example = "master";
- description = ''Hostname of managament host.'';
- };
-
- connAuthFile = mkOption {
- type = types.str;
- default = "";
- example = "/etc/my.key";
- description = "File containing shared secret authentication.";
- };
-
- connPortShift = mkOption {
- type = types.int;
- default = 0;
- example = 5;
- description = ''
- For each additional beegfs configuration shift all
- service TCP/UDP ports by at least 5.
- '';
- };
-
- client = {
- enable = mkEnableOption "BeeGFS client";
-
- mount = mkOption {
- type = types.bool;
- default = true;
- description = "Create fstab entry automatically";
- };
-
- mountPoint = mkOption {
- type = types.str;
- default = "/run/beegfs";
- description = ''
- Mount point under which the beegfs filesytem should be mounted.
- If mounted manually the mount option specifing the config file is needed:
- cfgFile=/etc/beegfs/beegfs-client-&lt;name&gt;.conf
- '';
- };
-
- extraConfig = mkOption {
- type = types.lines;
- default = "";
- description = ''
- Additional lines for beegfs-client.conf.
- See documentation for further details.
- '';
- };
- };
-
- helperd = {
- enable = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Enable the BeeGFS helperd.
- The helpered is need for logging purposes on the client.
- Disabling <literal>helperd</literal> allows for runing the client
- with <literal>allowUnfree = false</literal>.
- '';
- };
-
- extraConfig = mkOption {
- type = types.lines;
- default = "";
- description = ''
- Additional lines for beegfs-helperd.conf. See documentation
- for further details.
- '';
- };
- };
-
- mgmtd = {
- enable = mkEnableOption "BeeGFS mgmtd daemon";
-
- storeDir = mkOption {
- type = types.path;
- default = null;
- example = "/data/beegfs-mgmtd";
- description = ''
- Data directory for mgmtd.
- Must not be shared with other beegfs daemons.
- This directory must exist and it must be initialized
- with beegfs-setup-mgmtd, e.g. "beegfs-setup-mgmtd -C -p &lt;storeDir&gt;"
- '';
- };
-
- extraConfig = mkOption {
- type = types.lines;
- default = "";
- description = ''
- Additional lines for beegfs-mgmtd.conf. See documentation
- for further details.
- '';
- };
- };
-
- admon = {
- enable = mkEnableOption "BeeGFS admon daemon";
-
- extraConfig = mkOption {
- type = types.lines;
- default = "";
- description = ''
- Additional lines for beegfs-admon.conf. See documentation
- for further details.
- '';
- };
- };
-
- meta = {
- enable = mkEnableOption "BeeGFS meta data daemon";
-
- storeDir = mkOption {
- type = types.path;
- default = null;
- example = "/data/beegfs-meta";
- description = ''
- Data directory for meta data service.
- Must not be shared with other beegfs daemons.
- The underlying filesystem must be mounted with xattr turned on.
- This directory must exist and it must be initialized
- with beegfs-setup-meta, e.g.
- "beegfs-setup-meta -C -s &lt;serviceID&gt; -p &lt;storeDir&gt;"
- '';
- };
-
- extraConfig = mkOption {
- type = types.str;
- default = "";
- description = ''
- Additional lines for beegfs-meta.conf. See documentation
- for further details.
- '';
- };
- };
-
- storage = {
- enable = mkEnableOption "BeeGFS storage daemon";
-
- storeDir = mkOption {
- type = types.path;
- default = null;
- example = "/data/beegfs-storage";
- description = ''
- Data directories for storage service.
- Must not be shared with other beegfs daemons.
- The underlying filesystem must be mounted with xattr turned on.
- This directory must exist and it must be initialized
- with beegfs-setup-storage, e.g.
- "beegfs-setup-storage -C -s &lt;serviceID&gt; -i &lt;storageTargetID&gt; -p &lt;storeDir&gt;"
- '';
- };
-
- extraConfig = mkOption {
- type = types.str;
- default = "";
- description = ''
- Addional lines for beegfs-storage.conf. See documentation
- for further details.
- '';
- };
- };
- };
- }));
- };
- };
-
- ###### implementation
-
- config =
- mkIf config.services.beegfsEnable {
-
- environment.systemPackages = utilWrappers;
-
- # Put the client.conf files in /etc since they are needed
- # by the commandline tools
- environment.etc = mapAttrs' ( name: cfg:
- (nameValuePair "beegfs/client-${name}.conf" (mkIf (cfg.client.enable)
- {
- enable = true;
- text = configClient name cfg;
- }))) cfg;
-
- # Kernel module, we need it only once per host.
- boot = mkIf (
- foldr (a: b: a || b) false
- (map (x: x.client.enable) (collect (x: x ? client) cfg)))
- {
- kernelModules = [ "beegfs" ];
- extraModulePackages = [ pkgs.linuxPackages.beegfs-module ];
- };
-
- # generate fstab entries
- fileSystems = mapAttrs' (name: cfg:
- (nameValuePair cfg.client.mountPoint (optionalAttrs cfg.client.mount (mkIf cfg.client.enable {
- device = "beegfs_nodev";
- fsType = "beegfs";
- mountPoint = cfg.client.mountPoint;
- options = [ "cfgFile=${configClientFilename name}" "_netdev" ];
- })))) cfg;
-
- # generate systemd services
- systemd.services = systemdHelperd //
- foldr (a: b: a // b) {}
- (map (x: systemdEntry x.service x.cfgFile) serviceList);
- };
-}
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/ceph.nix b/nixpkgs/nixos/modules/services/network-filesystems/ceph.nix
index 656a2d21b86..543a7b25d5d 100644
--- a/nixpkgs/nixos/modules/services/network-filesystems/ceph.nix
+++ b/nixpkgs/nixos/modules/services/network-filesystems/ceph.nix
@@ -9,12 +9,14 @@ let
expandCamelCase = replaceStrings upperChars (map (s: " ${s}") lowerChars);
expandCamelCaseAttrs = mapAttrs' (name: value: nameValuePair (expandCamelCase name) value);
- makeServices = (daemonType: daemonIds: extraServiceConfig:
+ makeServices = (daemonType: daemonIds:
mkMerge (map (daemonId:
- { "ceph-${daemonType}-${daemonId}" = makeService daemonType daemonId cfg.global.clusterName pkgs.ceph extraServiceConfig; })
+ { "ceph-${daemonType}-${daemonId}" = makeService daemonType daemonId cfg.global.clusterName pkgs.ceph; })
daemonIds));
- makeService = (daemonType: daemonId: clusterName: ceph: extraServiceConfig: {
+ makeService = (daemonType: daemonId: clusterName: ceph:
+ let
+ stateDirectory = "ceph/${if daemonType == "rgw" then "radosgw" else daemonType}/${clusterName}-${daemonId}"; in {
enable = true;
description = "Ceph ${builtins.replaceStrings lowerChars upperChars daemonType} daemon ${daemonId}";
after = [ "network-online.target" "time-sync.target" ] ++ optional (daemonType == "osd") "ceph-mon.target";
@@ -22,6 +24,11 @@ let
partOf = [ "ceph-${daemonType}.target" ];
wantedBy = [ "ceph-${daemonType}.target" ];
+ path = [ pkgs.getopt ];
+
+ # Don't start services that are not yet initialized
+ unitConfig.ConditionPathExists = "/var/lib/${stateDirectory}/keyring";
+
serviceConfig = {
LimitNOFILE = 1048576;
LimitNPROC = 1048576;
@@ -34,22 +41,22 @@ let
Restart = "on-failure";
StartLimitBurst = "5";
StartLimitInterval = "30min";
+ StateDirectory = stateDirectory;
+ User = "ceph";
+ Group = if daemonType == "osd" then "disk" else "ceph";
ExecStart = ''${ceph.out}/bin/${if daemonType == "rgw" then "radosgw" else "ceph-${daemonType}"} \
- -f --cluster ${clusterName} --id ${daemonId} --setuser ceph \
- --setgroup ${if daemonType == "osd" then "disk" else "ceph"}'';
- } // extraServiceConfig
- // optionalAttrs (daemonType == "osd") { ExecStartPre = ''${ceph.lib}/libexec/ceph/ceph-osd-prestart.sh \
- --id ${daemonId} --cluster ${clusterName}''; };
- } // optionalAttrs (builtins.elem daemonType [ "mds" "mon" "rgw" "mgr" ]) {
- preStart = ''
- daemonPath="/var/lib/ceph/${if daemonType == "rgw" then "radosgw" else daemonType}/${clusterName}-${daemonId}"
- if [ ! -d $daemonPath ]; then
- mkdir -m 755 -p $daemonPath
- chown -R ceph:ceph $daemonPath
- fi
- '';
- } // optionalAttrs (daemonType == "osd") { path = [ pkgs.getopt ]; }
- );
+ -f --cluster ${clusterName} --id ${daemonId}'';
+ } // optionalAttrs (daemonType == "osd") {
+ ExecStartPre = ''${ceph.lib}/libexec/ceph/ceph-osd-prestart.sh --id ${daemonId} --cluster ${clusterName}'';
+ StartLimitBurst = "30";
+ RestartSec = "20s";
+ PrivateDevices = "no"; # osd needs disk access
+ } // optionalAttrs ( daemonType == "mon") {
+ RestartSec = "10";
+ } // optionalAttrs (lib.elem daemonType ["mgr" "mds"]) {
+ StartLimitBurst = "3";
+ };
+ });
makeTarget = (daemonType:
{
@@ -58,6 +65,7 @@ let
partOf = [ "ceph.target" ];
wantedBy = [ "ceph.target" ];
before = [ "ceph.target" ];
+ unitConfig.StopWhenUnneeded = true;
};
}
);
@@ -377,22 +385,22 @@ in
systemd.services = let
services = []
- ++ optional cfg.mon.enable (makeServices "mon" cfg.mon.daemons { RestartSec = "10"; })
- ++ optional cfg.mds.enable (makeServices "mds" cfg.mds.daemons { StartLimitBurst = "3"; })
- ++ optional cfg.osd.enable (makeServices "osd" cfg.osd.daemons { StartLimitBurst = "30";
- RestartSec = "20s";
- PrivateDevices = "no"; # osd needs disk access
- })
- ++ optional cfg.rgw.enable (makeServices "rgw" cfg.rgw.daemons { })
- ++ optional cfg.mgr.enable (makeServices "mgr" cfg.mgr.daemons { StartLimitBurst = "3"; });
+ ++ optional cfg.mon.enable (makeServices "mon" cfg.mon.daemons)
+ ++ optional cfg.mds.enable (makeServices "mds" cfg.mds.daemons)
+ ++ optional cfg.osd.enable (makeServices "osd" cfg.osd.daemons)
+ ++ optional cfg.rgw.enable (makeServices "rgw" cfg.rgw.daemons)
+ ++ optional cfg.mgr.enable (makeServices "mgr" cfg.mgr.daemons);
in
mkMerge services;
systemd.targets = let
targets = [
- { ceph = { description = "Ceph target allowing to start/stop all ceph service instances at once";
- wantedBy = [ "multi-user.target" ]; }; }
- ] ++ optional cfg.mon.enable (makeTarget "mon")
+ { ceph = {
+ description = "Ceph target allowing to start/stop all ceph service instances at once";
+ wantedBy = [ "multi-user.target" ];
+ unitConfig.StopWhenUnneeded = true;
+ }; } ]
+ ++ optional cfg.mon.enable (makeTarget "mon")
++ optional cfg.mds.enable (makeTarget "mds")
++ optional cfg.osd.enable (makeTarget "osd")
++ optional cfg.rgw.enable (makeTarget "rgw")
@@ -401,7 +409,11 @@ in
mkMerge targets;
systemd.tmpfiles.rules = [
+ "d /etc/ceph - ceph ceph - -"
"d /run/ceph 0770 ceph ceph -"
- ];
+ "d /var/lib/ceph - ceph ceph - -"]
+ ++ optionals cfg.mgr.enable [ "d /var/lib/ceph/mgr - ceph ceph - -"]
+ ++ optionals cfg.mon.enable [ "d /var/lib/ceph/mon - ceph ceph - -"]
+ ++ optionals cfg.osd.enable [ "d /var/lib/ceph/osd - ceph ceph - -"];
};
}
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/orangefs/client.nix b/nixpkgs/nixos/modules/services/network-filesystems/orangefs/client.nix
new file mode 100644
index 00000000000..b69d9e713c3
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/network-filesystems/orangefs/client.nix
@@ -0,0 +1,97 @@
+{ config, lib, pkgs, ...} :
+
+with lib;
+
+let
+ cfg = config.services.orangefs.client;
+
+in {
+ ###### interface
+
+ options = {
+ services.orangefs.client = {
+ enable = mkEnableOption "OrangeFS client daemon";
+
+ extraOptions = mkOption {
+ type = with types; listOf str;
+ default = [];
+ description = "Extra command line options for pvfs2-client.";
+ };
+
+ fileSystems = mkOption {
+ description = ''
+ The orangefs file systems to be mounted.
+ This option is prefered over using <option>fileSystems</option> directly since
+ the pvfs client service needs to be running for it to be mounted.
+ '';
+
+ example = [{
+ mountPoint = "/orangefs";
+ target = "tcp://server:3334/orangefs";
+ }];
+
+ type = with types; listOf (submodule ({ ... } : {
+ options = {
+
+ mountPoint = mkOption {
+ type = types.str;
+ default = "/orangefs";
+ description = "Mount point.";
+ };
+
+ options = mkOption {
+ type = with types; listOf str;
+ default = [];
+ description = "Mount options";
+ };
+
+ target = mkOption {
+ type = types.str;
+ default = null;
+ example = "tcp://server:3334/orangefs";
+ description = "Target URL";
+ };
+ };
+ }));
+ };
+ };
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.orangefs ];
+
+ boot.supportedFilesystems = [ "pvfs2" ];
+ boot.kernelModules = [ "orangefs" ];
+
+ systemd.services.orangefs-client = {
+ requires = [ "network-online.target" ];
+ after = [ "network-online.target" ];
+
+ serviceConfig = {
+ Type = "simple";
+
+ ExecStart = ''
+ ${pkgs.orangefs}/bin/pvfs2-client-core \
+ --logtype=syslog ${concatStringsSep " " cfg.extraOptions}
+ '';
+
+ TimeoutStopSec = "120";
+ };
+ };
+
+ systemd.mounts = map (fs: {
+ requires = [ "orangefs-client.service" ];
+ after = [ "orangefs-client.service" ];
+ bindsTo = [ "orangefs-client.service" ];
+ wantedBy = [ "remote-fs.target" ];
+ type = "pvfs2";
+ options = concatStringsSep "," fs.options;
+ what = fs.target;
+ where = fs.mountPoint;
+ }) cfg.fileSystems;
+ };
+}
+
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/orangefs/server.nix b/nixpkgs/nixos/modules/services/network-filesystems/orangefs/server.nix
new file mode 100644
index 00000000000..74ebdc13402
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/network-filesystems/orangefs/server.nix
@@ -0,0 +1,225 @@
+{ config, lib, pkgs, ...} :
+
+with lib;
+
+let
+ cfg = config.services.orangefs.server;
+
+ aliases = mapAttrsToList (alias: url: alias) cfg.servers;
+
+ # Maximum handle number is 2^63
+ maxHandle = 9223372036854775806;
+
+ # One range of handles for each meta/data instance
+ handleStep = maxHandle / (length aliases) / 2;
+
+ fileSystems = mapAttrsToList (name: fs: ''
+ <FileSystem>
+ Name ${name}
+ ID ${toString fs.id}
+ RootHandle ${toString fs.rootHandle}
+
+ ${fs.extraConfig}
+
+ <MetaHandleRanges>
+ ${concatStringsSep "\n" (
+ imap0 (i: alias:
+ let
+ begin = i * handleStep + 3;
+ end = begin + handleStep - 1;
+ in "Range ${alias} ${toString begin}-${toString end}") aliases
+ )}
+ </MetaHandleRanges>
+
+ <DataHandleRanges>
+ ${concatStringsSep "\n" (
+ imap0 (i: alias:
+ let
+ begin = i * handleStep + 3 + (length aliases) * handleStep;
+ end = begin + handleStep - 1;
+ in "Range ${alias} ${toString begin}-${toString end}") aliases
+ )}
+ </DataHandleRanges>
+
+ <StorageHints>
+ TroveSyncMeta ${if fs.troveSyncMeta then "yes" else "no"}
+ TroveSyncData ${if fs.troveSyncData then "yes" else "no"}
+ ${fs.extraStorageHints}
+ </StorageHints>
+
+ </FileSystem>
+ '') cfg.fileSystems;
+
+ configFile = ''
+ <Defaults>
+ LogType ${cfg.logType}
+ DataStorageSpace ${cfg.dataStorageSpace}
+ MetaDataStorageSpace ${cfg.metadataStorageSpace}
+
+ BMIModules ${concatStringsSep "," cfg.BMIModules}
+ ${cfg.extraDefaults}
+ </Defaults>
+
+ ${cfg.extraConfig}
+
+ <Aliases>
+ ${concatStringsSep "\n" (mapAttrsToList (alias: url: "Alias ${alias} ${url}") cfg.servers)}
+ </Aliases>
+
+ ${concatStringsSep "\n" fileSystems}
+ '';
+
+in {
+ ###### interface
+
+ options = {
+ services.orangefs.server = {
+ enable = mkEnableOption "OrangeFS server";
+
+ logType = mkOption {
+ type = with types; enum [ "file" "syslog" ];
+ default = "syslog";
+ description = "Destination for log messages.";
+ };
+
+ dataStorageSpace = mkOption {
+ type = types.str;
+ default = null;
+ example = "/data/storage";
+ description = "Directory for data storage.";
+ };
+
+ metadataStorageSpace = mkOption {
+ type = types.str;
+ default = null;
+ example = "/data/meta";
+ description = "Directory for meta data storage.";
+ };
+
+ BMIModules = mkOption {
+ type = with types; listOf str;
+ default = [ "bmi_tcp" ];
+ example = [ "bmi_tcp" "bmi_ib"];
+ description = "List of BMI modules to load.";
+ };
+
+ extraDefaults = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra config for <literal>&lt;Defaults&gt;</literal> section.";
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra config for the global section.";
+ };
+
+ servers = mkOption {
+ type = with types; attrsOf types.str;
+ default = {};
+ example = ''
+ {
+ node1="tcp://node1:3334";
+ node2="tcp://node2:3334";
+ }
+ '';
+ description = "URLs for storage server including port. The attribute names define the server alias.";
+ };
+
+ fileSystems = mkOption {
+ description = ''
+ These options will create the <literal>&lt;FileSystem&gt;</literal> sections of config file.
+ '';
+ default = { orangefs = {}; };
+ defaultText = literalExample "{ orangefs = {}; }";
+ example = literalExample ''
+ {
+ fs1 = {
+ id = 101;
+ };
+
+ fs2 = {
+ id = 102;
+ };
+ }
+ '';
+ type = with types; attrsOf (submodule ({ ... } : {
+ options = {
+ id = mkOption {
+ type = types.int;
+ default = 1;
+ description = "File system ID (must be unique within configuration).";
+ };
+
+ rootHandle = mkOption {
+ type = types.int;
+ default = 3;
+ description = "File system root ID.";
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra config for <literal>&lt;FileSystem&gt;</literal> section.";
+ };
+
+ troveSyncMeta = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Sync meta data.";
+ };
+
+ troveSyncData = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Sync data.";
+ };
+
+ extraStorageHints = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra config for <literal>&lt;StorageHints&gt;</literal> section.";
+ };
+ };
+ }));
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.orangefs ];
+
+ # orangefs daemon will run as user
+ users.users.orangefs.isSystemUser = true;
+ users.groups.orangefs = {};
+
+ # To format the file system the config file is needed.
+ environment.etc."orangefs/server.conf" = {
+ text = configFile;
+ user = "orangefs";
+ group = "orangefs";
+ };
+
+ systemd.services.orangefs-server = {
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "network-online.target" ];
+ after = [ "network-online.target" ];
+
+ serviceConfig = {
+ # Run as "simple" in forground mode.
+ # This is more reliable
+ ExecStart = ''
+ ${pkgs.orangefs}/bin/pvfs2-server -d \
+ /etc/orangefs/server.conf
+ '';
+ TimeoutStopSec = "120";
+ User = "orangefs";
+ Group = "orangefs";
+ };
+ };
+ };
+
+}
diff --git a/nixpkgs/nixos/modules/services/network-filesystems/samba.nix b/nixpkgs/nixos/modules/services/network-filesystems/samba.nix
index ce565dbaab8..875ab70bfc7 100644
--- a/nixpkgs/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixpkgs/nixos/modules/services/network-filesystems/samba.nix
@@ -12,11 +12,6 @@ let
samba = cfg.package;
- setupScript =
- ''
- mkdir -p /var/lock/samba /var/log/samba /var/cache/samba /var/lib/samba/private
- '';
-
shareConfig = name:
let share = getAttr name cfg.shares; in
"[${name}]\n " + (smbToString (
@@ -45,7 +40,7 @@ let
daemonService = appName: args:
{ description = "Samba Service Daemon ${appName}";
- after = [ "network.target" ];
+ after = [ (mkIf (cfg.enableNmbd && "${appName}" == "smbd") "samba-nmbd.service") ];
requiredBy = [ "samba.target" ];
partOf = [ "samba.target" ];
@@ -62,6 +57,7 @@ let
Type = "notify";
NotifyAccess = "all"; #may not do anything...
};
+ unitConfig.RequiresMountsFor = "/var/lib/samba";
restartTriggers = [ configFile ];
};
@@ -119,7 +115,7 @@ in
type = types.package;
default = pkgs.samba;
defaultText = "pkgs.samba";
- example = literalExample "pkgs.samba3";
+ example = literalExample "pkgs.samba4Full";
description = ''
Defines which package should be used for the samba server.
'';
@@ -228,8 +224,7 @@ in
systemd = {
targets.samba = {
description = "Samba Server";
- requires = [ "samba-setup.service" ];
- after = [ "samba-setup.service" "network.target" ];
+ after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
};
# Refer to https://github.com/samba-team/samba/tree/master/packaging/systemd
@@ -238,12 +233,13 @@ in
samba-smbd = daemonService "smbd" "";
samba-nmbd = mkIf cfg.enableNmbd (daemonService "nmbd" "");
samba-winbindd = mkIf cfg.enableWinbindd (daemonService "winbindd" "");
- samba-setup = {
- description = "Samba Setup Task";
- script = setupScript;
- unitConfig.RequiresMountsFor = "/var/lib/samba";
- };
};
+ tmpfiles.rules = [
+ "d /var/lock/samba - - - - -"
+ "d /var/log/samba - - - - -"
+ "d /var/cache/samba - - - - -"
+ "d /var/lib/samba/private - - - - -"
+ ];
};
security.pam.services.samba = {};
diff --git a/nixpkgs/nixos/modules/services/networking/bind.nix b/nixpkgs/nixos/modules/services/networking/bind.nix
index 06af4dbcca4..d09c6735e12 100644
--- a/nixpkgs/nixos/modules/services/networking/bind.nix
+++ b/nixpkgs/nixos/modules/services/networking/bind.nix
@@ -78,7 +78,11 @@ in
cacheNetworks = mkOption {
default = ["127.0.0.0/24"];
description = "
- What networks are allowed to use us as a resolver.
+ What networks are allowed to use us as a resolver. Note
+ that this is for recursive queries -- all networks are
+ allowed to query zones configured with the `zones` option.
+ It is recommended that you limit cacheNetworks to avoid your
+ server being used for DNS amplification attacks.
";
};
diff --git a/nixpkgs/nixos/modules/services/networking/bitcoind.nix b/nixpkgs/nixos/modules/services/networking/bitcoind.nix
index 1439d739da9..4e00a886547 100644
--- a/nixpkgs/nixos/modules/services/networking/bitcoind.nix
+++ b/nixpkgs/nixos/modules/services/networking/bitcoind.nix
@@ -177,9 +177,6 @@ in {
NoNewPrivileges = "true";
PrivateDevices = "true";
MemoryDenyWriteExecute = "true";
-
- # Permission for preStart
- PermissionsStartOnly = "true";
};
};
users.users.${cfg.user} = {
@@ -187,6 +184,7 @@ in {
group = cfg.group;
description = "Bitcoin daemon user";
home = cfg.dataDir;
+ isSystemUser = true;
};
users.groups.${cfg.group} = {
name = cfg.group;
diff --git a/nixpkgs/nixos/modules/services/networking/connman.nix b/nixpkgs/nixos/modules/services/networking/connman.nix
index 31127f79049..cac517f410e 100644
--- a/nixpkgs/nixos/modules/services/networking/connman.nix
+++ b/nixpkgs/nixos/modules/services/networking/connman.nix
@@ -4,7 +4,7 @@ with pkgs;
with lib;
let
- cfg = config.networking.connman;
+ cfg = config.services.connman;
configFile = pkgs.writeText "connman.conf" ''
[General]
NetworkInterfaceBlacklist=${concatStringsSep "," cfg.networkInterfaceBlacklist}
@@ -17,7 +17,7 @@ in {
options = {
- networking.connman = {
+ services.connman = {
enable = mkOption {
type = types.bool;
@@ -71,13 +71,13 @@ in {
assertions = [{
assertion = !config.networking.useDHCP;
- message = "You can not use services.networking.connman with services.networking.useDHCP";
+ message = "You can not use services.connman with networking.useDHCP";
}{
assertion = config.networking.wireless.enable;
- message = "You must use services.networking.connman with services.networking.wireless";
+ message = "You must use services.connman with networking.wireless";
}{
assertion = !config.networking.networkmanager.enable;
- message = "You can not use services.networking.connman with services.networking.networkmanager";
+ message = "You can not use services.connman with networking.networkmanager";
}];
environment.systemPackages = [ connman ];
diff --git a/nixpkgs/nixos/modules/services/networking/dnscache.nix b/nixpkgs/nixos/modules/services/networking/dnscache.nix
index 5051fc916d9..d123bca9321 100644
--- a/nixpkgs/nixos/modules/services/networking/dnscache.nix
+++ b/nixpkgs/nixos/modules/services/networking/dnscache.nix
@@ -84,7 +84,7 @@ in {
config = mkIf config.services.dnscache.enable {
environment.systemPackages = [ pkgs.djbdns ];
- users.users.dnscache = {};
+ users.users.dnscache.isSystemUser = true;
systemd.services.dnscache = {
description = "djbdns dnscache server";
diff --git a/nixpkgs/nixos/modules/services/networking/dnschain.nix b/nixpkgs/nixos/modules/services/networking/dnschain.nix
index 5b58ea9b0c9..b837bf816a1 100644
--- a/nixpkgs/nixos/modules/services/networking/dnschain.nix
+++ b/nixpkgs/nixos/modules/services/networking/dnschain.nix
@@ -137,7 +137,7 @@ in
];
services.pdns-recursor = mkIf cfgs.pdns-recursor.resolveDNSChainQueries {
- forwardZones =
+ forwardZonesRecurse =
{ bit = "127.0.0.1:${toString cfg.dns.port}";
dns = "127.0.0.1:${toString cfg.dns.port}";
};
diff --git a/nixpkgs/nixos/modules/services/networking/dnscrypt-wrapper.nix b/nixpkgs/nixos/modules/services/networking/dnscrypt-wrapper.nix
index bf13d5c6f5f..79f9e1a4308 100644
--- a/nixpkgs/nixos/modules/services/networking/dnscrypt-wrapper.nix
+++ b/nixpkgs/nixos/modules/services/networking/dnscrypt-wrapper.nix
@@ -142,6 +142,7 @@ in {
description = "dnscrypt-wrapper daemon user";
home = "${dataDir}";
createHome = true;
+ isSystemUser = true;
};
users.groups.dnscrypt-wrapper = { };
diff --git a/nixpkgs/nixos/modules/services/networking/dnsdist.nix b/nixpkgs/nixos/modules/services/networking/dnsdist.nix
index 12eee136e63..8249da69bc1 100644
--- a/nixpkgs/nixos/modules/services/networking/dnsdist.nix
+++ b/nixpkgs/nixos/modules/services/networking/dnsdist.nix
@@ -46,11 +46,10 @@ in {
RestartSec="1";
DynamicUser = true;
StartLimitInterval="0";
- PrivateTmp=true;
PrivateDevices=true;
- CapabilityBoundingSet="CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID";
+ AmbientCapabilities="CAP_NET_BIND_SERVICE";
+ CapabilityBoundingSet="CAP_NET_BIND_SERVICE";
ExecStart = "${pkgs.dnsdist}/bin/dnsdist --supervised --disable-syslog --config ${configFile}";
- ProtectSystem="full";
ProtectHome=true;
RestrictAddressFamilies="AF_UNIX AF_INET AF_INET6";
LimitNOFILE="16384";
diff --git a/nixpkgs/nixos/modules/services/networking/eternal-terminal.nix b/nixpkgs/nixos/modules/services/networking/eternal-terminal.nix
index be7337ece7e..a2e5b30dc0f 100644
--- a/nixpkgs/nixos/modules/services/networking/eternal-terminal.nix
+++ b/nixpkgs/nixos/modules/services/networking/eternal-terminal.nix
@@ -23,6 +23,8 @@ in
type = types.int;
description = ''
The port the server should listen on. Will use the server's default (2022) if not specified.
+
+ Make sure to open this port in the firewall if necessary.
'';
};
@@ -86,4 +88,8 @@ in
};
};
};
+
+ meta = {
+ maintainers = with lib.maintainers; [ pingiun ];
+ };
}
diff --git a/nixpkgs/nixos/modules/services/networking/go-shadowsocks2.nix b/nixpkgs/nixos/modules/services/networking/go-shadowsocks2.nix
new file mode 100644
index 00000000000..afbd7ea27c6
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/networking/go-shadowsocks2.nix
@@ -0,0 +1,30 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.services.go-shadowsocks2.server;
+in {
+ options.services.go-shadowsocks2.server = {
+ enable = mkEnableOption "go-shadowsocks2 server";
+
+ listenAddress = mkOption {
+ type = types.str;
+ description = "Server listen address or URL";
+ example = "ss://AEAD_CHACHA20_POLY1305:your-password@:8488";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.go-shadowsocks2-server = {
+ description = "go-shadowsocks2 server";
+
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.go-shadowsocks2}/bin/go-shadowsocks2 -s '${cfg.listenAddress}'";
+ DynamicUser = true;
+ };
+ };
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/networking/hans.nix b/nixpkgs/nixos/modules/services/networking/hans.nix
index 20e57e4626e..4f60300f5ff 100644
--- a/nixpkgs/nixos/modules/services/networking/hans.nix
+++ b/nixpkgs/nixos/modules/services/networking/hans.nix
@@ -138,6 +138,7 @@ in
users.users = singleton {
name = hansUser;
description = "Hans daemon user";
+ isSystemUser = true;
};
};
diff --git a/nixpkgs/nixos/modules/services/networking/haproxy.nix b/nixpkgs/nixos/modules/services/networking/haproxy.nix
index 0438d0bf8d8..aff71e5e97d 100644
--- a/nixpkgs/nixos/modules/services/networking/haproxy.nix
+++ b/nixpkgs/nixos/modules/services/networking/haproxy.nix
@@ -1,7 +1,16 @@
{ config, lib, pkgs, ... }:
+
let
cfg = config.services.haproxy;
- haproxyCfg = pkgs.writeText "haproxy.conf" cfg.config;
+
+ haproxyCfg = pkgs.writeText "haproxy.conf" ''
+ global
+ # needed for hot-reload to work without dropping packets in multi-worker mode
+ stats socket /run/haproxy/haproxy.sock mode 600 expose-fd listeners level user
+
+ ${cfg.config}
+ '';
+
in
with lib;
{
@@ -25,9 +34,7 @@ with lib;
<filename>haproxy.conf</filename>.
'';
};
-
};
-
};
config = mkIf cfg.enable {
@@ -42,21 +49,16 @@ with lib;
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
- Type = "forking";
- PIDFile = "/run/haproxy.pid";
- ExecStartPre = "${pkgs.haproxy}/sbin/haproxy -c -q -f ${haproxyCfg}";
- ExecStart = "${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /run/haproxy.pid";
- ExecReload = "-${pkgs.bash}/bin/bash -c \"exec ${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /run/haproxy.pid -sf $MAINPID\"";
+ DynamicUser = true;
+ Type = "notify";
+ # when running the config test, don't be quiet so we can see what goes wrong
+ ExecStartPre = "${pkgs.haproxy}/sbin/haproxy -c -f ${haproxyCfg}";
+ ExecStart = "${pkgs.haproxy}/sbin/haproxy -Ws -f ${haproxyCfg}";
+ Restart = "on-failure";
+ RuntimeDirectory = "haproxy";
+ # needed in case we bind to port < 1024
+ AmbientCapabilities = "CAP_NET_BIND_SERVICE";
};
};
-
- environment.systemPackages = [ pkgs.haproxy ];
-
- users.users.haproxy = {
- group = "haproxy";
- uid = config.ids.uids.haproxy;
- };
-
- users.groups.haproxy.gid = config.ids.uids.haproxy;
};
}
diff --git a/nixpkgs/nixos/modules/services/networking/jormungandr.nix b/nixpkgs/nixos/modules/services/networking/jormungandr.nix
deleted file mode 100644
index 152cceb4bf9..00000000000
--- a/nixpkgs/nixos/modules/services/networking/jormungandr.nix
+++ /dev/null
@@ -1,102 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-let
- cfg = config.services.jormungandr;
-
- inherit (lib) mkEnableOption mkIf mkOption;
- inherit (lib) optionalString types;
-
- dataDir = "/var/lib/jormungandr";
-
- # Default settings so far, as the service matures we will
- # move these out as separate settings
- configSettings = {
- storage = dataDir;
- p2p = {
- public_address = "/ip4/127.0.0.1/tcp/8299";
- topics_of_interest = {
- messages = "high";
- blocks = "high";
- };
- };
- rest = {
- listen = "127.0.0.1:8607";
- };
- };
-
- configFile = if cfg.configFile == null then
- pkgs.writeText "jormungandr.yaml" (builtins.toJSON configSettings)
- else cfg.configFile;
-
-in {
-
- options = {
-
- services.jormungandr = {
- enable = mkEnableOption "jormungandr service";
-
- configFile = mkOption {
- type = types.nullOr types.path;
- default = null;
- example = "/var/lib/jormungandr/node.yaml";
- description = ''
- The path of the jormungandr blockchain configuration file in YAML format.
- If no file is specified, a file is generated using the other options.
- '';
- };
-
- secretFile = mkOption {
- type = types.nullOr types.path;
- default = null;
- example = "/etc/secret/jormungandr.yaml";
- description = ''
- The path of the jormungandr blockchain secret node configuration file in
- YAML format. Do not store this in nix store!
- '';
- };
-
- genesisBlockHash = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "d70495af81ae8600aca3e642b2427327cb6001ec4d7a0037e96a00dabed163f9";
- description = ''
- Set the genesis block hash (the hash of the block0) so we can retrieve
- the genesis block (and the blockchain configuration) from the existing
- storage or from the network.
- '';
- };
-
- genesisBlockFile = mkOption {
- type = types.nullOr types.path;
- default = null;
- example = "/var/lib/jormungandr/block-0.bin";
- description = ''
- The path of the genesis block file if we are hosting it locally.
- '';
- };
-
- };
- };
-
- config = mkIf cfg.enable {
-
- systemd.services.jormungandr = {
- description = "jormungandr server";
- wantedBy = [ "multi-user.target" ];
- after = [ "network-online.target" ];
- environment = {
- RUST_BACKTRACE = "full";
- };
- serviceConfig = {
- DynamicUser = true;
- StateDirectory = baseNameOf dataDir;
- ExecStart = ''
- ${pkgs.jormungandr}/bin/jormungandr --config ${configFile} \
- ${optionalString (cfg.secretFile != null) " --secret ${cfg.secretFile}"} \
- ${optionalString (cfg.genesisBlockHash != null) " --genesis-block-hash ${cfg.genesisBlockHash}"} \
- ${optionalString (cfg.genesisBlockFile != null) " --genesis-block ${cfg.genesisBlockFile}"}
- '';
- };
- };
- };
-}
diff --git a/nixpkgs/nixos/modules/services/networking/matterbridge.nix b/nixpkgs/nixos/modules/services/networking/matterbridge.nix
index 1fd63348c16..682eaa6eb29 100644
--- a/nixpkgs/nixos/modules/services/networking/matterbridge.nix
+++ b/nixpkgs/nixos/modules/services/networking/matterbridge.nix
@@ -95,6 +95,7 @@ in
users.users = optional (cfg.user == "matterbridge")
{ name = "matterbridge";
group = "matterbridge";
+ isSystemUser = true;
};
users.groups = optional (cfg.group == "matterbridge")
diff --git a/nixpkgs/nixos/modules/services/networking/morty.nix b/nixpkgs/nixos/modules/services/networking/morty.nix
index 1b3084fe9ab..e3a6444c116 100644
--- a/nixpkgs/nixos/modules/services/networking/morty.nix
+++ b/nixpkgs/nixos/modules/services/networking/morty.nix
@@ -74,6 +74,7 @@ in
{ description = "Morty user";
createHome = true;
home = "/var/lib/morty";
+ isSystemUser = true;
};
systemd.services.morty =
diff --git a/nixpkgs/nixos/modules/services/networking/nat.nix b/nixpkgs/nixos/modules/services/networking/nat.nix
index 89d8590093d..5681bda51cb 100644
--- a/nixpkgs/nixos/modules/services/networking/nat.nix
+++ b/nixpkgs/nixos/modules/services/networking/nat.nix
@@ -29,7 +29,7 @@ let
iptables -w -t nat -N nixos-nat-post
# We can't match on incoming interface in POSTROUTING, so
- # mark packets coming from the external interfaces.
+ # mark packets coming from the internal interfaces.
${concatMapStrings (iface: ''
iptables -w -t nat -A nixos-nat-pre \
-i '${iface}' -j MARK --set-mark 1
diff --git a/nixpkgs/nixos/modules/services/networking/networkmanager.nix b/nixpkgs/nixos/modules/services/networking/networkmanager.nix
index 05a78d1c448..90d1032c41b 100644
--- a/nixpkgs/nixos/modules/services/networking/networkmanager.nix
+++ b/nixpkgs/nixos/modules/services/networking/networkmanager.nix
@@ -17,9 +17,6 @@ let
networkmanager-vpnc
] ++ optional (!delegateWireless && !enableIwd) wpa_supplicant;
- dynamicHostsEnabled =
- cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
-
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [];
enableIwd = cfg.wifi.backend == "iwd";
@@ -335,55 +332,20 @@ in {
so you don't need to to that yourself.
'';
};
-
- dynamicHosts = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Enabling this option requires the
- <option>networking.networkmanager.dns</option> option to be
- set to <literal>dnsmasq</literal>. If enabled, the directories
- defined by the
- <option>networking.networkmanager.dynamicHosts.hostsDirs</option>
- option will be set up when the service starts. The dnsmasq instance
- managed by NetworkManager will then watch those directories for
- hosts files (see the <literal>--hostsdir</literal> option of
- dnsmasq). This way a non-privileged user can add or override DNS
- entries on the local system (depending on what hosts directories
- that are configured)..
- '';
- };
- hostsDirs = mkOption {
- type = with types; attrsOf (submodule {
- options = {
- user = mkOption {
- type = types.str;
- default = "root";
- description = ''
- The user that will own the hosts directory.
- '';
- };
- group = mkOption {
- type = types.str;
- default = "root";
- description = ''
- The group that will own the hosts directory.
- '';
- };
- };
- });
- default = {};
- description = ''
- Defines a set of directories (relative to
- <literal>/run/NetworkManager/hostdirs</literal>) that dnsmasq will
- watch for hosts files.
- '';
- };
- };
};
};
+ imports = [
+ (mkRemovedOptionModule ["networking" "networkmanager" "dynamicHosts"] ''
+ This option was removed because allowing (multiple) regular users to
+ override host entries affecting the whole system opens up a huge attack
+ vector. There seem to be very rare cases where this might be useful.
+ Consider setting system-wide host entries using networking.hosts, provide
+ them via the DNS server in your network, or use environment.etc
+ to add a file into /etc/NetworkManager/dnsmasq.d reconfiguring hostsdir.
+ '')
+ ];
+
###### implementation
@@ -396,12 +358,6 @@ in {
Except if you mark some interfaces as <literal>unmanaged</literal> by NetworkManager.
'';
}
- { assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
- message = ''
- To use networking.networkmanager.dynamicHosts you also need to set
- `networking.networkmanager.dns = "dnsmasq"`
- '';
- }
];
environment.etc = with pkgs; [
@@ -435,12 +391,6 @@ in {
target = "NetworkManager/dispatcher.d/${dispatcherTypesSubdirMap.${s.type}}03userscript${lib.fixedWidthNumber 4 i}";
mode = "0544";
}) cfg.dispatcherScripts
- ++ optional dynamicHostsEnabled
- { target = "NetworkManager/dnsmasq.d/dyndns.conf";
- text = concatMapStrings (n: ''
- hostsdir=/run/NetworkManager/hostsdirs/${n}
- '') (attrNames cfg.dynamicHosts.hostsDirs);
- }
++ optional cfg.enableStrongSwan
{ source = "${pkgs.networkmanager_strongswan}/lib/NetworkManager/VPN/nm-strongswan-service.name";
target = "NetworkManager/VPN/nm-strongswan-service.name";
@@ -496,21 +446,6 @@ in {
systemd.services.ModemManager.aliases = [ "dbus-org.freedesktop.ModemManager1.service" ];
- systemd.services.nm-setup-hostsdirs = mkIf dynamicHostsEnabled {
- wantedBy = [ "NetworkManager.service" ];
- before = [ "NetworkManager.service" ];
- partOf = [ "NetworkManager.service" ];
- script = concatStrings (mapAttrsToList (n: d: ''
- mkdir -p "/run/NetworkManager/hostsdirs/${n}"
- chown "${d.user}:${d.group}" "/run/NetworkManager/hostsdirs/${n}"
- chmod 0775 "/run/NetworkManager/hostsdirs/${n}"
- '') cfg.dynamicHosts.hostsDirs);
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- };
- };
-
systemd.services.NetworkManager-dispatcher = {
wantedBy = [ "network.target" ];
restartTriggers = [ configFile ];
@@ -521,15 +456,19 @@ in {
};
# Turn off NixOS' network management when networking is managed entirely by NetworkManager
- networking = (mkIf (!delegateWireless) {
- useDHCP = false;
- # Use mkDefault to trigger the assertion about the conflict above
- wireless.enable = mkDefault false;
- }) // (mkIf cfg.enableStrongSwan {
- networkmanager.packages = [ pkgs.networkmanager_strongswan ];
- }) // (mkIf enableIwd {
- wireless.iwd.enable = true;
- });
+ networking = mkMerge [
+ (mkIf (!delegateWireless) {
+ useDHCP = false;
+ })
+
+ (mkIf cfg.enableStrongSwan {
+ networkmanager.packages = [ pkgs.networkmanager_strongswan ];
+ })
+
+ (mkIf enableIwd {
+ wireless.iwd.enable = true;
+ })
+ ];
security.polkit.extraConfig = polkitConf;
diff --git a/nixpkgs/nixos/modules/services/networking/nghttpx/default.nix b/nixpkgs/nixos/modules/services/networking/nghttpx/default.nix
index d6e1906e388..881a2670f5d 100644
--- a/nixpkgs/nixos/modules/services/networking/nghttpx/default.nix
+++ b/nixpkgs/nixos/modules/services/networking/nghttpx/default.nix
@@ -96,6 +96,7 @@ in
users.groups.nghttpx = { };
users.users.nghttpx = {
group = config.users.groups.nghttpx.name;
+ isSystemUser = true;
};
diff --git a/nixpkgs/nixos/modules/services/networking/owamp.nix b/nixpkgs/nixos/modules/services/networking/owamp.nix
index 821a0258f4b..dbb2e3b4c40 100644
--- a/nixpkgs/nixos/modules/services/networking/owamp.nix
+++ b/nixpkgs/nixos/modules/services/networking/owamp.nix
@@ -21,6 +21,7 @@ in
name = "owamp";
group = "owamp";
description = "Owamp daemon";
+ isSystemUser = true;
};
users.groups = singleton {
diff --git a/nixpkgs/nixos/modules/services/networking/pdns-recursor.nix b/nixpkgs/nixos/modules/services/networking/pdns-recursor.nix
index ebfdd9f35b7..e55ea363378 100644
--- a/nixpkgs/nixos/modules/services/networking/pdns-recursor.nix
+++ b/nixpkgs/nixos/modules/services/networking/pdns-recursor.nix
@@ -91,10 +91,18 @@ in {
forwardZones = mkOption {
type = types.attrs;
+ default = {};
+ description = ''
+ DNS zones to be forwarded to other authoritative servers.
+ '';
+ };
+
+ forwardZonesRecurse = mkOption {
+ type = types.attrs;
example = { eth = "127.0.0.1:5353"; };
default = {};
description = ''
- DNS zones to be forwarded to other servers.
+ DNS zones to be forwarded to other recursive servers.
'';
};
@@ -158,7 +166,8 @@ in {
webserver-port = cfg.api.port;
webserver-allow-from = cfg.api.allowFrom;
- forward-zones = mapAttrsToList (zone: uri: "${zone}.=${uri}") cfg.forwardZones;
+ forward-zones = mapAttrsToList (zone: uri: "${zone}.=${uri}") cfg.forwardZones;
+ forward-zones-recurse = mapAttrsToList (zone: uri: "${zone}.=${uri}") cfg.forwardZonesRecurse;
export-etc-hosts = cfg.exportHosts;
dnssec = cfg.dnssecValidation;
serve-rfc1918 = cfg.serveRFC1918;
diff --git a/nixpkgs/nixos/modules/services/networking/smokeping.nix b/nixpkgs/nixos/modules/services/networking/smokeping.nix
index d4d0594a9cd..b48b0b3a9d6 100644
--- a/nixpkgs/nixos/modules/services/networking/smokeping.nix
+++ b/nixpkgs/nixos/modules/services/networking/smokeping.nix
@@ -299,7 +299,8 @@ in
mkdir -m 0755 -p ${smokepingHome}/cache ${smokepingHome}/data
rm -f ${smokepingHome}/cropper
ln -s ${cfg.package}/htdocs/cropper ${smokepingHome}/cropper
- cp ${cgiHome} ${smokepingHome}/smokeping.fcgi
+ rm -f ${smokepingHome}/smokeping.fcgi
+ ln -s ${cgiHome} ${smokepingHome}/smokeping.fcgi
${cfg.package}/bin/smokeping --check --config=${configPath}
${cfg.package}/bin/smokeping --static --config=${configPath}
'';
@@ -314,5 +315,7 @@ in
serviceConfig.Restart = "always";
};
};
+
+ meta.maintainers = with lib.maintainers; [ erictapen ];
}
diff --git a/nixpkgs/nixos/modules/services/networking/stunnel.nix b/nixpkgs/nixos/modules/services/networking/stunnel.nix
index cbc899f2b4d..ab51bba2f6a 100644
--- a/nixpkgs/nixos/modules/services/networking/stunnel.nix
+++ b/nixpkgs/nixos/modules/services/networking/stunnel.nix
@@ -57,7 +57,13 @@ let
};
CAPath = mkOption {
- type = types.path;
+ type = types.nullOr types.path;
+ default = null;
+ description = "Path to a directory containing certificates to validate against.";
+ };
+
+ CAFile = mkOption {
+ type = types.nullOr types.path;
default = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
description = "Path to a file containing certificates to validate against.";
};
@@ -196,6 +202,7 @@ in
verifyChain = ${yesNo v.verifyChain}
verifyPeer = ${yesNo v.verifyPeer}
${optionalString (v.CAPath != null) "CApath = ${v.CAPath}"}
+ ${optionalString (v.CAFile != null) "CAFile = ${v.CAFile}"}
${optionalString (v.verifyHostname != null) "checkHost = ${v.verifyHostname}"}
OCSPaia = yes
@@ -216,6 +223,12 @@ in
};
};
+ meta.maintainers = with maintainers; [
+ # Server side
+ lschuermann
+ # Client side
+ das_j
+ ];
};
}
diff --git a/nixpkgs/nixos/modules/services/networking/syncthing.nix b/nixpkgs/nixos/modules/services/networking/syncthing.nix
index 165fd5970cf..b3f2af5b179 100644
--- a/nixpkgs/nixos/modules/services/networking/syncthing.nix
+++ b/nixpkgs/nixos/modules/services/networking/syncthing.nix
@@ -18,6 +18,7 @@ let
fsWatcherEnabled = folder.watch;
fsWatcherDelayS = folder.watchDelay;
ignorePerms = folder.ignorePerms;
+ versioning = folder.versioning;
}) (filterAttrs (
_: folder:
folder.enable
@@ -220,6 +221,69 @@ in {
'';
};
+ versioning = mkOption {
+ default = null;
+ description = ''
+ How to keep changed/deleted files with syncthing.
+ There are 4 different types of versioning with different parameters.
+ See https://docs.syncthing.net/users/versioning.html
+ '';
+ example = [
+ {
+ versioning = {
+ type = "simple";
+ params.keep = "10";
+ };
+ }
+ {
+ versioning = {
+ type = "trashcan";
+ params.cleanoutDays = "1000";
+ };
+ }
+ {
+ versioning = {
+ type = "staggered";
+ params = {
+ cleanInterval = "3600";
+ maxAge = "31536000";
+ versionsPath = "/syncthing/backup";
+ };
+ };
+ }
+ {
+ versioning = {
+ type = "external";
+ params.versionsPath = pkgs.writers.writeBash "backup" ''
+ folderpath="$1"
+ filepath="$2"
+ rm -rf "$folderpath/$filepath"
+ '';
+ };
+ }
+ ];
+ type = with types; nullOr (submodule {
+ options = {
+ type = mkOption {
+ type = enum [ "external" "simple" "staggered" "trashcan" ];
+ description = ''
+ Type of versioning.
+ See https://docs.syncthing.net/users/versioning.html
+ '';
+ };
+ params = mkOption {
+ type = attrsOf (either str path);
+ description = ''
+ Parameters for versioning. Structure depends on versioning.type.
+ See https://docs.syncthing.net/users/versioning.html
+ '';
+ };
+ };
+ });
+ };
+
+
+
rescanInterval = mkOption {
type = types.int;
default = 3600;
diff --git a/nixpkgs/nixos/modules/services/networking/thelounge.nix b/nixpkgs/nixos/modules/services/networking/thelounge.nix
index b1d23372955..875d8f66169 100644
--- a/nixpkgs/nixos/modules/services/networking/thelounge.nix
+++ b/nixpkgs/nixos/modules/services/networking/thelounge.nix
@@ -56,6 +56,7 @@ in {
users.users.thelounge = {
description = "thelounge service user";
group = "thelounge";
+ isSystemUser = true;
};
users.groups.thelounge = {};
systemd.services.thelounge = {
diff --git a/nixpkgs/nixos/modules/services/networking/tinydns.nix b/nixpkgs/nixos/modules/services/networking/tinydns.nix
index 7d5db71601e..79507b2ebcd 100644
--- a/nixpkgs/nixos/modules/services/networking/tinydns.nix
+++ b/nixpkgs/nixos/modules/services/networking/tinydns.nix
@@ -32,11 +32,12 @@ with lib;
config = mkIf config.services.tinydns.enable {
environment.systemPackages = [ pkgs.djbdns ];
- users.users.tinydns = {};
+ users.users.tinydns.isSystemUser = true;
systemd.services.tinydns = {
description = "djbdns tinydns server";
wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
path = with pkgs; [ daemontools djbdns ];
preStart = ''
rm -rf /var/lib/tinydns
diff --git a/nixpkgs/nixos/modules/services/networking/trickster.nix b/nixpkgs/nixos/modules/services/networking/trickster.nix
new file mode 100644
index 00000000000..8760dd5a938
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/networking/trickster.nix
@@ -0,0 +1,112 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.trickster;
+in
+{
+
+ options = {
+ services.trickster = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable Trickster.
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.trickster;
+ defaultText = "pkgs.trickster";
+ description = ''
+ Package that should be used for trickster.
+ '';
+ };
+
+ configFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = ''
+ Path to configuration file.
+ '';
+ };
+
+ instance-id = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Instance ID for when running multiple processes (default null).
+ '';
+ };
+
+ log-level = mkOption {
+ type = types.str;
+ default = "info";
+ description = ''
+ Level of Logging to use (debug, info, warn, error) (default "info").
+ '';
+ };
+
+ metrics-port = mkOption {
+ type = types.port;
+ default = 8082;
+ description = ''
+ Port that the /metrics endpoint will listen on.
+ '';
+ };
+
+ origin = mkOption {
+ type = types.str;
+ default = "http://prometheus:9090";
+ description = ''
+ URL to the Prometheus Origin. Enter it like you would in grafana, e.g., http://prometheus:9090 (default http://prometheus:9090).
+ '';
+ };
+
+ profiler-port = mkOption {
+ type = types.nullOr types.port;
+ default = null;
+ description = ''
+ Port that the /debug/pprof endpoint will listen on.
+ '';
+ };
+
+ proxy-port = mkOption {
+ type = types.port;
+ default = 9090;
+ description = ''
+ Port that the Proxy server will listen on.
+ '';
+ };
+
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.trickster = {
+ description = "Dashboard Accelerator for Prometheus";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ DynamicUser = true;
+ ExecStart = ''
+ ${cfg.package}/bin/trickster \
+ -log-level ${cfg.log-level} \
+ -metrics-port ${toString cfg.metrics-port} \
+ -origin ${cfg.origin} \
+ -proxy-port ${toString cfg.proxy-port} \
+ ${optionalString (cfg.configFile != null) "-config ${cfg.configFile}"} \
+ ${optionalString (cfg.profiler-port != null) "-profiler-port ${cfg.profiler-port}"} \
+ ${optionalString (cfg.instance-id != null) "-instance-id ${cfg.instance-id}"}
+ '';
+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ Restart = "always";
+ };
+ };
+
+ };
+}
+
diff --git a/nixpkgs/nixos/modules/services/networking/vsftpd.nix b/nixpkgs/nixos/modules/services/networking/vsftpd.nix
index 67be60da567..90093d9a78d 100644
--- a/nixpkgs/nixos/modules/services/networking/vsftpd.nix
+++ b/nixpkgs/nixos/modules/services/networking/vsftpd.nix
@@ -34,6 +34,15 @@ let
};
optionDescription = [
+ (yesNoOption "allowWriteableChroot" "allow_writeable_chroot" false ''
+ Allow the use of writeable root inside chroot().
+ '')
+ (yesNoOption "virtualUseLocalPrivs" "virtual_use_local_privs" false ''
+ If enabled, virtual users will use the same privileges as local
+ users. By default, virtual users will use the same privileges as
+ anonymous users, which tends to be more restrictive (especially
+ in terms of write access).
+ '')
(yesNoOption "anonymousUser" "anonymous_enable" false ''
Whether to enable the anonymous FTP user.
'')
@@ -76,9 +85,21 @@ let
outgoing data connections can only connect to the client. Only enable if you
know what you are doing!
'')
- (yesNoOption "ssl_tlsv1" "ssl_tlsv1" true '' '')
- (yesNoOption "ssl_sslv2" "ssl_sslv2" false '' '')
- (yesNoOption "ssl_sslv3" "ssl_sslv3" false '' '')
+ (yesNoOption "ssl_tlsv1" "ssl_tlsv1" true ''
+ Only applies if <option>ssl_enable</option> is activated. If
+ enabled, this option will permit TLS v1 protocol connections.
+ TLS v1 connections are preferred.
+ '')
+ (yesNoOption "ssl_sslv2" "ssl_sslv2" false ''
+ Only applies if <option>ssl_enable</option> is activated. If
+ enabled, this option will permit SSL v2 protocol connections.
+ TLS v1 connections are preferred.
+ '')
+ (yesNoOption "ssl_sslv3" "ssl_sslv3" false ''
+ Only applies if <option>ssl_enable</option> is activated. If
+ enabled, this option will permit SSL v3 protocol connections.
+ TLS v1 connections are preferred.
+ '')
];
configFile = pkgs.writeText "vsftpd.conf"
@@ -98,6 +119,9 @@ let
listen=YES
nopriv_user=vsftpd
secure_chroot_dir=/var/empty
+ ${optionalString (cfg.localRoot != null) ''
+ local_root=${cfg.localRoot}
+ ''}
syslog_enable=YES
${optionalString (pkgs.stdenv.hostPlatform.system == "x86_64-linux") ''
seccomp_sandbox=NO
@@ -106,6 +130,11 @@ let
${optionalString cfg.anonymousUser ''
anon_root=${cfg.anonymousUserHome}
''}
+ ${optionalString cfg.enableVirtualUsers ''
+ guest_enable=YES
+ guest_username=vsftpd
+ pam_service_name=vsftpd
+ ''}
${cfg.extraConfig}
'';
@@ -119,10 +148,7 @@ in
services.vsftpd = {
- enable = mkOption {
- default = false;
- description = "Whether to enable the vsftpd FTP server.";
- };
+ enable = mkEnableOption "vsftpd";
userlist = mkOption {
default = [];
@@ -143,6 +169,61 @@ in
'';
};
+ enableVirtualUsers = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the <literal>pam_userdb</literal>-based
+ virtual user system
+ '';
+ };
+
+ userDbPath = mkOption {
+ type = types.nullOr types.str;
+ example = "/etc/vsftpd/userDb";
+ default = null;
+ description = ''
+ Only applies if <option>enableVirtualUsers</option> is true.
+ Path pointing to the <literal>pam_userdb</literal> user
+ database used by vsftpd to authenticate the virtual users.
+
+ This user list should be stored in the Berkeley DB database
+ format.
+
+ To generate a new user database, create a text file, add
+ your users using the following format:
+ <programlisting>
+ user1
+ password1
+ user2
+ password2
+ </programlisting>
+
+ You can then install <literal>pkgs.db</literal> to generate
+ the Berkeley DB using
+ <programlisting>
+ db_load -T -t hash -f logins.txt userDb.db
+ </programlisting>
+
+ Caution: <literal>pam_userdb</literal> will automatically
+ append a <literal>.db</literal> suffix to the filename you
+ provide though this option. This option shouldn't include
+ this filetype suffix.
+ '';
+ };
+
+ localRoot = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "/var/www/$USER";
+ description = ''
+ This option represents a directory which vsftpd will try to
+ change into after a local (i.e. non- anonymous) login.
+
+ Failure is silently ignored.
+ '';
+ };
+
anonymousUserHome = mkOption {
type = types.path;
default = "/home/ftp/";
@@ -186,18 +267,25 @@ in
config = mkIf cfg.enable {
- assertions = singleton
+ assertions = [
{ assertion =
(cfg.forceLocalLoginsSSL -> cfg.rsaCertFile != null)
&& (cfg.forceLocalDataSSL -> cfg.rsaCertFile != null);
message = "vsftpd: If forceLocalLoginsSSL or forceLocalDataSSL is true then a rsaCertFile must be provided!";
- };
+ }
+ {
+ assertion = (cfg.enableVirtualUsers -> cfg.userDbPath != null)
+ && (cfg.enableVirtualUsers -> cfg.localUsers != null);
+ message = "vsftpd: If enableVirtualUsers is true, you need to setup both the userDbPath and localUsers options.";
+ }];
users.users =
[ { name = "vsftpd";
uid = config.ids.uids.vsftpd;
description = "VSFTPD user";
- home = "/homeless-shelter";
+ home = if cfg.localRoot != null
+ then cfg.localRoot # <= Necessary for virtual users.
+ else "/homeless-shelter";
}
] ++ optional cfg.anonymousUser
{ name = "ftp";
@@ -213,23 +301,24 @@ in
# = false and whitelist root
services.vsftpd.userlist = if cfg.userlistDeny then ["root"] else [];
- systemd.services.vsftpd =
- { description = "Vsftpd Server";
+ systemd = {
+ tmpfiles.rules = optional cfg.anonymousUser
+ #Type Path Mode User Gr Age Arg
+ "d '${builtins.toString cfg.anonymousUserHome}' 0555 'ftp' 'ftp' - -";
+ services.vsftpd = {
+ description = "Vsftpd Server";
wantedBy = [ "multi-user.target" ];
- preStart =
- optionalString cfg.anonymousUser
- ''
- mkdir -p -m 555 ${cfg.anonymousUserHome}
- chown -R ftp:ftp ${cfg.anonymousUserHome}
- '';
-
serviceConfig.ExecStart = "@${vsftpd}/sbin/vsftpd vsftpd ${configFile}";
serviceConfig.Restart = "always";
serviceConfig.Type = "forking";
};
+ };
+ security.pam.services.vsftpd.text = mkIf (cfg.enableVirtualUsers && cfg.userDbPath != null)''
+ auth required pam_userdb.so db=${cfg.userDbPath}
+ account required pam_userdb.so db=${cfg.userDbPath}
+ '';
};
-
}
diff --git a/nixpkgs/nixos/modules/services/networking/wireguard.nix b/nixpkgs/nixos/modules/services/networking/wireguard.nix
index 4176da2c8cb..980961225c9 100644
--- a/nixpkgs/nixos/modules/services/networking/wireguard.nix
+++ b/nixpkgs/nixos/modules/services/networking/wireguard.nix
@@ -112,6 +112,32 @@ let
Determines whether to add allowed IPs as routes or not.
'';
};
+
+ socketNamespace = mkOption {
+ default = null;
+ type = with types; nullOr str;
+ example = "container";
+ description = ''The pre-existing network namespace in which the
+ WireGuard interface is created, and which retains the socket even if the
+ interface is moved via <option>interfaceNamespace</option>. When
+ <literal>null</literal>, the interface is created in the init namespace.
+ See <link
+ xlink:href="https://www.wireguard.com/netns/">documentation</link>.
+ '';
+ };
+
+ interfaceNamespace = mkOption {
+ default = null;
+ type = with types; nullOr str;
+ example = "init";
+ description = ''The pre-existing network namespace the WireGuard
+ interface is moved to. The special value <literal>init</literal> means
+ the init namespace. When <literal>null</literal>, the interface is not
+ moved.
+ See <link
+ xlink:href="https://www.wireguard.com/netns/">documentation</link>.
+ '';
+ };
};
};
@@ -239,6 +265,10 @@ let
if peer.presharedKey != null
then pkgs.writeText "wg-psk" peer.presharedKey
else peer.presharedKeyFile;
+ src = interfaceCfg.socketNamespace;
+ dst = interfaceCfg.interfaceNamespace;
+ ip = nsWrap "ip" src dst;
+ wg = nsWrap "wg" src dst;
in nameValuePair "wireguard-${interfaceName}-peer-${unitName}"
{
description = "WireGuard Peer - ${interfaceName} - ${peer.publicKey}";
@@ -255,16 +285,16 @@ let
};
script = let
- wg_setup = "wg set ${interfaceName} peer ${peer.publicKey}" +
+ wg_setup = "${wg} set ${interfaceName} peer ${peer.publicKey}" +
optionalString (psk != null) " preshared-key ${psk}" +
optionalString (peer.endpoint != null) " endpoint ${peer.endpoint}" +
optionalString (peer.persistentKeepalive != null) " persistent-keepalive ${toString peer.persistentKeepalive}" +
optionalString (peer.allowedIPs != []) " allowed-ips ${concatStringsSep "," peer.allowedIPs}";
route_setup =
- optionalString (interfaceCfg.allowedIPsAsRoutes != false)
+ optionalString interfaceCfg.allowedIPsAsRoutes
(concatMapStringsSep "\n"
(allowedIP:
- "ip route replace ${allowedIP} dev ${interfaceName} table ${interfaceCfg.table}"
+ "${ip} route replace ${allowedIP} dev ${interfaceName} table ${interfaceCfg.table}"
) peer.allowedIPs);
in ''
${wg_setup}
@@ -272,13 +302,13 @@ let
'';
postStop = let
- route_destroy = optionalString (interfaceCfg.allowedIPsAsRoutes != false)
+ route_destroy = optionalString interfaceCfg.allowedIPsAsRoutes
(concatMapStringsSep "\n"
(allowedIP:
- "ip route delete ${allowedIP} dev ${interfaceName} table ${interfaceCfg.table}"
+ "${ip} route delete ${allowedIP} dev ${interfaceName} table ${interfaceCfg.table}"
) peer.allowedIPs);
in ''
- wg set ${interfaceName} peer ${peer.publicKey} remove
+ ${wg} set ${interfaceName} peer ${peer.publicKey} remove
${route_destroy}
'';
};
@@ -287,6 +317,13 @@ let
# exactly one way to specify the private key must be set
#assert (values.privateKey != null) != (values.privateKeyFile != null);
let privKey = if values.privateKeyFile != null then values.privateKeyFile else pkgs.writeText "wg-key" values.privateKey;
+ src = values.socketNamespace;
+ dst = values.interfaceNamespace;
+ ipPreMove = nsWrap "ip" src null;
+ ipPostMove = nsWrap "ip" src dst;
+ wg = nsWrap "wg" src dst;
+ ns = if dst == "init" then "1" else dst;
+
in
nameValuePair "wireguard-${name}"
{
@@ -307,26 +344,33 @@ let
${values.preSetup}
- ip link add dev ${name} type wireguard
+ ${ipPreMove} link add dev ${name} type wireguard
+ ${optionalString (values.interfaceNamespace != null && values.interfaceNamespace != values.socketNamespace) "${ipPreMove} link set ${name} netns ${ns}"}
${concatMapStringsSep "\n" (ip:
- "ip address add ${ip} dev ${name}"
+ "${ipPostMove} address add ${ip} dev ${name}"
) values.ips}
- wg set ${name} private-key ${privKey} ${
+ ${wg} set ${name} private-key ${privKey} ${
optionalString (values.listenPort != null) " listen-port ${toString values.listenPort}"}
- ip link set up dev ${name}
+ ${ipPostMove} link set up dev ${name}
${values.postSetup}
'';
postStop = ''
- ip link del dev ${name}
+ ${ipPostMove} link del dev ${name}
${values.postShutdown}
'';
};
+ nsWrap = cmd: src: dst:
+ let
+ nsList = filter (ns: ns != null) [ src dst ];
+ ns = last nsList;
+ in
+ if (length nsList > 0 && ns != "init") then "ip netns exec ${ns} ${cmd}" else cmd;
in
{
diff --git a/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix b/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix
index 294c0d70ede..8f05c3949fb 100644
--- a/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix
@@ -236,9 +236,12 @@ in {
${if ifaces == [] then ''
for i in $(cd /sys/class/net && echo *); do
DEVTYPE=
- source /sys/class/net/$i/uevent
- if [ "$DEVTYPE" = "wlan" -o -e /sys/class/net/$i/wireless ]; then
- ifaces="$ifaces''${ifaces:+ -N} -i$i"
+ UEVENT_PATH=/sys/class/net/$i/uevent
+ if [ -e "$UEVENT_PATH" ]; then
+ source "$UEVENT_PATH"
+ if [ "$DEVTYPE" = "wlan" -o -e /sys/class/net/$i/wireless ]; then
+ ifaces="$ifaces''${ifaces:+ -N} -i$i"
+ fi
fi
done
'' else ''
diff --git a/nixpkgs/nixos/modules/services/networking/yggdrasil.nix b/nixpkgs/nixos/modules/services/networking/yggdrasil.nix
new file mode 100644
index 00000000000..5d65f8e3413
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/networking/yggdrasil.nix
@@ -0,0 +1,187 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.yggdrasil;
+ configProvided = (cfg.config != {});
+ configAsFile = (if configProvided then
+ toString (pkgs.writeTextFile {
+ name = "yggdrasil-conf";
+ text = builtins.toJSON cfg.config;
+ })
+ else null);
+ configFileProvided = (cfg.configFile != null);
+ generateConfig = (
+ if configProvided && configFileProvided then
+ "${pkgs.jq}/bin/jq -s add /run/yggdrasil/configFile.json ${configAsFile}"
+ else if configProvided then
+ "cat ${configAsFile}"
+ else if configFileProvided then
+ "cat /run/yggdrasil/configFile.json"
+ else
+ "${cfg.package}/bin/yggdrasil -genconf"
+ );
+
+in {
+ options = with types; {
+ services.yggdrasil = {
+ enable = mkEnableOption "the yggdrasil system service";
+
+ configFile = mkOption {
+ type = nullOr str;
+ default = null;
+ example = "/run/keys/yggdrasil.conf";
+ description = ''
+ A file which contains JSON configuration for yggdrasil.
+
+ You do not have to supply a complete configuration, as
+ yggdrasil will use default values for anything which is
+ omitted. If the encryption and signing keys are omitted,
+ yggdrasil will generate new ones each time the service is
+ started, resulting in a random IPv6 address on the yggdrasil
+ network each time.
+
+ If both this option and <option>config</option> are
+ supplied, they will be combined, with values from
+ <option>config</option> taking precedence.
+
+ You can use the command <code>nix-shell -p yggdrasil --run
+ "yggdrasil -genconf -json"</code> to generate a default
+ JSON configuration.
+ '';
+ };
+
+ config = mkOption {
+ type = attrs;
+ default = {};
+ example = {
+ Peers = [
+ "tcp://aa.bb.cc.dd:eeeee"
+ "tcp://[aaaa:bbbb:cccc:dddd::eeee]:fffff"
+ ];
+ Listen = [
+ "tcp://0.0.0.0:xxxxx"
+ ];
+ };
+ description = ''
+ Configuration for yggdrasil, as a Nix attribute set.
+
+ Warning: this is stored in the WORLD-READABLE Nix store!
+ Therefore, it is not appropriate for private keys. If you
+ do not specify the keys, yggdrasil will generate a new set
+ each time the service is started, creating a random IPv6
+ address on the yggdrasil network each time.
+
+ If you wish to specify the keys, use
+ <option>configFile</option>. If both
+ <option>configFile</option> and <option>config</option> are
+ supplied, they will be combined, with values from
+ <option>config</option> taking precedence.
+
+ You can use the command <code>nix-shell -p yggdrasil --run
+ "yggdrasil -genconf"</code> to generate default
+ configuration values with documentation.
+ '';
+ };
+
+ openMulticastPort = mkOption {
+ type = bool;
+ default = false;
+ description = ''
+ Whether to open the UDP port used for multicast peer
+ discovery. The NixOS firewall blocks link-local
+ communication, so in order to make local peering work you
+ will also need to set <code>LinkLocalTCPPort</code> in your
+ yggdrasil configuration (<option>config</option> or
+ <option>configFile</option>) to a port number other than 0,
+ and then add that port to
+ <option>networking.firewall.allowedTCPPorts</option>.
+ '';
+ };
+
+ denyDhcpcdInterfaces = mkOption {
+ type = listOf str;
+ default = [];
+ example = [ "tap*" ];
+ description = ''
+ Disable the DHCP client for any interface whose name matches
+ any of the shell glob patterns in this list. Use this
+ option to prevent the DHCP client from broadcasting requests
+ on the yggdrasil network. It is only necessary to do so
+ when yggdrasil is running in TAP mode, because TUN
+ interfaces do not support broadcasting.
+ '';
+ };
+
+ package = mkOption {
+ type = package;
+ default = pkgs.yggdrasil;
+ defaultText = "pkgs.yggdrasil";
+ description = "Yggdrasil package to use.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = [
+ { assertion = config.networking.enableIPv6;
+ message = "networking.enableIPv6 must be true for yggdrasil to work";
+ }
+ ];
+
+ systemd.services.yggdrasil = {
+ description = "Yggdrasil Network Service";
+ path = [ cfg.package ] ++ optional (configProvided && configFileProvided) pkgs.jq;
+ bindsTo = [ "network-online.target" ];
+ after = [ "network-online.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ preStart = ''
+ ${generateConfig} | yggdrasil -normaliseconf -useconf > /run/yggdrasil/yggdrasil.conf
+ '';
+
+ serviceConfig = {
+ ExecStart = "${cfg.package}/bin/yggdrasil -useconffile /run/yggdrasil/yggdrasil.conf";
+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ Restart = "always";
+
+ RuntimeDirectory = "yggdrasil";
+ RuntimeDirectoryMode = "0700";
+ BindReadOnlyPaths = mkIf configFileProvided
+ [ "${cfg.configFile}:/run/yggdrasil/configFile.json" ];
+
+ # TODO: as of yggdrasil 0.3.8 and systemd 243, yggdrasil fails
+ # to set up the network adapter when DynamicUser is set. See
+ # github.com/yggdrasil-network/yggdrasil-go/issues/557. The
+ # following options are implied by DynamicUser according to
+ # the systemd.exec documentation, and can be removed if the
+ # upstream issue is fixed and DynamicUser is set to true:
+ PrivateTmp = true;
+ RemoveIPC = true;
+ NoNewPrivileges = true;
+ ProtectSystem = "strict";
+ RestrictSUIDSGID = true;
+ # End of list of options implied by DynamicUser.
+
+ AmbientCapabilities = "CAP_NET_ADMIN";
+ CapabilityBoundingSet = "CAP_NET_ADMIN";
+ MemoryDenyWriteExecute = true;
+ ProtectControlGroups = true;
+ ProtectHome = "tmpfs";
+ ProtectKernelModules = true;
+ ProtectKernelTunables = true;
+ RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
+ RestrictNamespaces = true;
+ RestrictRealtime = true;
+ SystemCallArchitectures = "native";
+ SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @resources";
+ };
+ };
+
+ networking.dhcpcd.denyInterfaces = cfg.denyDhcpcdInterfaces;
+ networking.firewall.allowedUDPPorts = mkIf cfg.openMulticastPort [ 9001 ];
+
+ # Make yggdrasilctl available on the command line.
+ environment.systemPackages = [ cfg.package ];
+ };
+ meta.maintainers = with lib.maintainers; [ gazally ];
+}
diff --git a/nixpkgs/nixos/modules/services/networking/znc/default.nix b/nixpkgs/nixos/modules/services/networking/znc/default.nix
index 05f97bfa539..0a9848a4934 100644
--- a/nixpkgs/nixos/modules/services/networking/znc/default.nix
+++ b/nixpkgs/nixos/modules/services/networking/znc/default.nix
@@ -239,7 +239,7 @@ in
services.znc = {
configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString);
config = {
- Version = (builtins.parseDrvName pkgs.znc.name).version;
+ Version = lib.getVersion pkgs.znc;
Listener.l.Port = mkDefault 5000;
Listener.l.SSL = mkDefault true;
};
diff --git a/nixpkgs/nixos/modules/services/printing/cupsd.nix b/nixpkgs/nixos/modules/services/printing/cupsd.nix
index 3fcae611dc7..1071c05d514 100644
--- a/nixpkgs/nixos/modules/services/printing/cupsd.nix
+++ b/nixpkgs/nixos/modules/services/printing/cupsd.nix
@@ -31,7 +31,7 @@ let
# part of CUPS itself, e.g. the SMB backend is part of Samba. Since
# we can't update ${cups.out}/lib/cups itself, we create a symlink tree
# here and add the additional programs. The ServerBin directive in
- # cupsd.conf tells cupsd to use this tree.
+ # cups-files.conf tells cupsd to use this tree.
bindir = pkgs.buildEnv {
name = "cups-progs";
paths =
diff --git a/nixpkgs/nixos/modules/services/scheduling/marathon.nix b/nixpkgs/nixos/modules/services/scheduling/marathon.nix
index 0961a67770e..2e0d20c64b2 100644
--- a/nixpkgs/nixos/modules/services/scheduling/marathon.nix
+++ b/nixpkgs/nixos/modules/services/scheduling/marathon.nix
@@ -93,6 +93,6 @@ in {
};
};
- users.users.${cfg.user} = { };
+ users.users.${cfg.user}.isSystemUser = true;
};
}
diff --git a/nixpkgs/nixos/modules/services/security/bitwarden_rs/default.nix b/nixpkgs/nixos/modules/services/security/bitwarden_rs/default.nix
index 80fd65891ff..d1817db0755 100644
--- a/nixpkgs/nixos/modules/services/security/bitwarden_rs/default.nix
+++ b/nixpkgs/nixos/modules/services/security/bitwarden_rs/default.nix
@@ -74,7 +74,10 @@ in {
webVaultEnabled = mkDefault true;
};
- users.users.bitwarden_rs = { inherit group; };
+ users.users.bitwarden_rs = {
+ inherit group;
+ isSystemUser = true;
+ };
users.groups.bitwarden_rs = { };
systemd.services.bitwarden_rs = {
diff --git a/nixpkgs/nixos/modules/services/security/oauth2_proxy.nix b/nixpkgs/nixos/modules/services/security/oauth2_proxy.nix
index bb03f7fc9e4..2abb9ec32ac 100644
--- a/nixpkgs/nixos/modules/services/security/oauth2_proxy.nix
+++ b/nixpkgs/nixos/modules/services/security/oauth2_proxy.nix
@@ -546,6 +546,7 @@ in
users.users.oauth2_proxy = {
description = "OAuth2 Proxy";
+ isSystemUser = true;
};
systemd.services.oauth2_proxy = {
diff --git a/nixpkgs/nixos/modules/services/security/vault.nix b/nixpkgs/nixos/modules/services/security/vault.nix
index d5962ba9af9..b0ab8fadcbe 100644
--- a/nixpkgs/nixos/modules/services/security/vault.nix
+++ b/nixpkgs/nixos/modules/services/security/vault.nix
@@ -119,9 +119,8 @@ in
};
users.groups.vault.gid = config.ids.gids.vault;
- systemd.tmpfiles.rules = optional (cfg.storagePath != null) [
- "d '${cfg.storagePath}' 0700 vault vault - -"
- ];
+ systemd.tmpfiles.rules = optional (cfg.storagePath != null)
+ "d '${cfg.storagePath}' 0700 vault vault - -";
systemd.services.vault = {
description = "Vault server daemon";
diff --git a/nixpkgs/nixos/modules/services/torrent/magnetico.nix b/nixpkgs/nixos/modules/services/torrent/magnetico.nix
index 02fa2ac0750..719827713ff 100644
--- a/nixpkgs/nixos/modules/services/torrent/magnetico.nix
+++ b/nixpkgs/nixos/modules/services/torrent/magnetico.nix
@@ -35,6 +35,7 @@ let
(if (cfg.web.credentialsFile != null || cfg.web.credentials != { })
then "--credentials=${toString credFile}"
else "--no-auth")
+ "--addr=${address}:${toString port}"
] ++ extraOptions);
in {
@@ -171,12 +172,13 @@ in {
users.users.magnetico = {
description = "Magnetico daemons user";
+ isSystemUser = true;
};
systemd.services.magneticod = {
description = "Magnetico DHT crawler";
wantedBy = [ "multi-user.target" ];
- after = [ "network-online.target" ];
+ after = [ "network.target" ];
serviceConfig = {
User = "magnetico";
@@ -188,7 +190,7 @@ in {
systemd.services.magneticow = {
description = "Magnetico web interface";
wantedBy = [ "multi-user.target" ];
- after = [ "network-online.target" "magneticod.service"];
+ after = [ "network.target" "magneticod.service"];
serviceConfig = {
User = "magnetico";
@@ -201,7 +203,7 @@ in {
assertions =
[
{
- assertion = cfg.web.credentialsFile != null || cfg.web.credentials != { };
+ assertion = cfg.web.credentialsFile == null || cfg.web.credentials == { };
message = ''
The options services.magnetico.web.credentialsFile and
services.magnetico.web.credentials are mutually exclusives.
diff --git a/nixpkgs/nixos/modules/services/web-apps/codimd.nix b/nixpkgs/nixos/modules/services/web-apps/codimd.nix
index 7ae7cd9c52d..5f56f8ed5a0 100644
--- a/nixpkgs/nixos/modules/services/web-apps/codimd.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/codimd.nix
@@ -893,6 +893,7 @@ in
extraGroups = cfg.groups;
home = cfg.workDir;
createHome = true;
+ isSystemUser = true;
};
systemd.services.codimd = {
diff --git a/nixpkgs/nixos/modules/services/web-apps/frab.nix b/nixpkgs/nixos/modules/services/web-apps/frab.nix
index 7914e5cc0ee..a9a30b40922 100644
--- a/nixpkgs/nixos/modules/services/web-apps/frab.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/frab.nix
@@ -177,6 +177,7 @@ in
{ name = cfg.user;
group = cfg.group;
home = "${cfg.statePath}";
+ isSystemUser = true;
}
];
diff --git a/nixpkgs/nixos/modules/services/web-apps/gotify-server.nix b/nixpkgs/nixos/modules/services/web-apps/gotify-server.nix
new file mode 100644
index 00000000000..03e01f46a94
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/web-apps/gotify-server.nix
@@ -0,0 +1,49 @@
+{ pkgs, lib, config, ... }:
+
+with lib;
+
+let
+ cfg = config.services.gotify;
+in {
+ options = {
+ services.gotify = {
+ enable = mkEnableOption "Gotify webserver";
+
+ port = mkOption {
+ type = types.port;
+ description = ''
+ Port the server listens to.
+ '';
+ };
+
+ stateDirectoryName = mkOption {
+ type = types.str;
+ default = "gotify-server";
+ description = ''
+ The name of the directory below <filename>/var/lib</filename> where
+ gotify stores its runtime data.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.gotify-server = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ description = "Simple server for sending and receiving messages";
+
+ environment = {
+ GOTIFY_SERVER_PORT = toString cfg.port;
+ };
+
+ serviceConfig = {
+ WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
+ StateDirectory = cfg.stateDirectoryName;
+ Restart = "always";
+ DynamicUser = "yes";
+ ExecStart = "${pkgs.gotify-server}/bin/server";
+ };
+ };
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/web-apps/limesurvey.nix b/nixpkgs/nixos/modules/services/web-apps/limesurvey.nix
index 68b57a9b90d..bd524524130 100644
--- a/nixpkgs/nixos/modules/services/web-apps/limesurvey.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/limesurvey.nix
@@ -277,7 +277,10 @@ in
systemd.services.httpd.after = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
- users.users.${user}.group = group;
+ users.users.${user} = {
+ group = group;
+ isSystemUser = true;
+ };
};
}
diff --git a/nixpkgs/nixos/modules/services/web-apps/matomo-doc.xml b/nixpkgs/nixos/modules/services/web-apps/matomo-doc.xml
index 8485492c51c..69d1170e452 100644
--- a/nixpkgs/nixos/modules/services/web-apps/matomo-doc.xml
+++ b/nixpkgs/nixos/modules/services/web-apps/matomo-doc.xml
@@ -86,12 +86,6 @@ GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
<itemizedlist>
<listitem>
<para>
- Matomo's file integrity check will warn you. This is due to the patches
- necessary for NixOS, you can safely ignore this.
- </para>
- </listitem>
- <listitem>
- <para>
Matomo will warn you that the JavaScript tracker is not writable. This is
because it's located in the read-only nix store. You can safely ignore
this, unless you need a plugin that needs JavaScript tracker access.
@@ -105,7 +99,7 @@ GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
<para>
You can use other web servers by forwarding calls for
<filename>index.php</filename> and <filename>piwik.php</filename> to the
- <literal>/run/phpfpm-matomo.sock</literal> fastcgi unix socket. You can use
+ <literal><link linkend="opt-services.phpfpm.pools._name_.socket">services.phpfpm.pools.&lt;name&gt;.socket</link></literal> fastcgi unix socket. You can use
the nginx configuration in the module code as a reference to what else
should be configured.
</para>
diff --git a/nixpkgs/nixos/modules/services/web-apps/matomo.nix b/nixpkgs/nixos/modules/services/web-apps/matomo.nix
index 1e34aff8d17..352cc4c647b 100644
--- a/nixpkgs/nixos/modules/services/web-apps/matomo.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/matomo.nix
@@ -2,15 +2,13 @@
with lib;
let
cfg = config.services.matomo;
+ fpm = config.services.phpfpm.pools.${pool};
user = "matomo";
dataDir = "/var/lib/${user}";
deprecatedDataDir = "/var/lib/piwik";
pool = user;
- # it's not possible to use /run/phpfpm/${pool}.sock because /run/phpfpm/ is root:root 0770,
- # and therefore is not accessible by the web server.
- phpSocket = "/run/phpfpm-${pool}.sock";
phpExecutionUnit = "phpfpm-${pool}";
databaseService = "mysql.service";
@@ -50,7 +48,7 @@ in {
default = null;
example = "lighttpd";
description = ''
- Name of the web server user that forwards requests to the ${phpSocket} fastcgi socket for Matomo if the nginx
+ Name of the web server user that forwards requests to <option>services.phpfpm.pools.&lt;name&gt;.socket</option> the fastcgi socket for Matomo if the nginx
option is not used. Either this option or the nginx option is mandatory.
If you want to use another webserver than nginx, you need to set this to that server's user
and pass fastcgi requests to `index.php`, `matomo.php` and `piwik.php` (legacy name) to this socket.
@@ -71,25 +69,6 @@ in {
'';
};
- phpfpmProcessManagerConfig = mkOption {
- type = types.str;
- default = ''
- ; default phpfpm process manager settings
- pm = dynamic
- pm.max_children = 75
- pm.start_servers = 10
- pm.min_spare_servers = 5
- pm.max_spare_servers = 20
- pm.max_requests = 500
-
- ; log worker's stdout, but this has a performance hit
- catch_workers_output = yes
- '';
- description = ''
- Settings for phpfpm's process manager. You might need to change this depending on the load for Matomo.
- '';
- };
-
nginx = mkOption {
type = types.nullOr (types.submodule (
recursiveUpdate
@@ -233,15 +212,24 @@ in {
else if (cfg.webServerUser != null) then cfg.webServerUser else "";
in {
${pool} = {
- listen = phpSocket;
- extraConfig = ''
- listen.owner = ${socketOwner}
- listen.group = root
- listen.mode = 0600
- user = ${user}
- env[PIWIK_USER_PATH] = ${dataDir}
- ${cfg.phpfpmProcessManagerConfig}
+ inherit user;
+ phpOptions = ''
+ error_log = 'stderr'
+ log_errors = on
'';
+ settings = mapAttrs (name: mkDefault) {
+ "listen.owner" = socketOwner;
+ "listen.group" = "root";
+ "listen.mode" = "0660";
+ "pm" = "dynamic";
+ "pm.max_children" = 75;
+ "pm.start_servers" = 10;
+ "pm.min_spare_servers" = 5;
+ "pm.max_spare_servers" = 20;
+ "pm.max_requests" = 500;
+ "catch_workers_output" = true;
+ };
+ phpEnv.PIWIK_USER_PATH = dataDir;
};
};
@@ -264,15 +252,15 @@ in {
};
# allow index.php for webinterface
locations."= /index.php".extraConfig = ''
- fastcgi_pass unix:${phpSocket};
+ fastcgi_pass unix:${fpm.socket};
'';
# allow matomo.php for tracking
locations."= /matomo.php".extraConfig = ''
- fastcgi_pass unix:${phpSocket};
+ fastcgi_pass unix:${fpm.socket};
'';
# allow piwik.php for tracking (deprecated name)
locations."= /piwik.php".extraConfig = ''
- fastcgi_pass unix:${phpSocket};
+ fastcgi_pass unix:${fpm.socket};
'';
# Any other attempt to access any php files is forbidden
locations."~* ^.+\\.php$".extraConfig = ''
diff --git a/nixpkgs/nixos/modules/services/web-apps/mediawiki.nix b/nixpkgs/nixos/modules/services/web-apps/mediawiki.nix
index ec2568bf952..43edc04e1a4 100644
--- a/nixpkgs/nixos/modules/services/web-apps/mediawiki.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/mediawiki.nix
@@ -461,7 +461,10 @@ in
systemd.services.httpd.after = optional (cfg.database.createLocally && cfg.database.type == "mysql") "mysql.service";
- users.users.${user}.group = group;
+ users.users.${user} = {
+ group = group;
+ isSystemUser = true;
+ };
environment.systemPackages = [ mediawikiScripts ];
};
diff --git a/nixpkgs/nixos/modules/services/web-apps/moinmoin.nix b/nixpkgs/nixos/modules/services/web-apps/moinmoin.nix
new file mode 100644
index 00000000000..0fee64be0bb
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/web-apps/moinmoin.nix
@@ -0,0 +1,303 @@
+{ config, lib, pkgs, ... }:
+with lib;
+
+let
+ cfg = config.services.moinmoin;
+ python = pkgs.python27;
+ pkg = python.pkgs.moinmoin;
+ dataDir = "/var/lib/moin";
+ usingGunicorn = cfg.webServer == "nginx-gunicorn" || cfg.webServer == "gunicorn";
+ usingNginx = cfg.webServer == "nginx-gunicorn";
+ user = "moin";
+ group = "moin";
+
+ uLit = s: ''u"${s}"'';
+ indentLines = n: str: concatMapStrings (line: "${fixedWidthString n " " " "}${line}\n") (splitString "\n" str);
+
+ moinCliWrapper = wikiIdent: pkgs.writeShellScriptBin "moin-${wikiIdent}" ''
+ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} -c "${pkg}/bin/moin --config-dir=/var/lib/moin/${wikiIdent}/config $*" ${user}
+ '';
+
+ wikiConfig = wikiIdent: w: ''
+ # -*- coding: utf-8 -*-
+
+ from MoinMoin.config import multiconfig, url_prefix_static
+
+ class Config(multiconfig.DefaultConfig):
+ ${optionalString (w.webLocation != "/") ''
+ url_prefix_static = '${w.webLocation}' + url_prefix_static
+ ''}
+
+ sitename = u'${w.siteName}'
+ page_front_page = u'${w.frontPage}'
+
+ data_dir = '${dataDir}/${wikiIdent}/data'
+ data_underlay_dir = '${dataDir}/${wikiIdent}/underlay'
+
+ language_default = u'${w.languageDefault}'
+ ${optionalString (w.superUsers != []) ''
+ superuser = [${concatMapStringsSep ", " uLit w.superUsers}]
+ ''}
+
+ ${indentLines 4 w.extraConfig}
+ '';
+ wikiConfigFile = name: wiki: pkgs.writeText "${name}.py" (wikiConfig name wiki);
+
+in
+{
+ options.services.moinmoin = with types; {
+ enable = mkEnableOption "MoinMoin Wiki Engine";
+
+ webServer = mkOption {
+ type = enum [ "nginx-gunicorn" "gunicorn" "none" ];
+ default = "nginx-gunicorn";
+ example = "none";
+ description = ''
+ Which web server to use to serve the wiki.
+ Use <literal>none</literal> if you want to configure this yourself.
+ '';
+ };
+
+ gunicorn.workers = mkOption {
+ type = ints.positive;
+ default = 3;
+ example = 10;
+ description = ''
+ The number of worker processes for handling requests.
+ '';
+ };
+
+ wikis = mkOption {
+ type = attrsOf (submodule ({ name, ... }: {
+ options = {
+ siteName = mkOption {
+ type = str;
+ default = "Untitled Wiki";
+ example = "ExampleWiki";
+ description = ''
+ Short description of your wiki site, displayed below the logo on each page, and
+ used in RSS documents as the channel title.
+ '';
+ };
+
+ webHost = mkOption {
+ type = str;
+ description = "Host part of the wiki URL. If undefined, the name of the attribute set will be used.";
+ example = "wiki.example.org";
+ };
+
+ webLocation = mkOption {
+ type = str;
+ default = "/";
+ example = "/moin";
+ description = "Location part of the wiki URL.";
+ };
+
+ frontPage = mkOption {
+ type = str;
+ default = "LanguageSetup";
+ example = "FrontPage";
+ description = ''
+ Front page name. Set this to something like <literal>FrontPage</literal> once languages are
+ configured.
+ '';
+ };
+
+ superUsers = mkOption {
+ type = listOf str;
+ default = [];
+ example = [ "elvis" ];
+ description = ''
+ List of trusted user names with wiki system administration super powers.
+
+ Please note that accounts for these users need to be created using the <command>moin</command> command-line utility, e.g.:
+ <command>moin-<replaceable>WIKINAME</replaceable> account create --name=<replaceable>NAME</replaceable> --email=<replaceable>EMAIL</replaceable> --password=<replaceable>PASSWORD</replaceable></command>.
+ '';
+ };
+
+ languageDefault = mkOption {
+ type = str;
+ default = "en";
+ example = "de";
+ description = "The ISO-639-1 name of the main wiki language. Languages that MoinMoin does not support are ignored.";
+ };
+
+ extraConfig = mkOption {
+ type = lines;
+ default = "";
+ example = ''
+ show_hosts = True
+ search_results_per_page = 100
+ acl_rights_default = u"Known:read,write,delete,revert All:read"
+ logo_string = u"<h2>\U0001f639</h2>"
+ theme_default = u"modernized"
+
+ user_checkbox_defaults = {'show_page_trail': 0, 'edit_on_doubleclick': 0}
+ navi_bar = [u'SomePage'] + multiconfig.DefaultConfig.navi_bar
+ actions_excluded = multiconfig.DefaultConfig.actions_excluded + ['newaccount']
+
+ mail_smarthost = "mail.example.org"
+ mail_from = u"Example.Org Wiki <wiki@example.org>"
+ '';
+ description = ''
+ Additional configuration to be appended verbatim to this wiki's config.
+
+ See <link xlink:href='http://moinmo.in/HelpOnConfiguration' /> for documentation.
+ '';
+ };
+
+ };
+ config = {
+ webHost = mkDefault name;
+ };
+ }));
+ example = literalExample ''
+ {
+ "mywiki" = {
+ siteName = "Example Wiki";
+ webHost = "wiki.example.org";
+ superUsers = [ "admin" ];
+ frontPage = "Index";
+ extraConfig = "page_category_regex = ur'(?P<all>(Category|Kategorie)(?P<key>(?!Template)\S+))'"
+ };
+ }
+ '';
+ description = ''
+ Configurations of the individual wikis. Attribute names must be valid Python
+ identifiers of the form <literal>[A-Za-z_][A-Za-z0-9_]*</literal>.
+
+ For every attribute <replaceable>WIKINAME</replaceable>, a helper script
+ moin-<replaceable>WIKINAME</replaceable> is created which runs the
+ <command>moin</command> command under the <literal>moin</literal> user (to avoid
+ file ownership issues) and with the right configuration directory passed to it.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = forEach (attrNames cfg.wikis) (wname:
+ { assertion = builtins.match "[A-Za-z_][A-Za-z0-9_]*" wname != null;
+ message = "${wname} is not valid Python identifier";
+ }
+ );
+
+ users.users = {
+ moin = {
+ description = "MoinMoin wiki";
+ home = dataDir;
+ group = group;
+ isSystemUser = true;
+ };
+ };
+
+ users.groups = {
+ moin = {
+ members = mkIf usingNginx [ config.services.nginx.user ];
+ };
+ };
+
+ environment.systemPackages = [ pkg ] ++ map moinCliWrapper (attrNames cfg.wikis);
+
+ systemd.services = mkIf usingGunicorn
+ (flip mapAttrs' cfg.wikis (wikiIdent: wiki:
+ nameValuePair "moin-${wikiIdent}"
+ {
+ description = "MoinMoin wiki ${wikiIdent} - gunicorn process";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ restartIfChanged = true;
+ restartTriggers = [ (wikiConfigFile wikiIdent wiki) ];
+
+ environment = let
+ penv = python.buildEnv.override {
+ # setuptools: https://github.com/benoitc/gunicorn/issues/1716
+ extraLibs = [ python.pkgs.gevent python.pkgs.setuptools pkg ];
+ };
+ in {
+ PYTHONPATH = "${dataDir}/${wikiIdent}/config:${penv}/${python.sitePackages}";
+ };
+
+ preStart = ''
+ umask 0007
+ rm -rf ${dataDir}/${wikiIdent}/underlay
+ cp -r ${pkg}/share/moin/underlay ${dataDir}/${wikiIdent}/
+ chmod -R u+w ${dataDir}/${wikiIdent}/underlay
+ '';
+
+ serviceConfig = {
+ User = user;
+ Group = group;
+ WorkingDirectory = "${dataDir}/${wikiIdent}";
+ ExecStart = ''${python.pkgs.gunicorn}/bin/gunicorn moin_wsgi \
+ --name gunicorn-${wikiIdent} \
+ --workers ${toString cfg.gunicorn.workers} \
+ --worker-class gevent \
+ --bind unix:/run/moin/${wikiIdent}/gunicorn.sock
+ '';
+
+ Restart = "on-failure";
+ RestartSec = "2s";
+ StartLimitIntervalSec = "30s";
+
+ StateDirectory = "moin/${wikiIdent}";
+ StateDirectoryMode = "0750";
+ RuntimeDirectory = "moin/${wikiIdent}";
+ RuntimeDirectoryMode = "0750";
+
+ NoNewPrivileges = true;
+ ProtectSystem = "strict";
+ ProtectHome = true;
+ PrivateTmp = true;
+ PrivateDevices = true;
+ PrivateNetwork = true;
+ ProtectKernelTunables = true;
+ ProtectKernelModules = true;
+ ProtectControlGroups = true;
+ RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
+ RestrictNamespaces = true;
+ LockPersonality = true;
+ MemoryDenyWriteExecute = true;
+ RestrictRealtime = true;
+ };
+ }
+ ));
+
+ services.nginx = mkIf usingNginx {
+ enable = true;
+ virtualHosts = flip mapAttrs' cfg.wikis (name: w: nameValuePair w.webHost {
+ forceSSL = mkDefault true;
+ enableACME = mkDefault true;
+ locations."${w.webLocation}" = {
+ extraConfig = ''
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Host $host;
+ proxy_set_header X-Forwarded-Server $host;
+
+ proxy_pass http://unix:/run/moin/${name}/gunicorn.sock;
+ '';
+ };
+ });
+ };
+
+ systemd.tmpfiles.rules = [
+ "d /run/moin 0750 ${user} ${group} - -"
+ "d ${dataDir} 0550 ${user} ${group} - -"
+ ]
+ ++ (concatLists (flip mapAttrsToList cfg.wikis (wikiIdent: wiki: [
+ "d ${dataDir}/${wikiIdent} 0750 ${user} ${group} - -"
+ "d ${dataDir}/${wikiIdent}/config 0550 ${user} ${group} - -"
+ "L+ ${dataDir}/${wikiIdent}/config/wikiconfig.py - - - - ${wikiConfigFile wikiIdent wiki}"
+ # needed in order to pass module name to gunicorn
+ "L+ ${dataDir}/${wikiIdent}/config/moin_wsgi.py - - - - ${pkg}/share/moin/server/moin.wsgi"
+ # seed data files
+ "C ${dataDir}/${wikiIdent}/data 0770 ${user} ${group} - ${pkg}/share/moin/data"
+ # fix nix store permissions
+ "Z ${dataDir}/${wikiIdent}/data 0770 ${user} ${group} - -"
+ ])));
+ };
+
+ meta.maintainers = with lib.maintainers; [ b42 ];
+}
diff --git a/nixpkgs/nixos/modules/services/web-apps/moodle.nix b/nixpkgs/nixos/modules/services/web-apps/moodle.nix
index 211bc17ee19..ac59f9e0012 100644
--- a/nixpkgs/nixos/modules/services/web-apps/moodle.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/moodle.nix
@@ -309,7 +309,9 @@ in
systemd.services.httpd.after = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service";
- users.users.${user}.group = group;
-
+ users.users.${user} = {
+ group = group;
+ isSystemUser = true;
+ };
};
}
diff --git a/nixpkgs/nixos/modules/services/web-apps/nextcloud.nix b/nixpkgs/nixos/modules/services/web-apps/nextcloud.nix
index db5dc915c89..b67f0880878 100644
--- a/nixpkgs/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/nextcloud.nix
@@ -390,6 +390,7 @@ in {
in {
wantedBy = [ "multi-user.target" ];
before = [ "phpfpm-nextcloud.service" ];
+ path = [ occ ];
script = ''
chmod og+x ${cfg.home}
ln -sf ${pkgs.nextcloud}/apps ${cfg.home}/
@@ -467,7 +468,7 @@ in {
};
"/" = {
priority = 200;
- extraConfig = "rewrite ^ /index.php$request_uri;";
+ extraConfig = "rewrite ^ /index.php;";
};
"~ ^/store-apps" = {
priority = 201;
@@ -494,6 +495,7 @@ in {
extraConfig = ''
include ${config.services.nginx.package}/conf/fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(\\/.*)$;
+ try_files $fastcgi_script_name =404;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS ${if cfg.https then "on" else "off"};
fastcgi_param modHeadersAvailable true;
@@ -531,6 +533,7 @@ in {
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
+ add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
client_max_body_size ${cfg.maxUploadSize};
diff --git a/nixpkgs/nixos/modules/services/web-apps/nexus.nix b/nixpkgs/nixos/modules/services/web-apps/nexus.nix
index 3af97e146d0..d4d507362c9 100644
--- a/nixpkgs/nixos/modules/services/web-apps/nexus.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/nexus.nix
@@ -68,6 +68,7 @@ in
-Dkaraf.data=${cfg.home}/nexus3
-Djava.io.tmpdir=${cfg.home}/nexus3/tmp
-Dkaraf.startLocalConsole=false
+ -Djava.endorsed.dirs=${cfg.package}/lib/endorsed
'';
description = ''
diff --git a/nixpkgs/nixos/modules/services/web-apps/trac.nix b/nixpkgs/nixos/modules/services/web-apps/trac.nix
new file mode 100644
index 00000000000..207fb857438
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/web-apps/trac.nix
@@ -0,0 +1,79 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.services.trac;
+
+ inherit (lib) mkEnableOption mkIf mkOption types;
+
+in {
+
+ options = {
+
+ services.trac = {
+ enable = mkEnableOption "Trac service";
+
+ listen = {
+ ip = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP address that Trac should listen on.
+ '';
+ };
+
+ port = mkOption {
+ type = types.port;
+ default = 8000;
+ description = ''
+ Listen port for Trac.
+ '';
+ };
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/trac";
+ type = types.path;
+ description = ''
+ The directory for storing the Trac data.
+ '';
+ };
+
+ openFirewall = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Open ports in the firewall for Trac.
+ '';
+ };
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services.trac = {
+ description = "Trac server";
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ DynamicUser = true;
+ StateDirectory = baseNameOf cfg.dataDir;
+ ExecStart = ''
+ ${pkgs.trac}/bin/tracd -s \
+ -b ${toString cfg.listen.ip} \
+ -p ${toString cfg.listen.port} \
+ ${cfg.dataDir}
+ '';
+ };
+ preStart = ''
+ if [ ! -e ${cfg.dataDir}/VERSION ]; then
+ ${pkgs.trac}/bin/trac-admin ${cfg.dataDir} initenv Trac "sqlite:db/trac.db"
+ fi
+ '';
+ };
+
+ networking.firewall = mkIf cfg.openFirewall {
+ allowedTCPPorts = [ cfg.listen.port ];
+ };
+
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/web-apps/virtlyst.nix b/nixpkgs/nixos/modules/services/web-apps/virtlyst.nix
index e5c0bff2168..37bdbb0e3b4 100644
--- a/nixpkgs/nixos/modules/services/web-apps/virtlyst.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/virtlyst.nix
@@ -54,6 +54,7 @@ in
home = stateDir;
createHome = true;
group = mkIf config.virtualisation.libvirtd.enable "libvirtd";
+ isSystemUser = true;
};
systemd.services.virtlyst = {
diff --git a/nixpkgs/nixos/modules/services/web-apps/wordpress.nix b/nixpkgs/nixos/modules/services/web-apps/wordpress.nix
index e311dd917dd..f1370c2854b 100644
--- a/nixpkgs/nixos/modules/services/web-apps/wordpress.nix
+++ b/nixpkgs/nixos/modules/services/web-apps/wordpress.nix
@@ -367,7 +367,10 @@ in
})
];
- users.users.${user}.group = group;
+ users.users.${user} = {
+ group = group;
+ isSystemUser = true;
+ };
};
}
diff --git a/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix
index b0374d949fc..f5a6051b4b5 100644
--- a/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -6,6 +6,8 @@ let
mainCfg = config.services.httpd;
+ runtimeDir = "/run/httpd";
+
httpd = mainCfg.package.out;
httpdConf = mainCfg.configFile;
@@ -27,103 +29,29 @@ let
listenToString = l: "${l.ip}:${toString l.port}";
- extraModules = attrByPath ["extraModules"] [] mainCfg;
- extraForeignModules = filter isAttrs extraModules;
- extraApacheModules = filter isString extraModules;
-
-
- makeServerInfo = cfg: {
- # Canonical name must not include a trailing slash.
- canonicalNames =
- let defaultPort = (head (defaultListen cfg)).port; in
- map (port:
- (if cfg.enableSSL then "https" else "http") + "://" +
- cfg.hostName +
- (if port != defaultPort then ":${toString port}" else "")
- ) (map (x: x.port) (getListen cfg));
-
- # Admin address: inherit from the main server if not specified for
- # a virtual host.
- adminAddr = if cfg.adminAddr != null then cfg.adminAddr else mainCfg.adminAddr;
-
- vhostConfig = cfg;
- serverConfig = mainCfg;
- fullConfig = config; # machine config
- };
-
-
allHosts = [mainCfg] ++ mainCfg.virtualHosts;
-
- callSubservices = serverInfo: defs:
- let f = svc:
- let
- svcFunction =
- if svc ? function then svc.function
- # instead of using serviceType="mediawiki"; you can copy mediawiki.nix to any location outside nixpkgs, modify it at will, and use serviceExpression=./mediawiki.nix;
- else if svc ? serviceExpression then import (toString svc.serviceExpression)
- else import (toString "${toString ./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix");
- config = (evalModules
- { modules = [ { options = res.options; config = svc.config or svc; } ];
- check = false;
- }).config;
- defaults = {
- extraConfig = "";
- extraModules = [];
- extraModulesPre = [];
- extraPath = [];
- extraServerPath = [];
- globalEnvVars = [];
- robotsEntries = "";
- startupScript = "";
- enablePHP = false;
- enablePerl = false;
- phpOptions = "";
- options = {};
- documentRoot = null;
- };
- res = defaults // svcFunction { inherit config lib pkgs serverInfo php; };
- in res;
- in map f defs;
-
-
- # !!! callSubservices is expensive
- subservicesFor = cfg: callSubservices (makeServerInfo cfg) cfg.extraSubservices;
-
- mainSubservices = subservicesFor mainCfg;
-
- allSubservices = mainSubservices ++ concatMap subservicesFor mainCfg.virtualHosts;
-
-
enableSSL = any (vhost: vhost.enableSSL) allHosts;
+ enableUserDir = any (vhost: vhost.enableUserDir) allHosts;
- # Names of modules from ${httpd}/modules that we want to load.
- apacheModules =
- [ # HTTP authentication mechanisms: basic and digest.
- "auth_basic" "auth_digest"
-
- # Authentication: is the user who he claims to be?
- "authn_file" "authn_dbm" "authn_anon" "authn_core"
-
- # Authorization: is the user allowed access?
- "authz_user" "authz_groupfile" "authz_host" "authz_core"
-
- # Other modules.
- "ext_filter" "include" "log_config" "env" "mime_magic"
- "cern_meta" "expires" "headers" "usertrack" /* "unique_id" */ "setenvif"
- "mime" "dav" "status" "autoindex" "asis" "info" "dav_fs"
- "vhost_alias" "negotiation" "dir" "imagemap" "actions" "speling"
- "userdir" "alias" "rewrite" "proxy" "proxy_http"
- "unixd" "cache" "cache_disk" "slotmem_shm" "socache_shmcb"
+ # NOTE: generally speaking order of modules is very important
+ modules =
+ [ # required apache modules our httpd service cannot run without
+ "authn_core" "authz_core"
+ "log_config"
+ "mime" "autoindex" "negotiation" "dir"
+ "alias" "rewrite"
+ "unixd" "slotmem_shm" "socache_shmcb"
"mpm_${mainCfg.multiProcessingModule}"
-
- # For compatibility with old configurations, the new module mod_access_compat is provided.
- "access_compat"
]
++ (if mainCfg.multiProcessingModule == "prefork" then [ "cgi" ] else [ "cgid" ])
++ optional enableSSL "ssl"
- ++ extraApacheModules;
+ ++ optional enableUserDir "userdir"
+ ++ optional mainCfg.enableMellon { name = "auth_mellon"; path = "${pkgs.apacheHttpdPackages.mod_auth_mellon}/modules/mod_auth_mellon.so"; }
+ ++ optional mainCfg.enablePHP { name = "php${phpMajorVersion}"; path = "${php}/modules/libphp${phpMajorVersion}.so"; }
+ ++ optional mainCfg.enablePerl { name = "perl"; path = "${mod_perl}/modules/mod_perl.so"; }
+ ++ mainCfg.extraModules;
allDenied = "Require all denied";
@@ -147,20 +75,22 @@ let
browserHacks = ''
- BrowserMatch "Mozilla/2" nokeepalive
- BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
- BrowserMatch "RealPlayer 4\.0" force-response-1.0
- BrowserMatch "Java/1\.0" force-response-1.0
- BrowserMatch "JDK/1\.0" force-response-1.0
- BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
- BrowserMatch "^WebDrive" redirect-carefully
- BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
- BrowserMatch "^gnome-vfs" redirect-carefully
+ <IfModule mod_setenvif.c>
+ BrowserMatch "Mozilla/2" nokeepalive
+ BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
+ BrowserMatch "RealPlayer 4\.0" force-response-1.0
+ BrowserMatch "Java/1\.0" force-response-1.0
+ BrowserMatch "JDK/1\.0" force-response-1.0
+ BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
+ BrowserMatch "^WebDrive" redirect-carefully
+ BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
+ BrowserMatch "^gnome-vfs" redirect-carefully
+ </IfModule>
'';
sslConf = ''
- SSLSessionCache shmcb:${mainCfg.stateDir}/ssl_scache(512000)
+ SSLSessionCache shmcb:${runtimeDir}/ssl_scache(512000)
Mutex posixsem
@@ -188,13 +118,18 @@ let
perServerConf = isMainServer: cfg: let
- serverInfo = makeServerInfo cfg;
-
- subservices = callSubservices serverInfo cfg.extraSubservices;
+ # Canonical name must not include a trailing slash.
+ canonicalNames =
+ let defaultPort = (head (defaultListen cfg)).port; in
+ map (port:
+ (if cfg.enableSSL then "https" else "http") + "://" +
+ cfg.hostName +
+ (if port != defaultPort then ":${toString port}" else "")
+ ) (map (x: x.port) (getListen cfg));
maybeDocumentRoot = fold (svc: acc:
if acc == null then svc.documentRoot else assert svc.documentRoot == null; acc
- ) null ([ cfg ] ++ subservices);
+ ) null ([ cfg ]);
documentRoot = if maybeDocumentRoot != null then maybeDocumentRoot else
pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out";
@@ -209,15 +144,11 @@ let
</Directory>
'';
- robotsTxt =
- concatStringsSep "\n" (filter (x: x != "") (
- # If this is a vhost, the include the entries for the main server as well.
- (if isMainServer then [] else [mainCfg.robotsEntries] ++ map (svc: svc.robotsEntries) mainSubservices)
- ++ [cfg.robotsEntries]
- ++ (map (svc: svc.robotsEntries) subservices)));
+ # If this is a vhost, the include the entries for the main server as well.
+ robotsTxt = concatStringsSep "\n" (filter (x: x != "") ([ cfg.robotsEntries ] ++ lib.optional (!isMainServer) mainCfg.robotsEntries));
in ''
- ${concatStringsSep "\n" (map (n: "ServerName ${n}") serverInfo.canonicalNames)}
+ ${concatStringsSep "\n" (map (n: "ServerName ${n}") canonicalNames)}
${concatMapStrings (alias: "ServerAlias ${alias}\n") cfg.serverAliases}
@@ -292,8 +223,6 @@ let
in concatMapStrings makeDirConf cfg.servedDirs
}
- ${concatMapStrings (svc: svc.extraConfig) subservices}
-
${cfg.extraConfig}
'';
@@ -302,13 +231,13 @@ let
ServerRoot ${httpd}
- DefaultRuntimeDir ${mainCfg.stateDir}/runtime
+ DefaultRuntimeDir ${runtimeDir}/runtime
- PidFile ${mainCfg.stateDir}/httpd.pid
+ PidFile ${runtimeDir}/httpd.pid
${optionalString (mainCfg.multiProcessingModule != "prefork") ''
# mod_cgid requires this.
- ScriptSock ${mainCfg.stateDir}/cgisock
+ ScriptSock ${runtimeDir}/cgisock
''}
<IfModule prefork.c>
@@ -327,16 +256,12 @@ let
Group ${mainCfg.group}
${let
- load = {name, path}: "LoadModule ${name}_module ${path}\n";
- allModules =
- concatMap (svc: svc.extraModulesPre) allSubservices
- ++ map (name: {inherit name; path = "${httpd}/modules/mod_${name}.so";}) apacheModules
- ++ optional mainCfg.enableMellon { name = "auth_mellon"; path = "${pkgs.apacheHttpdPackages.mod_auth_mellon}/modules/mod_auth_mellon.so"; }
- ++ optional enablePHP { name = "php${phpMajorVersion}"; path = "${php}/modules/libphp${phpMajorVersion}.so"; }
- ++ optional enablePerl { name = "perl"; path = "${mod_perl}/modules/mod_perl.so"; }
- ++ concatMap (svc: svc.extraModules) allSubservices
- ++ extraForeignModules;
- in concatMapStrings load (unique allModules)
+ mkModule = module:
+ if isString module then { name = module; path = "${httpd}/modules/mod_${module}.so"; }
+ else if isAttrs module then { inherit (module) name path; }
+ else throw "Expecting either a string or attribute set including a name and path.";
+ in
+ concatMapStringsSep "\n" (module: "LoadModule ${module.name}_module ${module.path}") (unique (map mkModule modules))
}
AddHandler type-map var
@@ -385,17 +310,10 @@ let
}
'';
-
- enablePHP = mainCfg.enablePHP || any (svc: svc.enablePHP) allSubservices;
-
- enablePerl = mainCfg.enablePerl || any (svc: svc.enablePerl) allSubservices;
-
-
# Generate the PHP configuration file. Should probably be factored
# out into a separate module.
phpIni = pkgs.runCommand "php.ini"
- { options = concatStringsSep "\n"
- ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices));
+ { options = mainCfg.phpOptions;
preferLocalBuild = true;
}
''
@@ -408,6 +326,11 @@ in
{
+ imports = [
+ (mkRemovedOptionModule [ "services" "httpd" "extraSubservices" ] "Most existing subservices have been ported to the NixOS module system. Please update your configuration accordingly.")
+ (mkRemovedOptionModule [ "services" "httpd" "stateDir" ] "The httpd module now uses /run/httpd as a runtime directory.")
+ ];
+
###### interface
options = {
@@ -453,7 +376,12 @@ in
extraModules = mkOption {
type = types.listOf types.unspecified;
default = [];
- example = literalExample ''[ "proxy_connect" { name = "php5"; path = "''${pkgs.php}/modules/libphp5.so"; } ]'';
+ example = literalExample ''
+ [
+ "proxy_connect"
+ { name = "jk"; path = "''${pkgs.tomcat_connectors}/modules/mod_jk.so"; }
+ ]
+ '';
description = ''
Additional Apache modules to be used. These can be
specified as a string in the case of modules distributed
@@ -500,16 +428,6 @@ in
'';
};
- stateDir = mkOption {
- type = types.path;
- default = "/run/httpd";
- description = ''
- Directory for Apache's transient runtime state (such as PID
- files). It is created automatically. Note that the default,
- <filename>/run/httpd</filename>, is deleted at boot time.
- '';
- };
-
virtualHosts = mkOption {
type = types.listOf (types.submodule (
{ options = import ./per-server-options.nix {
@@ -637,8 +555,6 @@ in
message = "SSL is enabled for httpd, but sslServerCert and/or sslServerKey haven't been specified."; }
];
- warnings = map (cfg: "apache-httpd's extraSubservices option is deprecated. Most existing subservices have been ported to the NixOS module system. Please update your configuration accordingly.") (lib.filter (cfg: cfg.extraSubservices != []) allHosts);
-
users.users = optionalAttrs (mainCfg.user == "wwwrun") (singleton
{ name = "wwwrun";
group = mainCfg.group;
@@ -651,7 +567,7 @@ in
gid = config.ids.gids.wwwrun;
});
- environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
+ environment.systemPackages = [httpd];
services.httpd.phpOptions =
''
@@ -666,6 +582,28 @@ in
date.timezone = "${config.time.timeZone}"
'';
+ services.httpd.extraModules = mkBefore [
+ # HTTP authentication mechanisms: basic and digest.
+ "auth_basic" "auth_digest"
+
+ # Authentication: is the user who he claims to be?
+ "authn_file" "authn_dbm" "authn_anon"
+
+ # Authorization: is the user allowed access?
+ "authz_user" "authz_groupfile" "authz_host"
+
+ # Other modules.
+ "ext_filter" "include" "env" "mime_magic"
+ "cern_meta" "expires" "headers" "usertrack" "setenvif"
+ "dav" "status" "asis" "info" "dav_fs"
+ "vhost_alias" "imagemap" "actions" "speling"
+ "proxy" "proxy_http"
+ "cache" "cache_disk"
+
+ # For compatibility with old configurations, the new module mod_access_compat is provided.
+ "access_compat"
+ ];
+
systemd.services.httpd =
{ description = "Apache HTTPD";
@@ -674,22 +612,14 @@ in
path =
[ httpd pkgs.coreutils pkgs.gnugrep ]
- ++ optional enablePHP pkgs.system-sendmail # Needed for PHP's mail() function.
- ++ concatMap (svc: svc.extraServerPath) allSubservices;
+ ++ optional mainCfg.enablePHP pkgs.system-sendmail; # Needed for PHP's mail() function.
environment =
- optionalAttrs enablePHP { PHPRC = phpIni; }
- // optionalAttrs mainCfg.enableMellon { LD_LIBRARY_PATH = "${pkgs.xmlsec}/lib"; }
- // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
+ optionalAttrs mainCfg.enablePHP { PHPRC = phpIni; }
+ // optionalAttrs mainCfg.enableMellon { LD_LIBRARY_PATH = "${pkgs.xmlsec}/lib"; };
preStart =
''
- mkdir -m 0750 -p ${mainCfg.stateDir}
- [ $(id -u) != 0 ] || chown root.${mainCfg.group} ${mainCfg.stateDir}
-
- mkdir -m 0750 -p "${mainCfg.stateDir}/runtime"
- [ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
-
mkdir -m 0700 -p ${mainCfg.logDir}
# Get rid of old semaphores. These tend to accumulate across
@@ -698,21 +628,18 @@ in
for i in $(${pkgs.utillinux}/bin/ipcs -s | grep ' ${mainCfg.user} ' | cut -f2 -d ' '); do
${pkgs.utillinux}/bin/ipcrm -s $i
done
-
- # Run the startup hooks for the subservices.
- for i in ${toString (map (svn: svn.startupScript) allSubservices)}; do
- echo Running Apache startup hook $i...
- $i
- done
'';
serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf}";
serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop";
serviceConfig.ExecReload = "${httpd}/bin/httpd -f ${httpdConf} -k graceful";
+ serviceConfig.Group = mainCfg.group;
serviceConfig.Type = "forking";
- serviceConfig.PIDFile = "${mainCfg.stateDir}/httpd.pid";
+ serviceConfig.PIDFile = "${runtimeDir}/httpd.pid";
serviceConfig.Restart = "always";
serviceConfig.RestartSec = "5s";
+ serviceConfig.RuntimeDirectory = "httpd httpd/runtime";
+ serviceConfig.RuntimeDirectoryMode = "0750";
};
};
diff --git a/nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
index 9d747549c27..c36207d5460 100644
--- a/nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
@@ -133,12 +133,6 @@ with lib;
'';
};
- extraSubservices = mkOption {
- type = types.listOf types.unspecified;
- default = [];
- description = "Extra subservices to enable in the webserver.";
- };
-
enableUserDir = mkOption {
type = types.bool;
default = false;
diff --git a/nixpkgs/nixos/modules/services/web-servers/hitch/default.nix b/nixpkgs/nixos/modules/services/web-servers/hitch/default.nix
index a6c4cbea122..1812f225b74 100644
--- a/nixpkgs/nixos/modules/services/web-servers/hitch/default.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/hitch/default.nix
@@ -102,7 +102,10 @@ with lib;
environment.systemPackages = [ pkgs.hitch ];
- users.users.hitch.group = "hitch";
+ users.users.hitch = {
+ group = "hitch";
+ isSystemUser = true;
+ };
users.groups.hitch = {};
};
}
diff --git a/nixpkgs/nixos/modules/services/web-servers/nginx/location-options.nix b/nixpkgs/nixos/modules/services/web-servers/nginx/location-options.nix
index aeb9b1dd79e..2b3749d8a74 100644
--- a/nixpkgs/nixos/modules/services/web-servers/nginx/location-options.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/nginx/location-options.nix
@@ -1,4 +1,4 @@
-# This file defines the options that can be used both for the Apache
+# This file defines the options that can be used both for the Nginx
# main server configuration, and for the virtual hosts. (The latter
# has additional options that affect the web server as a whole, like
# the user/group to run under.)
@@ -92,4 +92,3 @@ with lib;
};
};
}
-
diff --git a/nixpkgs/nixos/modules/services/web-servers/nginx/vhost-options.nix b/nixpkgs/nixos/modules/services/web-servers/nginx/vhost-options.nix
index 15b933c984a..7e488f33a41 100644
--- a/nixpkgs/nixos/modules/services/web-servers/nginx/vhost-options.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/nginx/vhost-options.nix
@@ -1,4 +1,4 @@
-# This file defines the options that can be used both for the Apache
+# This file defines the options that can be used both for the Nginx
# main server configuration, and for the virtual hosts. (The latter
# has additional options that affect the web server as a whole, like
# the user/group to run under.)
diff --git a/nixpkgs/nixos/modules/services/web-servers/phpfpm/default.nix b/nixpkgs/nixos/modules/services/web-servers/phpfpm/default.nix
index 4ab7e3f0c0a..7698f8c3a26 100644
--- a/nixpkgs/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -31,7 +31,7 @@ let
'';
passAsFile = [ "nixDefaults" "phpOptions" ];
} ''
- cat $phpPackage/etc/php.ini $nixDefaultsPath $phpOptionsPath > $out
+ cat ${poolOpts.phpPackage}/etc/php.ini $nixDefaultsPath $phpOptionsPath > $out
'';
poolOpts = { name, ... }:
@@ -69,8 +69,6 @@ let
phpOptions = mkOption {
type = types.lines;
- default = cfg.phpOptions;
- defaultText = "config.services.phpfpm.phpOptions";
description = ''
"Options appended to the PHP configuration file <filename>php.ini</filename> used for this PHP-FPM pool."
'';
@@ -137,6 +135,7 @@ let
config = {
socket = if poolOpts.listen == "" then "${runtimeDir}/${name}.sock" else poolOpts.listen;
group = mkDefault poolOpts.user;
+ phpOptions = mkBefore cfg.phpOptions;
settings = mapAttrs (name: mkDefault){
listen = poolOpts.socket;
@@ -263,6 +262,7 @@ in {
in {
Slice = "phpfpm.slice";
PrivateDevices = true;
+ PrivateTmp = true;
ProtectSystem = "full";
ProtectHome = true;
# XXX: We need AF_NETLINK to make the sendmail SUID binary from postfix work
diff --git a/nixpkgs/nixos/modules/services/web-servers/traefik.nix b/nixpkgs/nixos/modules/services/web-servers/traefik.nix
index 8de7df0d446..5b0fc467ea4 100644
--- a/nixpkgs/nixos/modules/services/web-servers/traefik.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/traefik.nix
@@ -117,6 +117,7 @@ in {
group = "traefik";
home = cfg.dataDir;
createHome = true;
+ isSystemUser = true;
};
users.groups.traefik = {};
diff --git a/nixpkgs/nixos/modules/services/web-servers/ttyd.nix b/nixpkgs/nixos/modules/services/web-servers/ttyd.nix
new file mode 100644
index 00000000000..01a01d97a23
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/web-servers/ttyd.nix
@@ -0,0 +1,196 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.ttyd;
+
+ # Command line arguments for the ttyd daemon
+ args = [ "--port" (toString cfg.port) ]
+ ++ optionals (cfg.socket != null) [ "--interface" cfg.socket ]
+ ++ optionals (cfg.interface != null) [ "--interface" cfg.interface ]
+ ++ [ "--signal" (toString cfg.signal) ]
+ ++ (concatLists (mapAttrsToList (_k: _v: [ "--client-option" "${_k}=${_v}" ]) cfg.clientOptions))
+ ++ [ "--terminal-type" cfg.terminalType ]
+ ++ optionals cfg.checkOrigin [ "--check-origin" ]
+ ++ [ "--max-clients" (toString cfg.maxClients) ]
+ ++ optionals (cfg.indexFile != null) [ "--index" cfg.indexFile ]
+ ++ optionals cfg.enableIPv6 [ "--ipv6" ]
+ ++ optionals cfg.enableSSL [ "--ssl-cert" cfg.certFile
+ "--ssl-key" cfg.keyFile
+ "--ssl-ca" cfg.caFile ]
+ ++ [ "--debug" (toString cfg.logLevel) ];
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+ services.ttyd = {
+ enable = mkEnableOption "ttyd daemon";
+
+ port = mkOption {
+ type = types.int;
+ default = 7681;
+ description = "Port to listen on (use 0 for random port)";
+ };
+
+ socket = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ example = "/var/run/ttyd.sock";
+ description = "UNIX domain socket path to bind.";
+ };
+
+ interface = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "eth0";
+ description = "Network interface to bind.";
+ };
+
+ username = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Username for basic authentication.";
+ };
+
+ passwordFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ apply = value: if value == null then null else toString value;
+ description = ''
+ File containing the password to use for basic authentication.
+ For insecurely putting the password in the globally readable store use
+ <literal>pkgs.writeText "ttydpw" "MyPassword"</literal>.
+ '';
+ };
+
+ signal = mkOption {
+ type = types.ints.u8;
+ default = 1;
+ description = "Signal to send to the command on session close.";
+ };
+
+ clientOptions = mkOption {
+ type = types.attrsOf types.str;
+ default = {};
+ example = literalExample ''{
+ fontSize = "16";
+ fontFamily = "Fira Code";
+
+ }'';
+ description = ''
+ Attribute set of client options for xtermjs.
+ <link xlink:href="https://xtermjs.org/docs/api/terminal/interfaces/iterminaloptions/"/>
+ '';
+ };
+
+ terminalType = mkOption {
+ type = types.str;
+ default = "xterm-256color";
+ description = "Terminal type to report.";
+ };
+
+ checkOrigin = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to allow a websocket connection from a different origin.";
+ };
+
+ maxClients = mkOption {
+ type = types.int;
+ default = 0;
+ description = "Maximum clients to support (0, no limit)";
+ };
+
+ indexFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = "Custom index.html path";
+ };
+
+ enableIPv6 = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether or not to enable IPv6 support.";
+ };
+
+ enableSSL = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether or not to enable SSL (https) support.";
+ };
+
+ certFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = "SSL certificate file path.";
+ };
+
+ keyFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ apply = value: if value == null then null else toString value;
+ description = ''
+ SSL key file path.
+ For insecurely putting the keyFile in the globally readable store use
+ <literal>pkgs.writeText "ttydKeyFile" "SSLKEY"</literal>.
+ '';
+ };
+
+ caFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = "SSL CA file path for client certificate verification.";
+ };
+
+ logLevel = mkOption {
+ type = types.int;
+ default = 7;
+ description = "Set log level.";
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ assertions =
+ [ { assertion = cfg.enableSSL
+ -> cfg.certFile != null && cfg.keyFile != null && cfg.caFile != null;
+ message = "SSL is enabled for ttyd, but no certFile, keyFile or caFile has been specefied."; }
+ { assertion = ! (cfg.interface != null && cfg.socket != null);
+ message = "Cannot set both interface and socket for ttyd."; }
+ { assertion = (cfg.username != null) == (cfg.passwordFile != null);
+ message = "Need to set both username and passwordFile for ttyd"; }
+ ];
+
+ systemd.services.ttyd = {
+ description = "ttyd Web Server Daemon";
+
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ # Runs login which needs to be run as root
+ # login: Cannot possibly work without effective root
+ User = "root";
+ };
+
+ script = if cfg.passwordFile != null then ''
+ PASSWORD=$(cat ${escapeShellArg cfg.passwordFile})
+ ${pkgs.ttyd}/bin/ttyd ${lib.escapeShellArgs args} \
+ --credential ${escapeShellArg cfg.username}:"$PASSWORD" \
+ ${pkgs.shadow}/bin/login
+ ''
+ else ''
+ ${pkgs.ttyd}/bin/ttyd ${lib.escapeShellArgs args} \
+ ${pkgs.shadow}/bin/login
+ '';
+ };
+ };
+}
diff --git a/nixpkgs/nixos/modules/services/web-servers/unit/default.nix b/nixpkgs/nixos/modules/services/web-servers/unit/default.nix
index a4a9d370d64..32f6d475b34 100644
--- a/nixpkgs/nixos/modules/services/web-servers/unit/default.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/unit/default.nix
@@ -116,6 +116,7 @@ in {
users.users = optionalAttrs (cfg.user == "unit") (singleton {
name = "unit";
group = cfg.group;
+ isSystemUser = true;
});
users.groups = optionalAttrs (cfg.group == "unit") (singleton {
diff --git a/nixpkgs/nixos/modules/services/web-servers/varnish/default.nix b/nixpkgs/nixos/modules/services/web-servers/varnish/default.nix
index 63f967185c2..01fe3d12917 100644
--- a/nixpkgs/nixos/modules/services/web-servers/varnish/default.nix
+++ b/nixpkgs/nixos/modules/services/web-servers/varnish/default.nix
@@ -15,8 +15,8 @@ in
package = mkOption {
type = types.package;
- default = pkgs.varnish5;
- defaultText = "pkgs.varnish5";
+ default = pkgs.varnish;
+ defaultText = "pkgs.varnish";
description = ''
The package to use
'';
@@ -48,7 +48,7 @@ in
extraModules = mkOption {
type = types.listOf types.package;
default = [];
- example = literalExample "[ pkgs.varnish5Packages.geoip ]";
+ example = literalExample "[ pkgs.varnishPackages.geoip ]";
description = "
Varnish modules (except 'std').
";
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix
index dfb84113e13..671a959cdde 100644
--- a/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix
@@ -18,7 +18,7 @@ in
# determines the default: later modules (if enabled) are preferred.
# E.g., if Plasma 5 is enabled, it supersedes xterm.
imports = [
- ./none.nix ./xterm.nix ./xfce.nix ./xfce4-14.nix ./plasma5.nix ./lumina.nix
+ ./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix
./lxqt.nix ./enlightenment.nix ./gnome3.nix ./kodi.nix ./maxx.nix
./mate.nix ./pantheon.nix ./surf-display.nix
];
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix
index 5ad31e5b9d0..6725595e1cf 100644
--- a/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -184,6 +184,13 @@ in
enableGnomeKeyring = true;
};
+ systemd.packages = with pkgs.gnome3; [
+ gnome-flashback
+ ] ++ (map
+ (wm: gnome-flashback.mkSystemdTargetForWm {
+ inherit (wm) wmName;
+ }) cfg.flashback.customSessions);
+
services.dbus.packages = [
pkgs.gnome3.gnome-screensaver
];
@@ -217,6 +224,12 @@ in
services.xserver.updateDbusEnvironment = true;
+ # gnome has a custom alert theme but it still
+ # inherits from the freedesktop theme.
+ environment.systemPackages = with pkgs; [
+ sound-theme-freedesktop
+ ];
+
# Needed for themes and backgrounds
environment.pathsToLink = [
"/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
@@ -265,6 +278,26 @@ in
source-sans-pro
];
+ ## Enable soft realtime scheduling, only supported on wayland ##
+
+ security.wrappers.".gnome-shell-wrapped" = {
+ source = "${pkgs.gnome3.gnome-shell}/bin/.gnome-shell-wrapped";
+ capabilities = "cap_sys_nice=ep";
+ };
+
+ systemd.user.services.gnome-shell-wayland = let
+ gnomeShellRT = with pkgs.gnome3; pkgs.runCommand "gnome-shell-rt" {} ''
+ mkdir -p $out/bin/
+ cp ${gnome-shell}/bin/gnome-shell $out/bin
+ sed -i "s@${gnome-shell}/bin/@${config.security.wrapperDir}/@" $out/bin/gnome-shell
+ '';
+ in {
+ # Note we need to clear ExecStart before overriding it
+ serviceConfig.ExecStart = ["" "${gnomeShellRT}/bin/gnome-shell"];
+ # Do not use the default environment, it provides a broken PATH
+ environment = mkForce {};
+ };
+
# Adapt from https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/gnome-3-32/elements/core/meta-gnome-core-shell.bst
environment.systemPackages = with pkgs.gnome3; [
adwaita-icon-theme
@@ -276,7 +309,7 @@ in
gnome-shell
gnome-shell-extensions
gnome-themes-extra
- gnome-user-docs
+ pkgs.gnome-user-docs
pkgs.orca
pkgs.glib # for gsettings
pkgs.gnome-menus
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix
index b6fb7218da6..da8bdcb78c4 100644
--- a/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -27,20 +27,13 @@ in
example = "vlc";
description = "Phonon audio backend to install.";
};
-
- enableQt4Support = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Enable support for Qt 4-based applications. Particularly, install a
- default backend for Phonon.
- '';
- };
-
};
};
+ imports = [
+ (mkRemovedOptionModule [ "services" "xserver" "desktopManager" "plasma5" "enableQt4Support" ] "Phonon no longer supports Qt 4.")
+ ];
config = mkMerge [
(mkIf cfg.enable {
@@ -173,9 +166,7 @@ in
# Phonon audio backend
++ lib.optional (cfg.phononBackend == "gstreamer") libsForQt5.phonon-backend-gstreamer
- ++ lib.optional (cfg.phononBackend == "gstreamer" && cfg.enableQt4Support) pkgs.phonon-backend-gstreamer
++ lib.optional (cfg.phononBackend == "vlc") libsForQt5.phonon-backend-vlc
- ++ lib.optional (cfg.phononBackend == "vlc" && cfg.enableQt4Support) pkgs.phonon-backend-vlc
# Optional hardware support features
++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt ]
@@ -232,7 +223,6 @@ in
security.pam.services.kdm.enableKwallet = true;
security.pam.services.lightdm.enableKwallet = true;
security.pam.services.sddm.enableKwallet = true;
- security.pam.services.slim.enableKwallet = true;
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix
index 6965c6d2646..0b70ad5f29c 100644
--- a/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -7,6 +7,32 @@ let
in
{
+
+ imports = [
+ # added 2019-08-18
+ # needed to preserve some semblance of UI familarity
+ # with original XFCE module
+ (mkRenamedOptionModule
+ [ "services" "xserver" "desktopManager" "xfce4-14" "extraSessionCommands" ]
+ [ "services" "xserver" "displayManager" "sessionCommands" ])
+
+ # added 2019-11-04
+ # xfce4-14 module removed and promoted to xfce.
+ # Needed for configs that used xfce4-14 module to migrate to this one.
+ (mkRenamedOptionModule
+ [ "services" "xserver" "desktopManager" "xfce4-14" "enable" ]
+ [ "services" "xserver" "desktopManager" "xfce" "enable" ])
+ (mkRenamedOptionModule
+ [ "services" "xserver" "desktopManager" "xfce4-14" "noDesktop" ]
+ [ "services" "xserver" "desktopManager" "xfce" "noDesktop" ])
+ (mkRenamedOptionModule
+ [ "services" "xserver" "desktopManager" "xfce4-14" "enableXfwm" ]
+ [ "services" "xserver" "desktopManager" "xfce" "enableXfwm" ])
+ (mkRenamedOptionModule
+ [ "services" "xserver" "desktopManager" "xfce" "extraSessionCommands" ]
+ [ "services" "xserver" "displayManager" "sessionCommands" ])
+ ];
+
options = {
services.xserver.desktopManager.xfce = {
enable = mkOption {
@@ -30,14 +56,6 @@ in
description = "Don't install XFCE desktop components (xfdesktop, panel and notification daemon).";
};
- extraSessionCommands = mkOption {
- default = "";
- type = types.lines;
- description = ''
- Shell commands executed just before XFCE is started.
- '';
- };
-
enableXfwm = mkOption {
type = types.bool;
default = true;
@@ -48,76 +66,101 @@ in
config = mkIf cfg.enable {
environment.systemPackages = with pkgs.xfce // pkgs; [
- # Get GTK themes and gtk-update-icon-cache
- gtk2.out
+ glib # for gsettings
+ gtk3.out # gtk-update-icon-cache
- # Supplies some abstract icons such as:
- # utilities-terminal, accessories-text-editor
+ gnome3.gnome-themes-extra
gnome3.adwaita-icon-theme
-
hicolor-icon-theme
tango-icon-theme
xfce4-icon-theme
+ desktop-file-utils
+ shared-mime-info # for update-mime-database
+
+ # For a polkit authentication agent
+ polkit_gnome
+
# Needed by Xfce's xinitrc script
- # TODO: replace with command -v
- which
+ xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
exo
garcon
- gtk-xfce-engine
libxfce4ui
- tumbler
xfconf
mousepad
+ parole
ristretto
xfce4-appfinder
xfce4-screenshooter
xfce4-session
xfce4-settings
+ xfce4-taskmanager
xfce4-terminal
(thunar.override { thunarPlugins = cfg.thunarPlugins; })
- thunar-volman # TODO: drop
- ] ++ (if config.hardware.pulseaudio.enable
- then [ xfce4-mixer-pulse xfce4-volumed-pulse ]
- else [ xfce4-mixer xfce4-volumed ])
- # TODO: NetworkManager doesn't belong here
- ++ optionals config.networking.networkmanager.enable [ networkmanagerapplet ]
- ++ optionals config.powerManagement.enable [ xfce4-power-manager ]
- ++ optionals cfg.enableXfwm [ xfwm4 ]
- ++ optionals (!cfg.noDesktop) [
- xfce4-panel
+ ] # TODO: NetworkManager doesn't belong here
+ ++ optional config.networking.networkmanager.enable networkmanagerapplet
+ ++ optional config.powerManagement.enable xfce4-power-manager
+ ++ optionals config.hardware.pulseaudio.enable [
+ pavucontrol
+ # volume up/down keys support:
+ # xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse
+ # but can only be used with xfce4-panel, so for no-desktop usage we still include
+ # xfce4-volumed-pulse
+ (if cfg.noDesktop then xfce4-volumed-pulse else xfce4-pulseaudio-plugin)
+ ] ++ optionals cfg.enableXfwm [
+ xfwm4
+ xfwm4-themes
+ ] ++ optionals (!cfg.noDesktop) [
xfce4-notifyd
+ xfce4-panel
xfdesktop
];
environment.pathsToLink = [
"/share/xfce4"
- "/share/themes"
- "/share/gtksourceview-2.0"
+ "/lib/xfce4"
+ "/share/gtksourceview-3.0"
+ "/share/gtksourceview-4.0"
];
- services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
-
services.xserver.desktopManager.session = [{
name = "xfce";
bgSupport = true;
start = ''
- ${cfg.extraSessionCommands}
-
- ${pkgs.runtimeShell} ${pkgs.xfce.xinitrc} &
+ ${pkgs.runtimeShell} ${pkgs.xfce.xfce4-session.xinitrc} &
waitPID=$!
'';
}];
services.xserver.updateDbusEnvironment = true;
+ services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
# Enable helpful DBus services.
services.udisks2.enable = true;
+ security.polkit.enable = true;
+ services.accounts-daemon.enable = true;
services.upower.enable = config.powerManagement.enable;
+ services.gnome3.glib-networking.enable = true;
services.gvfs.enable = true;
services.gvfs.package = pkgs.xfce.gvfs;
+ services.tumbler.enable = true;
+ services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
+ services.xserver.libinput.enable = mkDefault true; # used in xfce4-settings-manager
+
+ # Enable default programs
+ programs.dconf.enable = true;
+
+ # Shell integration for VTE terminals
+ programs.bash.vteIntegration = mkDefault true;
+ programs.zsh.vteIntegration = mkDefault true;
+
+ # Systemd services
+ systemd.packages = with pkgs.xfce; [
+ (thunar.override { thunarPlugins = cfg.thunarPlugins; })
+ ] ++ optional (!cfg.noDesktop) xfce4-notifyd;
+
};
}
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce4-14.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce4-14.nix
deleted file mode 100644
index ffc99172e79..00000000000
--- a/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce4-14.nix
+++ /dev/null
@@ -1,152 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
- cfg = config.services.xserver.desktopManager.xfce4-14;
-in
-
-{
- # added 2019-08-18
- # needed to preserve some semblance of UI familarity
- # with original XFCE module
- imports = [
- (mkRenamedOptionModule
- [ "services" "xserver" "desktopManager" "xfce4-14" "extraSessionCommands" ]
- [ "services" "xserver" "displayManager" "sessionCommands" ])
- ];
-
- options = {
- services.xserver.desktopManager.xfce4-14 = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = "Enable the Xfce desktop environment.";
- };
-
- # TODO: support thunar plugins
- # thunarPlugins = mkOption {
- # default = [];
- # type = types.listOf types.package;
- # example = literalExample "[ pkgs.xfce4-14.thunar-archive-plugin ]";
- # description = ''
- # A list of plugin that should be installed with Thunar.
- # '';
- # };
-
- noDesktop = mkOption {
- type = types.bool;
- default = false;
- description = "Don't install XFCE desktop components (xfdesktop, panel and notification daemon).";
- };
-
- enableXfwm = mkOption {
- type = types.bool;
- default = true;
- description = "Enable the XFWM (default) window manager.";
- };
- };
- };
-
- config = mkIf cfg.enable {
- environment.systemPackages = with pkgs.xfce4-14 // pkgs; [
- glib # for gsettings
- gtk3.out # gtk-update-icon-cache
-
- gnome3.gnome-themes-extra
- gnome3.adwaita-icon-theme
- hicolor-icon-theme
- tango-icon-theme
- xfce4-icon-theme
-
- desktop-file-utils
- shared-mime-info # for update-mime-database
-
- # For a polkit authentication agent
- polkit_gnome
-
- # Needed by Xfce's xinitrc script
- xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
-
- exo
- garcon
- libxfce4ui
- xfconf
-
- mousepad
- parole
- ristretto
- xfce4-appfinder
- xfce4-screenshooter
- xfce4-session
- xfce4-settings
- xfce4-taskmanager
- xfce4-terminal
-
- # TODO: resync patch for plugins
- #(thunar.override { thunarPlugins = cfg.thunarPlugins; })
- thunar
- ] # TODO: NetworkManager doesn't belong here
- ++ optional config.networking.networkmanager.enable networkmanagerapplet
- ++ optional config.powerManagement.enable xfce4-power-manager
- ++ optionals config.hardware.pulseaudio.enable [
- pavucontrol
- # volume up/down keys support:
- # xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse
- # but can only be used with xfce4-panel, so for no-desktop usage we still include
- # xfce4-volumed-pulse
- (if cfg.noDesktop then xfce4-volumed-pulse else xfce4-pulseaudio-plugin)
- ] ++ optionals cfg.enableXfwm [
- xfwm4
- xfwm4-themes
- ] ++ optionals (!cfg.noDesktop) [
- xfce4-notifyd
- xfce4-panel
- xfdesktop
- ];
-
- environment.pathsToLink = [
- "/share/xfce4"
- "/lib/xfce4"
- "/share/gtksourceview-3.0"
- "/share/gtksourceview-4.0"
- ];
-
- services.xserver.desktopManager.session = [{
- name = "xfce4-14";
- bgSupport = true;
- start = ''
- ${pkgs.runtimeShell} ${pkgs.xfce4-14.xinitrc} &
- waitPID=$!
- '';
- }];
-
- services.xserver.updateDbusEnvironment = true;
- services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
-
- # Enable helpful DBus services.
- services.udisks2.enable = true;
- security.polkit.enable = true;
- services.accounts-daemon.enable = true;
- services.upower.enable = config.powerManagement.enable;
- services.gnome3.glib-networking.enable = true;
- services.gvfs.enable = true;
- services.gvfs.package = pkgs.xfce.gvfs;
- services.tumbler.enable = true;
- services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
- services.xserver.libinput.enable = mkDefault true; # used in xfce4-settings-manager
-
- # Enable default programs
- programs.dconf.enable = true;
-
- # Shell integration for VTE terminals
- programs.bash.vteIntegration = mkDefault true;
- programs.zsh.vteIntegration = mkDefault true;
-
- # Systemd services
- systemd.packages = with pkgs.xfce4-14; [
- thunar
- ] ++ optional (!cfg.noDesktop) xfce4-notifyd;
-
- };
-}
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/default.nix b/nixpkgs/nixos/modules/services/x11/display-managers/default.nix
index bf6b048654b..b66856fd4d4 100644
--- a/nixpkgs/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/default.nix
@@ -1,9 +1,9 @@
# This module declares the options to define a *display manager*, the
-# program responsible for handling X logins (such as xdm, gdb, or
-# SLiM). The display manager allows the user to select a *session
-# type*. When the user logs in, the display manager starts the
+# program responsible for handling X logins (such as LightDM, GDM, or SDDM).
+# The display manager allows the user to select a *session
+# type*. When the user logs in, the display manager starts the
# *session script* ("xsession" below) to launch the selected session
-# type. The session type defines two things: the *desktop manager*
+# type. The session type defines two things: the *desktop manager*
# (e.g., KDE, Gnome or a plain xterm), and optionally the *window
# manager* (e.g. kwin or twm).
@@ -196,7 +196,6 @@ let
fi
'') cfg.displayManager.extraSessionFilePackages}
-
${concatMapStrings (pkg: ''
if test -d ${pkg}/share/wayland-sessions; then
mkdir -p "$out/share/wayland-sessions"
@@ -322,7 +321,7 @@ in
execCmd = mkOption {
type = types.str;
example = literalExample ''
- "''${pkgs.slim}/bin/slim"
+ "''${pkgs.lightdm}/bin/lightdm"
'';
description = "Command to start the display manager.";
};
@@ -330,7 +329,6 @@ in
environment = mkOption {
type = types.attrsOf types.unspecified;
default = {};
- example = { SLIM_CFGFILE = "/etc/slim.conf"; };
description = "Additional environment variables needed by the display manager.";
};
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix b/nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix
index e5990aec4b9..912ec5bd38e 100644
--- a/nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix
@@ -31,6 +31,44 @@ let
load-module module-position-event-sounds
'';
+ dmDefault = config.services.xserver.desktopManager.default;
+ wmDefault = config.services.xserver.windowManager.default;
+ hasDefaultUserSession = dmDefault != "none" || wmDefault != "none";
+ defaultSessionName = dmDefault + optionalString (wmDefault != "none") ("+" + wmDefault);
+
+ setSessionScript = pkgs.python3.pkgs.buildPythonApplication {
+ name = "set-session";
+
+ format = "other";
+
+ src = ./set-session.py;
+
+ dontUnpack = true;
+
+ strictDeps = false;
+
+ nativeBuildInputs = with pkgs; [
+ wrapGAppsHook
+ gobject-introspection
+ ];
+
+ buildInputs = with pkgs; [
+ accountsservice
+ glib
+ ];
+
+ propagatedBuildInputs = with pkgs.python3.pkgs; [
+ pygobject3
+ ordered-set
+ ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp $src $out/bin/set-session
+ chmod +x $out/bin/set-session
+ '';
+ };
+
in
{
@@ -88,11 +126,21 @@ in
wayland = mkOption {
default = true;
description = ''
- Allow GDM run on Wayland instead of Xserver
+ Allow GDM to run on Wayland instead of Xserver.
+ Note to enable Wayland with Nvidia you need to
+ enable the <option>nvidiaWayland</option>.
'';
type = types.bool;
};
+ nvidiaWayland = mkOption {
+ default = false;
+ description = ''
+ Whether to allow wayland to be used with the proprietary
+ NVidia graphics driver.
+ '';
+ };
+
autoSuspend = mkOption {
default = true;
description = ''
@@ -156,6 +204,8 @@ in
cat - > /run/gdm/.config/gnome-initial-setup-done <<- EOF
yes
EOF
+ '' + optionalString hasDefaultUserSession ''
+ ${setSessionScript}/bin/set-session ${defaultSessionName}
'';
};
@@ -197,6 +247,19 @@ in
services.dbus.packages = [ gdm ];
+ # We duplicate upstream's udev rules manually to make wayland with nvidia configurable
+ services.udev.extraRules = ''
+ # disable Wayland on Cirrus chipsets
+ ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="${gdm}/libexec/gdm-disable-wayland"
+ # disable Wayland on Hi1710 chipsets
+ ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="${gdm}/libexec/gdm-disable-wayland"
+ ${optionalString (!cfg.gdm.nvidiaWayland) ''
+ DRIVER=="nvidia", RUN+="${gdm}/libexec/gdm-disable-wayland"
+ ''}
+ # disable Wayland when modesetting is disabled
+ IMPORT{cmdline}="nomodeset", RUN+="${gdm}/libexec/gdm-disable-wayland"
+ '';
+
systemd.user.services.dbus.wantedBy = [ "default.target" ];
programs.dconf.profiles.gdm =
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix b/nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix
index 8847acb0c60..899dd8665a2 100644
--- a/nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix
@@ -14,7 +14,7 @@ let
xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
#!/bin/sh
${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)}
- exec systemd-cat ${dmcfg.xserverBin} ${toString dmcfg.xserverArgs} "$@"
+ exec systemd-cat -t xserver-wrapper ${dmcfg.xserverBin} ${toString dmcfg.xserverArgs} "$@"
'';
Xsetup = pkgs.writeScript "Xsetup" ''
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/set-session.py b/nixpkgs/nixos/modules/services/x11/display-managers/set-session.py
new file mode 100755
index 00000000000..0cca80af44e
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/set-session.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+import gi, argparse, os, logging, sys
+
+gi.require_version("AccountsService", "1.0")
+from gi.repository import AccountsService, GLib
+from ordered_set import OrderedSet
+
+
+def get_session_file(session):
+ system_data_dirs = GLib.get_system_data_dirs()
+
+ session_dirs = OrderedSet(
+ os.path.join(data_dir, session)
+ for data_dir in system_data_dirs
+ for session in {"wayland-sessions", "xsessions"}
+ )
+
+ session_files = OrderedSet(
+ os.path.join(dir, session + ".desktop")
+ for dir in session_dirs
+ if os.path.exists(os.path.join(dir, session + ".desktop"))
+ )
+
+ # Deal with duplicate wayland-sessions and xsessions.
+ # Needed for the situation in gnome-session, where there's
+ # a xsession named the same as a wayland session.
+ if any(map(is_session_wayland, session_files)):
+ session_files = OrderedSet(
+ session for session in session_files if is_session_wayland(session)
+ )
+ else:
+ session_files = OrderedSet(
+ session for session in session_files if is_session_xsession(session)
+ )
+
+ if len(session_files) == 0:
+ logging.warning("No session files are found.")
+ sys.exit(0)
+ else:
+ return session_files[0]
+
+
+def is_session_xsession(session_file):
+ return "/xsessions/" in session_file
+
+
+def is_session_wayland(session_file):
+ return "/wayland-sessions/" in session_file
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="Set session type for all normal users."
+ )
+ parser.add_argument("session", help="Name of session to set.")
+
+ args = parser.parse_args()
+
+ session = getattr(args, "session")
+ session_file = get_session_file(session)
+
+ user_manager = AccountsService.UserManager.get_default()
+ users = user_manager.list_users()
+
+ for user in users:
+ if user.is_system_account():
+ continue
+ else:
+ if is_session_wayland(session_file):
+ logging.debug(
+ f"Setting session name: {session}, as we found the existing wayland-session: {session_file}"
+ )
+ user.set_session(session)
+ elif is_session_xsession(session_file):
+ logging.debug(
+ f"Setting session name: {session}, as we found the existing xsession: {session_file}"
+ )
+ user.set_x_session(session)
+ else:
+ logging.error(f"Couldn't figure out session type for {session_file}")
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/slim.nix b/nixpkgs/nixos/modules/services/x11/display-managers/slim.nix
index 124660a43f0..4b0948a5b7a 100644
--- a/nixpkgs/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/slim.nix
@@ -2,155 +2,15 @@
with lib;
-let
-
- dmcfg = config.services.xserver.displayManager;
-
- cfg = dmcfg.slim;
-
- slimConfig = pkgs.writeText "slim.cfg"
- ''
- xauth_path ${dmcfg.xauthBin}
- default_xserver ${dmcfg.xserverBin}
- xserver_arguments ${toString dmcfg.xserverArgs}
- sessiondir ${dmcfg.session.desktops}/share/xsessions
- login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.wrapper} "%session"
- halt_cmd ${config.systemd.package}/sbin/shutdown -h now
- reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
- logfile /dev/stderr
- ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
- ${optionalString (cfg.defaultUser != null) ("focus_password yes")}
- ${optionalString cfg.autoLogin "auto_login yes"}
- ${optionalString (cfg.consoleCmd != null) "console_cmd ${cfg.consoleCmd}"}
- ${cfg.extraConfig}
- '';
-
- # Unpack the SLiM theme, or use the default.
- slimThemesDir =
- let
- unpackedTheme = pkgs.runCommand "slim-theme" { preferLocalBuild = true; }
- ''
- mkdir -p $out
- cd $out
- unpackFile ${cfg.theme}
- ln -s * default
- '';
- in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
-
-in
-
{
-
- ###### interface
-
- options = {
-
- services.xserver.displayManager.slim = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to enable SLiM as the display manager.
- '';
- };
-
- theme = mkOption {
- type = types.nullOr types.path;
- default = pkgs.fetchurl {
- url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
- sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
- };
- defaultText = ''pkgs.fetchurl {
- url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
- sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
- }'';
- example = literalExample ''
- pkgs.fetchurl {
- url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
- sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
- }
- '';
- description = ''
- The theme for the SLiM login manager. If not specified, SLiM's
- default theme is used. See <link
- xlink:href='http://slim.berlios.de/themes01.php'/> for a
- collection of themes. TODO: berlios shut down.
- '';
- };
-
- defaultUser = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "login";
- description = ''
- The default user to load. If you put a username here you
- get it automatically loaded into the username field, and
- the focus is placed on the password.
- '';
- };
-
- autoLogin = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Automatically log in as the default user.
- '';
- };
-
- extraConfig = mkOption {
- type = types.lines;
- default = "";
- description = ''
- Extra configuration options for SLiM login manager. Do not
- add options that can be configured directly.
- '';
- };
-
- consoleCmd = mkOption {
- type = types.nullOr types.str;
- default = ''
- ${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ${pkgs.shadow}/bin/login
- '';
- defaultText = ''
- ''${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ''${pkgs.shadow}/bin/login
- '';
- description = ''
- The command to run when "console" is given as the username.
- '';
- };
- };
-
- };
-
-
- ###### implementation
-
- config = mkIf cfg.enable {
-
- services.xserver.displayManager.job =
- { environment =
- { SLIM_CFGFILE = slimConfig;
- SLIM_THEMESDIR = slimThemesDir;
- };
- execCmd = "exec ${pkgs.slim}/bin/slim";
- };
-
- services.xserver.displayManager.sessionCommands =
- ''
- # Export the config/themes for slimlock.
- export SLIM_THEMESDIR=${slimThemesDir}
- '';
-
- # Allow null passwords so that the user can login as root on the
- # installation CD.
- security.pam.services.slim = { allowNullPassword = true; startSession = true; };
-
- # Allow slimlock to work.
- security.pam.services.slimlock = {};
-
- environment.systemPackages = [ pkgs.slim ];
-
- };
-
+ # added 2019-11-11
+ imports = [
+ (mkRemovedOptionModule [ "services" "xserver" "displayManager" "slim" ] ''
+ The SLIM project is abandoned and their last release was in 2013.
+ Because of this it poses a security risk to your system.
+ Other issues include it not fully supporting systemd and logind sessions.
+ Please use a different display manager such as LightDM, SDDM, or GDM.
+ You can also use the startx module which uses Xinitrc.
+ '')
+ ];
}
diff --git a/nixpkgs/nixos/modules/services/x11/hardware/digimend.nix b/nixpkgs/nixos/modules/services/x11/hardware/digimend.nix
new file mode 100644
index 00000000000..a9f5640905a
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/x11/hardware/digimend.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.xserver.digimend;
+
+ pkg = config.boot.kernelPackages.digimend;
+
+in
+
+{
+
+ options = {
+
+ services.xserver.digimend = {
+
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable the digimend drivers for Huion/XP-Pen/etc. tablets.
+ '';
+ };
+
+ };
+
+ };
+
+
+ config = mkIf cfg.enable {
+
+ # digimend drivers use xsetwacom and wacom X11 drivers
+ services.xserver.wacom.enable = true;
+
+ boot.extraModulePackages = [ pkg ];
+
+ environment.etc."X11/xorg.conf.d/50-digimend.conf".source =
+ "${pkg}/usr/share/X11/xorg.conf.d/50-digimend.conf";
+
+ };
+
+}
diff --git a/nixpkgs/nixos/modules/services/x11/hardware/libinput.nix b/nixpkgs/nixos/modules/services/x11/hardware/libinput.nix
index bd289976532..71065dfc26b 100644
--- a/nixpkgs/nixos/modules/services/x11/hardware/libinput.nix
+++ b/nixpkgs/nixos/modules/services/x11/hardware/libinput.nix
@@ -122,7 +122,7 @@ in {
description =
''
Specify the scrolling method: <literal>twofinger</literal>, <literal>edge</literal>,
- or <literal>none</literal>
+ <literal>button</literal>, or <literal>none</literal>
'';
};
@@ -209,12 +209,12 @@ in {
services.xserver.config =
''
- # Automatically enable the libinput driver for all touchpads.
+ # General libinput configuration.
+ # See CONFIGURATION DETAILS section of man:libinput(4).
Section "InputClass"
Identifier "libinputConfiguration"
- MatchIsTouchpad "on"
+ MatchDriver "libinput"
${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''}
- Driver "libinput"
Option "AccelProfile" "${cfg.accelProfile}"
${optionalString (cfg.accelSpeed != null) ''Option "AccelSpeed" "${cfg.accelSpeed}"''}
${optionalString (cfg.buttonMapping != null) ''Option "ButtonMapping" "${cfg.buttonMapping}"''}
diff --git a/nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix b/nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix
index 0e131412276..30c59b88f82 100644
--- a/nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix
+++ b/nixpkgs/nixos/modules/services/x11/window-managers/xmonad.nix
@@ -86,7 +86,7 @@ in
${xmonadBin}
waitPID=$!
'' else ''
- ${xmonad}/bin/xmonad &
+ systemd-cat -t xmonad ${xmonad}/bin/xmonad &
waitPID=$!
'';
}];
diff --git a/nixpkgs/nixos/modules/services/x11/xserver.nix b/nixpkgs/nixos/modules/services/x11/xserver.nix
index a8406544a72..70f01dbdbf5 100644
--- a/nixpkgs/nixos/modules/services/x11/xserver.nix
+++ b/nixpkgs/nixos/modules/services/x11/xserver.nix
@@ -557,7 +557,6 @@ in
default = !( dmconf.auto.enable
|| dmconf.gdm.enable
|| dmconf.sddm.enable
- || dmconf.slim.enable
|| dmconf.xpra.enable );
in mkIf (default) true;
diff --git a/nixpkgs/nixos/modules/system/activation/switch-to-configuration.pl b/nixpkgs/nixos/modules/system/activation/switch-to-configuration.pl
index 641cf9faadc..12a80a12d19 100644
--- a/nixpkgs/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixpkgs/nixos/modules/system/activation/switch-to-configuration.pl
@@ -214,7 +214,17 @@ while (my ($unit, $state) = each %{$activePrev}) {
# Reload the changed mount unit to force a remount.
$unitsToReload{$unit} = 1;
recordUnit($reloadListFile, $unit);
- } elsif ($unit =~ /\.socket$/ || $unit =~ /\.path$/ || $unit =~ /\.slice$/) {
+ } elsif ($unit =~ /\.socket$/) {
+ my $unitInfo = parseUnit($newUnitFile);
+ # If a socket unit has been changed, the corresponding
+ # service unit has to be stopped before the socket can
+ # be restarted. The service will be started again on demand.
+ my $serviceUnit = $unitInfo->{'Unit'} // "$baseName.service";
+ $unitsToStop{$serviceUnit} = 1;
+ $unitsToStop{$unit} = 1;
+ $unitsToStart{$unit} = 1;
+ recordUnit($startListFile, $unit);
+ } elsif ($unit =~ /\.path$/ || $unit =~ /\.slice$/) {
# FIXME: do something?
} else {
my $unitInfo = parseUnit($newUnitFile);
diff --git a/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix b/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix
index e13f0421d38..9a4db84f7b7 100644
--- a/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix
@@ -47,8 +47,8 @@ let
grub = f grub;
grubTarget = f (grub.grubTarget or "");
shell = "${pkgs.runtimeShell}";
- fullName = (builtins.parseDrvName realGrub.name).name;
- fullVersion = (builtins.parseDrvName realGrub.name).version;
+ fullName = lib.getName realGrub;
+ fullVersion = lib.getVersion realGrub;
grubEfi = f grubEfi;
grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
bootPath = args.path;
diff --git a/nixpkgs/nixos/modules/system/boot/networkd.nix b/nixpkgs/nixos/modules/system/boot/networkd.nix
index f2060e21509..226769f1059 100644
--- a/nixpkgs/nixos/modules/system/boot/networkd.nix
+++ b/nixpkgs/nixos/modules/system/boot/networkd.nix
@@ -10,7 +10,7 @@ let
checkLink = checkUnitConfig "Link" [
(assertOnlyFields [
- "Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "OriginalName"
+ "Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "Name" "OriginalName"
"MTUBytes" "BitsPerSecond" "Duplex" "AutoNegotiation" "WakeOnLan" "Port"
"TCPSegmentationOffload" "TCP6SegmentationOffload" "GenericSegmentationOffload"
"GenericReceiveOffload" "LargeReceiveOffload" "RxChannels" "TxChannels"
@@ -187,7 +187,7 @@ let
# Note: For DHCP the values both, none, v4, v6 are deprecated
(assertValueOneOf "DHCP" ["yes" "no" "ipv4" "ipv6" "both" "none" "v4" "v6"])
(assertValueOneOf "DHCPServer" boolValues)
- (assertValueOneOf "LinkLocalAddressing" ["yes" "no" "ipv4" "ipv6"])
+ (assertValueOneOf "LinkLocalAddressing" ["yes" "no" "ipv4" "ipv6" "ipv4-fallback" "fallback"])
(assertValueOneOf "IPv4LLRoute" boolValues)
(assertValueOneOf "LLMNR" ["yes" "resolve" "no"])
(assertValueOneOf "MulticastDNS" ["yes" "resolve" "no"])
@@ -201,7 +201,7 @@ let
(assertValueOneOf "IPv6AcceptRA" boolValues)
(assertValueOneOf "IPv4ProxyARP" boolValues)
(assertValueOneOf "IPv6ProxyNDP" boolValues)
- (assertValueOneOf "IPv6PrefixDelegation" boolValues)
+ (assertValueOneOf "IPv6PrefixDelegation" (boolValues ++ [ "dhcpv6" "static" ]))
(assertValueOneOf "ActiveSlave" boolValues)
(assertValueOneOf "PrimarySlave" boolValues)
(assertValueOneOf "ConfigureWithoutCarrier" boolValues)
@@ -924,6 +924,8 @@ in
config = mkIf config.systemd.network.enable {
+ users.users.systemd-network.group = "systemd-network";
+
systemd.additionalUpstreamSystemUnits = [
"systemd-networkd.service" "systemd-networkd-wait-online.service"
];
diff --git a/nixpkgs/nixos/modules/system/boot/plymouth.nix b/nixpkgs/nixos/modules/system/boot/plymouth.nix
index adca3c3f66e..23fce22366d 100644
--- a/nixpkgs/nixos/modules/system/boot/plymouth.nix
+++ b/nixpkgs/nixos/modules/system/boot/plymouth.nix
@@ -25,6 +25,7 @@ let
[Daemon]
ShowDelay=0
Theme=${cfg.theme}
+ ${cfg.extraConfig}
'';
in
@@ -65,6 +66,15 @@ in
'';
};
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Literal string to append to <literal>configFile</literal>
+ and the config file generated by the plymouth module.
+ '';
+ };
+
};
};
diff --git a/nixpkgs/nixos/modules/system/boot/resolved.nix b/nixpkgs/nixos/modules/system/boot/resolved.nix
index 3ea96f8e464..da61c64faf8 100644
--- a/nixpkgs/nixos/modules/system/boot/resolved.nix
+++ b/nixpkgs/nixos/modules/system/boot/resolved.nix
@@ -136,6 +136,8 @@ in
}
];
+ users.users.resolved.group = "systemd-resolve";
+
systemd.additionalUpstreamSystemUnits = [
"systemd-resolved.service"
];
diff --git a/nixpkgs/nixos/modules/system/boot/systemd-unit-options.nix b/nixpkgs/nixos/modules/system/boot/systemd-unit-options.nix
index c1f2c98afcd..bee21f1a8f3 100644
--- a/nixpkgs/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixpkgs/nixos/modules/system/boot/systemd-unit-options.nix
@@ -24,7 +24,7 @@ in rec {
in
if isList (head defs'')
then concatLists defs''
- else mergeOneOption loc defs';
+ else mergeEqualOption loc defs';
};
sharedOptions = {
diff --git a/nixpkgs/nixos/modules/system/boot/systemd.nix b/nixpkgs/nixos/modules/system/boot/systemd.nix
index 33b350902a1..9e3c6149f92 100644
--- a/nixpkgs/nixos/modules/system/boot/systemd.nix
+++ b/nixpkgs/nixos/modules/system/boot/systemd.nix
@@ -63,6 +63,7 @@ let
"systemd-logind.service"
"autovt@.service"
"systemd-user-sessions.service"
+ "dbus-org.freedesktop.import1.service"
"dbus-org.freedesktop.machine1.service"
"user@.service"
"user-runtime-dir@.service"
@@ -145,6 +146,7 @@ let
"user.slice"
"machine.slice"
"machines.target"
+ "systemd-importd.service"
"systemd-machined.service"
"systemd-nspawn@.service"
diff --git a/nixpkgs/nixos/modules/system/boot/timesyncd.nix b/nixpkgs/nixos/modules/system/boot/timesyncd.nix
index 8282cdd6f3a..9e2f36ca01f 100644
--- a/nixpkgs/nixos/modules/system/boot/timesyncd.nix
+++ b/nixpkgs/nixos/modules/system/boot/timesyncd.nix
@@ -20,6 +20,18 @@ with lib;
The set of NTP servers from which to synchronise.
'';
};
+ extraConfig = mkOption {
+ default = "";
+ type = types.lines;
+ example = ''
+ PollIntervalMaxSec=180
+ '';
+ description = ''
+ Extra config options for systemd-timesyncd. See
+ <link xlink:href="https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html">
+ timesyncd.conf(5)</link> for available options.
+ '';
+ };
};
};
@@ -35,9 +47,13 @@ with lib;
environment.etc."systemd/timesyncd.conf".text = ''
[Time]
NTP=${concatStringsSep " " config.services.timesyncd.servers}
+ ${config.services.timesyncd.extraConfig}
'';
- users.users.systemd-timesync.uid = config.ids.uids.systemd-timesync;
+ users.users.systemd-timesync = {
+ uid = config.ids.uids.systemd-timesync;
+ group = "systemd-timesync";
+ };
users.groups.systemd-timesync.gid = config.ids.gids.systemd-timesync;
system.activationScripts.systemd-timesyncd-migration = mkIf (versionOlder config.system.stateVersion "19.09") ''
diff --git a/nixpkgs/nixos/modules/tasks/network-interfaces-systemd.nix b/nixpkgs/nixos/modules/tasks/network-interfaces-systemd.nix
index 863072e33dc..9ffa1089ee6 100644
--- a/nixpkgs/nixos/modules/tasks/network-interfaces-systemd.nix
+++ b/nixpkgs/nixos/modules/tasks/network-interfaces-systemd.nix
@@ -31,7 +31,7 @@ in
message = "networking.defaultGatewayWindowSize is not supported by networkd.";
} {
assertion = cfg.vswitches == {};
- message = "networking.vswichtes are not supported by networkd.";
+ message = "networking.vswitches are not supported by networkd.";
} {
assertion = cfg.defaultGateway == null || cfg.defaultGateway.interface == null;
message = "networking.defaultGateway.interface is not supported by networkd.";
@@ -76,15 +76,6 @@ in
};
in mkMerge [ {
enable = true;
- networks."99-main" = (genericNetwork mkDefault) // {
- # We keep the "broken" behaviour of applying this to all interfaces.
- # In general we want to get rid of this workaround but there hasn't
- # been any work on that.
- # See the following issues for details:
- # - https://github.com/NixOS/nixpkgs/issues/18962
- # - https://github.com/NixOS/nixpkgs/issues/61629
- matchConfig = mkDefault { Name = "*"; };
- };
}
(mkMerge (forEach interfaces (i: {
netdevs = mkIf i.virtual ({
diff --git a/nixpkgs/nixos/modules/testing/test-instrumentation.nix b/nixpkgs/nixos/modules/testing/test-instrumentation.nix
index 1a11d9ce7c2..1baeab53b0c 100644
--- a/nixpkgs/nixos/modules/testing/test-instrumentation.nix
+++ b/nixpkgs/nixos/modules/testing/test-instrumentation.nix
@@ -15,7 +15,7 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
#
# One particular example are the boot tests where we want instrumentation
# within the images but not other stuff like setting up 9p filesystems.
- options.virtualisation.qemu.program = mkOption { type = types.path; };
+ options.virtualisation.qemu = { };
config = {
diff --git a/nixpkgs/nixos/modules/virtualisation/amazon-image.nix b/nixpkgs/nixos/modules/virtualisation/amazon-image.nix
index aadfc5add35..20d48add712 100644
--- a/nixpkgs/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixpkgs/nixos/modules/virtualisation/amazon-image.nix
@@ -135,6 +135,9 @@ in
services.openssh.enable = true;
services.openssh.permitRootLogin = "prohibit-password";
+ # Creates symlinks for block device names.
+ services.udev.packages = [ pkgs.ec2-utils ];
+
# Force getting the hostname from EC2.
networking.hostName = mkDefault "";
diff --git a/nixpkgs/nixos/modules/virtualisation/containers.nix b/nixpkgs/nixos/modules/virtualisation/containers.nix
index 691ee2c136e..09678ce9ea7 100644
--- a/nixpkgs/nixos/modules/virtualisation/containers.nix
+++ b/nixpkgs/nixos/modules/virtualisation/containers.nix
@@ -149,7 +149,7 @@ let
--setenv PATH="$PATH" \
${optionalString cfg.ephemeral "--ephemeral"} \
${if cfg.additionalCapabilities != null && cfg.additionalCapabilities != [] then
- ''--capability="${concatStringsSep " " cfg.additionalCapabilities}"'' else ""
+ ''--capability="${concatStringsSep "," cfg.additionalCapabilities}"'' else ""
} \
${if cfg.tmpfs != null && cfg.tmpfs != [] then
''--tmpfs=${concatStringsSep " --tmpfs=" cfg.tmpfs}'' else ""
diff --git a/nixpkgs/nixos/modules/virtualisation/digital-ocean-config.nix b/nixpkgs/nixos/modules/virtualisation/digital-ocean-config.nix
new file mode 100644
index 00000000000..88cb0cd450e
--- /dev/null
+++ b/nixpkgs/nixos/modules/virtualisation/digital-ocean-config.nix
@@ -0,0 +1,197 @@
+{ config, pkgs, lib, modulesPath, ... }:
+with lib;
+{
+ imports = [
+ (modulesPath + "/profiles/qemu-guest.nix")
+ (modulesPath + "/virtualisation/digital-ocean-init.nix")
+ ];
+ options.virtualisation.digitalOcean = with types; {
+ setRootPassword = mkOption {
+ type = bool;
+ default = false;
+ example = true;
+ description = "Whether to set the root password from the Digital Ocean metadata";
+ };
+ setSshKeys = mkOption {
+ type = bool;
+ default = true;
+ example = true;
+ description = "Whether to fetch ssh keys from Digital Ocean";
+ };
+ seedEntropy = mkOption {
+ type = bool;
+ default = true;
+ example = true;
+ description = "Whether to run the kernel RNG entropy seeding script from the Digital Ocean vendor data";
+ };
+ };
+ config =
+ let
+ cfg = config.virtualisation.digitalOcean;
+ hostName = config.networking.hostName;
+ doMetadataFile = "/run/do-metadata/v1.json";
+ in mkMerge [{
+ fileSystems."/" = {
+ device = "/dev/disk/by-label/nixos";
+ autoResize = true;
+ fsType = "ext4";
+ };
+ boot = {
+ growPartition = true;
+ kernelParams = [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
+ initrd.kernelModules = [ "virtio_scsi" ];
+ kernelModules = [ "virtio_pci" "virtio_net" ];
+ loader = {
+ grub.device = "/dev/vda";
+ timeout = 0;
+ grub.configurationLimit = 0;
+ };
+ };
+ services.openssh = {
+ enable = mkDefault true;
+ passwordAuthentication = mkDefault false;
+ };
+ services.do-agent.enable = mkDefault true;
+ networking = {
+ hostName = mkDefault ""; # use Digital Ocean metadata server
+ };
+
+ /* Check for and wait for the metadata server to become reachable.
+ * This serves as a dependency for all the other metadata services. */
+ systemd.services.digitalocean-metadata = {
+ path = [ pkgs.curl ];
+ description = "Get host metadata provided by Digitalocean";
+ script = ''
+ set -eu
+ DO_DELAY_ATTEMPTS=0
+ while ! curl -fsSL -o $RUNTIME_DIRECTORY/v1.json http://169.254.169.254/metadata/v1.json; do
+ DO_DELAY_ATTEMPTS=$((DO_DELAY_ATTEMPTS + 1))
+ if (( $DO_DELAY_ATTEMPTS >= $DO_DELAY_ATTEMPTS_MAX )); then
+ echo "giving up"
+ exit 1
+ fi
+
+ echo "metadata unavailable, trying again in 1s..."
+ sleep 1
+ done
+ chmod 600 $RUNTIME_DIRECTORY/v1.json
+ '';
+ environment = {
+ DO_DELAY_ATTEMPTS_MAX = "10";
+ };
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ RuntimeDirectory = "do-metadata";
+ RuntimeDirectoryPreserve = "yes";
+ };
+ unitConfig = {
+ ConditionPathExists = "!${doMetadataFile}";
+ After = [ "network-pre.target" ] ++
+ optional config.networking.dhcpcd.enable "dhcpcd.service" ++
+ optional config.systemd.network.enable "systemd-networkd.service";
+ };
+ };
+
+ /* Fetch the root password from the digital ocean metadata.
+ * There is no specific route for this, so we use jq to get
+ * it from the One Big JSON metadata blob */
+ systemd.services.digitalocean-set-root-password = mkIf cfg.setRootPassword {
+ path = [ pkgs.shadow pkgs.jq ];
+ description = "Set root password provided by Digitalocean";
+ wantedBy = [ "multi-user.target" ];
+ script = ''
+ set -eo pipefail
+ ROOT_PASSWORD=$(jq -er '.auth_key' ${doMetadataFile})
+ echo "root:$ROOT_PASSWORD" | chpasswd
+ mkdir -p /etc/do-metadata/set-root-password
+ '';
+ unitConfig = {
+ ConditionPathExists = "!/etc/do-metadata/set-root-password";
+ Before = optional config.services.openssh.enable "sshd.service";
+ After = [ "digitalocean-metadata.service" ];
+ Requires = [ "digitalocean-metadata.service" ];
+ };
+ serviceConfig = {
+ Type = "oneshot";
+ };
+ };
+
+ /* Set the hostname from Digital Ocean, unless the user configured it in
+ * the NixOS configuration. The cached metadata file isn't used here
+ * because the hostname is a mutable part of the droplet. */
+ systemd.services.digitalocean-set-hostname = mkIf (hostName == "") {
+ path = [ pkgs.curl pkgs.nettools ];
+ description = "Set hostname provided by Digitalocean";
+ wantedBy = [ "network.target" ];
+ script = ''
+ set -e
+ DIGITALOCEAN_HOSTNAME=$(curl -fsSL http://169.254.169.254/metadata/v1/hostname)
+ hostname "$DIGITALOCEAN_HOSTNAME"
+ if [[ ! -e /etc/hostname || -w /etc/hostname ]]; then
+ printf "%s\n" "$DIGITALOCEAN_HOSTNAME" > /etc/hostname
+ fi
+ '';
+ unitConfig = {
+ Before = [ "network.target" ];
+ After = [ "digitalocean-metadata.service" ];
+ Wants = [ "digitalocean-metadata.service" ];
+ };
+ serviceConfig = {
+ Type = "oneshot";
+ };
+ };
+
+ /* Fetch the ssh keys for root from Digital Ocean */
+ systemd.services.digitalocean-ssh-keys = mkIf cfg.setSshKeys {
+ description = "Set root ssh keys provided by Digital Ocean";
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.jq ];
+ script = ''
+ set -e
+ mkdir -m 0700 -p /root/.ssh
+ jq -er '.public_keys[]' ${doMetadataFile} > /root/.ssh/authorized_keys
+ chmod 600 /root/.ssh/authorized_keys
+ '';
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+ unitConfig = {
+ ConditionPathExists = "!/root/.ssh/authorized_keys";
+ Before = optional config.services.openssh.enable "sshd.service";
+ After = [ "digitalocean-metadata.service" ];
+ Requires = [ "digitalocean-metadata.service" ];
+ };
+ };
+
+ /* Initialize the RNG by running the entropy-seed script from the
+ * Digital Ocean metadata
+ */
+ systemd.services.digitalocean-entropy-seed = mkIf cfg.seedEntropy {
+ description = "Run the kernel RNG entropy seeding script from the Digital Ocean vendor data";
+ wantedBy = [ "network.target" ];
+ path = [ pkgs.jq pkgs.mpack ];
+ script = ''
+ set -eo pipefail
+ TEMPDIR=$(mktemp -d)
+ jq -er '.vendor_data' ${doMetadataFile} | munpack -tC $TEMPDIR
+ ENTROPY_SEED=$(grep -rl "DigitalOcean Entropy Seed script" $TEMPDIR)
+ ${pkgs.runtimeShell} $ENTROPY_SEED
+ rm -rf $TEMPDIR
+ '';
+ unitConfig = {
+ Before = [ "network.target" ];
+ After = [ "digitalocean-metadata.service" ];
+ Requires = [ "digitalocean-metadata.service" ];
+ };
+ serviceConfig = {
+ Type = "oneshot";
+ };
+ };
+
+ }
+ ];
+ meta.maintainers = with maintainers; [ arianvp eamsden ];
+}
+
diff --git a/nixpkgs/nixos/modules/virtualisation/digital-ocean-image.nix b/nixpkgs/nixos/modules/virtualisation/digital-ocean-image.nix
new file mode 100644
index 00000000000..b582e235d43
--- /dev/null
+++ b/nixpkgs/nixos/modules/virtualisation/digital-ocean-image.nix
@@ -0,0 +1,69 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.virtualisation.digitalOceanImage;
+in
+{
+
+ imports = [ ./digital-ocean-config.nix ];
+
+ options = {
+ virtualisation.digitalOceanImage.diskSize = mkOption {
+ type = with types; int;
+ default = 4096;
+ description = ''
+ Size of disk image. Unit is MB.
+ '';
+ };
+
+ virtualisation.digitalOceanImage.configFile = mkOption {
+ type = with types; nullOr path;
+ default = null;
+ description = ''
+ A path to a configuration file which will be placed at
+ <literal>/etc/nixos/configuration.nix</literal> and be used when switching
+ to a new configuration. If set to <literal>null</literal>, a default
+ configuration is used that imports
+ <literal>(modulesPath + "/virtualisation/digital-ocean-config.nix")</literal>.
+ '';
+ };
+
+ virtualisation.digitalOceanImage.compressionMethod = mkOption {
+ type = types.enum [ "gzip" "bzip2" ];
+ default = "gzip";
+ example = "bzip2";
+ description = ''
+ Disk image compression method. Choose bzip2 to generate smaller images that
+ take longer to generate but will consume less metered storage space on your
+ Digital Ocean account.
+ '';
+ };
+ };
+
+ #### implementation
+ config = {
+
+ system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
+ name = "digital-ocean-image";
+ format = "qcow2";
+ postVM = let
+ compress = {
+ "gzip" = "${pkgs.gzip}/bin/gzip";
+ "bzip2" = "${pkgs.bzip2}/bin/bzip2";
+ }.${cfg.compressionMethod};
+ in ''
+ ${compress} $diskImage
+ '';
+ configFile = if cfg.configFile == null
+ then config.virtualisation.digitalOcean.defaultConfigFile
+ else cfg.configFile;
+ inherit (cfg) diskSize;
+ inherit config lib pkgs;
+ };
+
+ };
+
+ meta.maintainers = with maintainers; [ arianvp eamsden ];
+
+}
diff --git a/nixpkgs/nixos/modules/virtualisation/digital-ocean-init.nix b/nixpkgs/nixos/modules/virtualisation/digital-ocean-init.nix
new file mode 100644
index 00000000000..02f4de009fa
--- /dev/null
+++ b/nixpkgs/nixos/modules/virtualisation/digital-ocean-init.nix
@@ -0,0 +1,95 @@
+{ config, pkgs, lib, ... }:
+with lib;
+let
+ cfg = config.virtualisation.digitalOcean;
+ defaultConfigFile = pkgs.writeText "digitalocean-configuration.nix" ''
+ { modulesPath, lib, ... }:
+ {
+ imports = lib.optional (builtins.pathExists ./do-userdata.nix) ./do-userdata.nix ++ [
+ (modulesPath + "/virtualisation/digital-ocean-config.nix")
+ ];
+ }
+ '';
+in {
+ options.virtualisation.digitalOcean.rebuildFromUserData = mkOption {
+ type = types.bool;
+ default = true;
+ example = true;
+ description = "Whether to reconfigure the system from Digital Ocean user data";
+ };
+ options.virtualisation.digitalOcean.defaultConfigFile = mkOption {
+ type = types.path;
+ default = defaultConfigFile;
+ defaultText = ''
+ The default configuration imports user-data if applicable and
+ <literal>(modulesPath + "/virtualisation/digital-ocean-config.nix")</literal>.
+ '';
+ description = ''
+ A path to a configuration file which will be placed at
+ <literal>/etc/nixos/configuration.nix</literal> and be used when switching to
+ a new configuration.
+ '';
+ };
+
+ config = {
+ systemd.services.digitalocean-init = mkIf cfg.rebuildFromUserData {
+ description = "Reconfigure the system from Digital Ocean userdata on startup";
+ wantedBy = [ "network-online.target" ];
+ unitConfig = {
+ ConditionPathExists = "!/etc/nixos/do-userdata.nix";
+ After = [ "digitalocean-metadata.service" "network-online.target" ];
+ Requires = [ "digitalocean-metadata.service" ];
+ X-StopOnRemoval = false;
+ };
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+ restartIfChanged = false;
+ path = [ pkgs.jq pkgs.gnused pkgs.gnugrep pkgs.systemd config.nix.package config.system.build.nixos-rebuild ];
+ environment = {
+ HOME = "/root";
+ NIX_PATH = concatStringsSep ":" [
+ "/nix/var/nix/profiles/per-user/root/channels/nixos"
+ "nixos-config=/etc/nixos/configuration.nix"
+ "/nix/var/nix/profiles/per-user/root/channels"
+ ];
+ };
+ script = ''
+ set -e
+ echo "attempting to fetch configuration from Digital Ocean user data..."
+ userData=$(mktemp)
+ if jq -er '.user_data' /run/do-metadata/v1.json > $userData; then
+ # If the user-data looks like it could be a nix expression,
+ # copy it over. Also, look for a magic three-hash comment and set
+ # that as the channel.
+ if nix-instantiate --parse $userData > /dev/null; then
+ channels="$(grep '^###' "$userData" | sed 's|###\s*||')"
+ printf "%s" "$channels" | while read channel; do
+ echo "writing channel: $channel"
+ done
+
+ if [[ -n "$channels" ]]; then
+ printf "%s" "$channels" > /root/.nix-channels
+ nix-channel --update
+ fi
+
+ echo "setting configuration from Digital Ocean user data"
+ cp "$userData" /etc/nixos/do-userdata.nix
+ if [[ ! -e /etc/nixos/configuration.nix ]]; then
+ install -m0644 ${cfg.defaultConfigFile} /etc/nixos/configuration.nix
+ fi
+ else
+ echo "user data does not appear to be a Nix expression; ignoring"
+ exit
+ fi
+
+ nixos-rebuild switch
+ else
+ echo "no user data is available"
+ fi
+ '';
+ };
+ };
+ meta.maintainers = with maintainers; [ arianvp eamsden ];
+}
diff --git a/nixpkgs/nixos/modules/virtualisation/ec2-amis.nix b/nixpkgs/nixos/modules/virtualisation/ec2-amis.nix
index f640bb21b13..3b4e55d39d7 100644
--- a/nixpkgs/nixos/modules/virtualisation/ec2-amis.nix
+++ b/nixpkgs/nixos/modules/virtualisation/ec2-amis.nix
@@ -291,5 +291,21 @@ let self = {
"19.03".sa-east-1.hvm-ebs = "ami-0c6a43c6e0ad1f4e2";
"19.03".ap-south-1.hvm-ebs = "ami-0303deb1b5890f878";
- latest = self."19.03";
+ # 19.09.981.205691b7cbe
+ "19.09".eu-west-1.hvm-ebs = "ami-0ebd3156e21e9642f";
+ "19.09".eu-west-2.hvm-ebs = "ami-02a2b5480a79084b7";
+ "19.09".eu-west-3.hvm-ebs = "ami-09aa175c7588734f7";
+ "19.09".eu-central-1.hvm-ebs = "ami-00a7fafd7e237a330";
+ "19.09".us-east-1.hvm-ebs = "ami-00a8eeaf232a74f84";
+ "19.09".us-east-2.hvm-ebs = "ami-093efd3a57a1e03a8";
+ "19.09".us-west-1.hvm-ebs = "ami-0913e9a2b677fac30";
+ "19.09".us-west-2.hvm-ebs = "ami-02d9a19f77b47882a";
+ "19.09".ca-central-1.hvm-ebs = "ami-0627dd3f7b3627a29";
+ "19.09".ap-southeast-1.hvm-ebs = "ami-083614e4d08f2164d";
+ "19.09".ap-southeast-2.hvm-ebs = "ami-0048c704185ded6dc";
+ "19.09".ap-northeast-1.hvm-ebs = "ami-0329e7fc2d7f60bd0";
+ "19.09".ap-northeast-2.hvm-ebs = "ami-03d4ae7d0b5fc364f";
+ "19.09".ap-south-1.hvm-ebs = "ami-0b599690b35aeef23";
+
+ latest = self."19.09";
}; in self
diff --git a/nixpkgs/nixos/modules/virtualisation/libvirtd.nix b/nixpkgs/nixos/modules/virtualisation/libvirtd.nix
index 16b79d86919..9bdea78296f 100644
--- a/nixpkgs/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixpkgs/nixos/modules/virtualisation/libvirtd.nix
@@ -146,7 +146,8 @@ in {
# this file is expected in /etc/qemu and not sysconfdir (/var/lib)
etc."qemu/bridge.conf".text = lib.concatMapStringsSep "\n" (e:
"allow ${e}") cfg.allowedBridges;
- systemPackages = with pkgs; [ libvirt libressl.nc cfg.qemuPackage ];
+ systemPackages = with pkgs; [ libvirt libressl.nc iptables cfg.qemuPackage ];
+ etc.ethertypes.source = "${pkgs.iptables}/etc/ethertypes";
};
boot.kernelModules = [ "tun" ];
diff --git a/nixpkgs/nixos/modules/virtualisation/openvswitch.nix b/nixpkgs/nixos/modules/virtualisation/openvswitch.nix
index edec3740230..6b8ad83661f 100644
--- a/nixpkgs/nixos/modules/virtualisation/openvswitch.nix
+++ b/nixpkgs/nixos/modules/virtualisation/openvswitch.nix
@@ -42,6 +42,9 @@ in {
default = false;
description = ''
Whether to start racoon service for openvswitch.
+ Supported only if openvswitch version is less than 2.6.0.
+ Use <literal>virtualisation.vswitch.package = pkgs.openvswitch-lts</literal>
+ for a version that supports ipsec over GRE.
'';
};
};
@@ -89,6 +92,13 @@ in {
"${cfg.package}/share/openvswitch/vswitch.ovsschema"
fi
chmod -R +w /var/db/openvswitch
+ if ${cfg.package}/bin/ovsdb-tool needs-conversion /var/db/openvswitch/conf.db | grep -q "yes"
+ then
+ echo "Performing database upgrade"
+ ${cfg.package}/bin/ovsdb-tool convert /var/db/openvswitch/conf.db
+ else
+ echo "Database already up to date"
+ fi
'';
serviceConfig = {
ExecStart =
@@ -133,7 +143,7 @@ in {
};
}
- (mkIf cfg.ipsec {
+ (mkIf (cfg.ipsec && (versionOlder cfg.package.version "2.6.0")) {
services.racoon.enable = true;
services.racoon.configPath = "${runDir}/ipsec/etc/racoon/racoon.conf";
@@ -172,5 +182,4 @@ in {
'';
};
})]));
-
}
diff --git a/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix b/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix
index ed3431554be..31d332e9f07 100644
--- a/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix
@@ -23,24 +23,56 @@ let
cfg = config.virtualisation;
- qemuGraphics = lib.optionalString (!cfg.graphics) "-nographic";
-
consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles;
- # XXX: This is very ugly and in the future we really should use attribute
- # sets to build ALL of the QEMU flags instead of this mixed mess of Nix
- # expressions and shell script stuff.
- mkDiskIfaceDriveFlag = idx: driveArgs: let
- inherit (cfg.qemu) diskInterface;
- # The drive identifier created by incrementing the index by one using the
- # shell.
- drvId = "drive$((${idx} + 1))";
- # NOTE: DO NOT shell escape, because this may contain shell variables.
- commonArgs = "index=${idx},id=${drvId},${driveArgs}";
- isSCSI = diskInterface == "scsi";
- devArgs = "${diskInterface}-hd,drive=${drvId}";
- args = "-drive ${commonArgs},if=none -device lsi53c895a -device ${devArgs}";
- in if isSCSI then args else "-drive ${commonArgs},if=${diskInterface}";
+ driveOpts = { ... }: {
+
+ options = {
+
+ file = mkOption {
+ type = types.str;
+ description = "The file image used for this drive.";
+ };
+
+ driveExtraOpts = mkOption {
+ type = types.attrsOf types.str;
+ default = {};
+ description = "Extra options passed to drive flag.";
+ };
+
+ deviceExtraOpts = mkOption {
+ type = types.attrsOf types.str;
+ default = {};
+ description = "Extra options passed to device flag.";
+ };
+
+ };
+
+ };
+
+ driveCmdline = idx: { file, driveExtraOpts, deviceExtraOpts, ... }:
+ let
+ drvId = "drive${toString idx}";
+ mkKeyValue = generators.mkKeyValueDefault {} "=";
+ mkOpts = opts: concatStringsSep "," (mapAttrsToList mkKeyValue opts);
+ driveOpts = mkOpts (driveExtraOpts // {
+ index = idx;
+ id = drvId;
+ "if" = "none";
+ inherit file;
+ });
+ deviceOpts = mkOpts (deviceExtraOpts // {
+ drive = drvId;
+ });
+ device =
+ if cfg.qemu.diskInterface == "scsi" then
+ "-device lsi53c895a -device scsi-hd,${deviceOpts}"
+ else
+ "-device virtio-blk-pci,${deviceOpts}";
+ in
+ "-drive ${driveOpts} ${device}";
+
+ drivesCmdLine = drives: concatStringsSep " " (imap1 driveCmdline drives);
# Shell script to start the VM.
startVM =
@@ -77,13 +109,11 @@ let
''}
cd $TMPDIR
- idx=2
- extraDisks=""
+ idx=0
${flip concatMapStrings cfg.emptyDiskImages (size: ''
if ! test -e "empty$idx.qcow2"; then
${qemu}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M"
fi
- extraDisks="$extraDisks ${mkDiskIfaceDriveFlag "$idx" "file=$(pwd)/empty$idx.qcow2,werror=report"}"
idx=$((idx + 1))
'')}
@@ -97,21 +127,7 @@ let
-virtfs local,path=/nix/store,security_model=none,mount_tag=store \
-virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
-virtfs local,path=''${SHARED_DIR:-$TMPDIR/xchg},security_model=none,mount_tag=shared \
- ${if cfg.useBootLoader then ''
- ${mkDiskIfaceDriveFlag "0" "file=$NIX_DISK_IMAGE,cache=writeback,werror=report"} \
- ${mkDiskIfaceDriveFlag "1" "file=$TMPDIR/disk.img,media=disk"} \
- ${if cfg.useEFIBoot then ''
- -pflash $TMPDIR/bios.bin \
- '' else ''
- ''}
- '' else ''
- ${mkDiskIfaceDriveFlag "0" "file=$NIX_DISK_IMAGE,cache=writeback,werror=report"} \
- -kernel ${config.system.build.toplevel}/kernel \
- -initrd ${config.system.build.toplevel}/initrd \
- -append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS" \
- ''} \
- $extraDisks \
- ${qemuGraphics} \
+ ${drivesCmdLine config.virtualisation.qemu.drives} \
${toString config.virtualisation.qemu.options} \
$QEMU_OPTS \
"$@"
@@ -367,6 +383,12 @@ in
'';
};
+ drives =
+ mkOption {
+ type = types.listOf (types.submodule driveOpts);
+ description = "Drives passed to qemu.";
+ };
+
diskInterface =
mkOption {
default = "virtio";
@@ -476,8 +498,49 @@ in
# FIXME: Consolidate this one day.
virtualisation.qemu.options = mkMerge [
- (mkIf (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) [ "-vga std" "-usb" "-device usb-tablet,bus=usb-bus.0" ])
- (mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [ "-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet" ])
+ (mkIf (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) [
+ "-vga std" "-usb" "-device usb-tablet,bus=usb-bus.0"
+ ])
+ (mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
+ "-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
+ ])
+ (mkIf (!cfg.useBootLoader) [
+ "-kernel ${config.system.build.toplevel}/kernel"
+ "-initrd ${config.system.build.toplevel}/initrd"
+ ''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''
+ ])
+ (mkIf cfg.useEFIBoot [
+ "-pflash $TMPDIR/bios.bin"
+ ])
+ (mkIf (!cfg.graphics) [
+ "-nographic"
+ ])
+ ];
+
+ virtualisation.qemu.drives = mkMerge [
+ (mkIf cfg.useBootLoader [
+ {
+ file = "$NIX_DISK_IMAGE";
+ driveExtraOpts.cache = "writeback";
+ driveExtraOpts.werror = "report";
+ }
+ {
+ file = "$TMPDIR/disk.img";
+ driveExtraOpts.media = "disk";
+ deviceExtraOpts.bootindex = "1";
+ }
+ ])
+ (mkIf (!cfg.useBootLoader) [
+ {
+ file = "$NIX_DISK_IMAGE";
+ driveExtraOpts.cache = "writeback";
+ driveExtraOpts.werror = "report";
+ }
+ ])
+ (imap0 (idx: _: {
+ file = "$(pwd)/empty${toString idx}.qcow2";
+ driveExtraOpts.werror = "report";
+ }) cfg.emptyDiskImages)
];
# Mount the host filesystem via 9P, and bind-mount the Nix store
@@ -557,7 +620,7 @@ in
# Wireless won't work in the VM.
networking.wireless.enable = mkVMOverride false;
- networking.connman.enable = mkVMOverride false;
+ services.connman.enable = mkVMOverride false;
# Speed up booting by not waiting for ARP.
networking.dhcpcd.extraConfig = "noarp";
diff --git a/nixpkgs/nixos/modules/virtualisation/virtualbox-host.nix b/nixpkgs/nixos/modules/virtualisation/virtualbox-host.nix
index 6081d4153a6..ddb0a7bda4f 100644
--- a/nixpkgs/nixos/modules/virtualisation/virtualbox-host.nix
+++ b/nixpkgs/nixos/modules/virtualisation/virtualbox-host.nix
@@ -149,5 +149,12 @@ in
# Make sure NetworkManager won't assume this interface being up
# means we have internet access.
networking.networkmanager.unmanaged = ["vboxnet0"];
- })]);
+ }) (mkIf config.networking.useNetworkd {
+ systemd.network.networks."40-vboxnet0".extraConfig = ''
+ [Link]
+ RequiredForOnline=no
+ '';
+ })
+
+]);
}