about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-09-27 16:00:58 +0000
committerAlyssa Ross <hi@alyssa.is>2021-09-27 16:00:58 +0000
commitc504e5d19d940926b3ddcf62c983d66f49f3cbb2 (patch)
treeec955e58bcac2cb93b9f8c10786b23f61d40cd7e /nixpkgs/pkgs/os-specific
parent72789cefce7b17419815f600fbd18238d89afcc9 (diff)
parent1737f98af6667560e3e4f930312f9b5002649d04 (diff)
downloadnixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.gz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.bz2
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.lz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.xz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.zst
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.zip
Merge commit '1737f98af6667560e3e4f930312f9b5002649d04'
Conflicts:
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix
	nixpkgs/pkgs/development/node-packages/default.nix
	nixpkgs/pkgs/development/python-modules/priority/deadline.patch
Diffstat (limited to 'nixpkgs/pkgs/os-specific')
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch (renamed from nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch)0
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch22
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch101
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix185
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/install-setup-hook.sh8
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/setup-hook.sh15
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch13
-rw-r--r--nixpkgs/pkgs/os-specific/bsd/setup-hook.sh13
-rw-r--r--nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/darwin/sigtool/default.nix20
-rw-r--r--nixpkgs/pkgs/os-specific/darwin/trash/trash.diff2
-rw-r--r--nixpkgs/pkgs/os-specific/linux/915resolution/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/acpid/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/acpitool/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/afuse/default.nix15
-rw-r--r--nixpkgs/pkgs/os-specific/linux/alsa-project/alsa-firmware/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/apparmor/default.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/audit/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix10
-rw-r--r--nixpkgs/pkgs/os-specific/linux/bcc/default.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/bluez/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/cpupower-gui/default.nix93
-rw-r--r--nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/devmem2/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/dmraid/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/drbd/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/ell/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firejail/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firejail/remove-link-check.patch48
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/fxload/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix10
-rw-r--r--nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/ioport/default.nix10
-rw-r--r--nixpkgs/pkgs/os-specific/linux/iotop-c/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/iotop/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/iproute/default.nix14
-rw-r--r--nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/iwd/default.nix13
-rw-r--r--nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix23
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json24
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-5.10.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-5.13.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-5.14.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-lqx.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-xanmod.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch15
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kmod/default.nix13
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch24
-rw-r--r--nixpkgs/pkgs/os-specific/linux/kmscube/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/latencytop/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libbpf/default.nix19
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libfabric/default.nix29
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lightum/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix23
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lvm2/default.nix15
-rw-r--r--nixpkgs/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch53
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mdadm/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mingetty/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/numad/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix2
-rw-r--r--nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/otpw/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pflask/default.nix19
-rw-r--r--nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/procdump/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/qmk-udev-rules/default.nix33
-rw-r--r--nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/sdparm/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/smemstat/default.nix4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix7
-rw-r--r--nixpkgs/pkgs/os-specific/linux/sysstat/default.nix5
-rw-r--r--nixpkgs/pkgs/os-specific/linux/system76-power/default.nix6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch10
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch10
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch42
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch30
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch32
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch40
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch55
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch12
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch18
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch4
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch6
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0018-logind-seat-debus-show-CanMultiSession-again.patch8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0019-pkg-config-derive-prefix-from-prefix.patch12
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0020-core-respect-install_sysconfdir_samples-in-meson-fil.patch31
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0021-login-respect-install_sysconfdir_samples-in-meson-fi.patch29
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0022-core-Handle-lookup-paths-being-symlinks.patch80
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/0023-path-util-make-find_executable-work-without-proc-mounted.patch29
-rw-r--r--nixpkgs/pkgs/os-specific/linux/systemd/default.nix194
-rw-r--r--nixpkgs/pkgs/os-specific/linux/tbs/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/tunctl/default.nix8
-rw-r--r--nixpkgs/pkgs/os-specific/linux/usermount/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/v86d/default.nix15
-rw-r--r--nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix3
-rw-r--r--nixpkgs/pkgs/os-specific/linux/zfs/default.nix24
138 files changed, 1391 insertions, 617 deletions
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch
index f67ca2e50791..f67ca2e50791 100644
--- a/nixpkgs/pkgs/os-specific/bsd/netbsd/compat.patch
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch
new file mode 100644
index 000000000000..1a69e73e255f
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch
@@ -0,0 +1,22 @@
+commit f2d0ff85e05b49e9d11735ce4810b242c1dbf5af
+Author: John Ericson <John.Ericson@Obsidian.Systems>
+Date:   Wed Sep 1 15:38:56 2021 +0000
+
+    Make should not hit configure
+
+diff --git a/Makefile b/Makefile
+index b5adb8a5f2e9..1a914ef16739 100644
+--- a/Makefile
++++ b/Makefile
+@@ -76,11 +76,6 @@ _CURDIR:=	${.CURDIR}
+ 
+ SRCS:=		${SRCS:M*.c}
+ 
+-config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
+-	rm -f ${.TARGET}
+-	CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
+-		${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
+-
+ defs.mk: config.cache
+ 	@touch ${.TARGET}
+ 
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch
new file mode 100644
index 000000000000..cd442d95f412
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch
@@ -0,0 +1,101 @@
+commit 5acf3bdea5140e90135d15d6479f29fbf624f75e
+Author: John Ericson <John.Ericson@Obsidian.Systems>
+Date:   Wed Sep 1 15:38:56 2021 +0000
+
+    Don't force building and installing for the build platform
+    
+    Also remove `compat/` subdir from install directories.
+
+diff --git a/Makefile b/Makefile
+index 4bcf227f0e75..9ed1d6eea6ff 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ #	$NetBSD: Makefile,v 1.87 2019/05/08 02:25:50 thorpej Exp $
+ 
+-HOSTLIB=	nbcompat
++LIB=	nbcompat
+ 
+-.include <bsd.hostinit.mk>
++.include <bsd.own.mk>
+ 
+@@ -94,63 +94,37 @@ include/.stamp:
+ 
+ # Install rules
+ 
+-HOST_LIBDIR=	${TOOLDIR}/lib
+-HOST_INCSDIR=	${TOOLDIR}/include
+-HOST_SHAREDIR= ${TOOLDIR}/share
+-
+-install:	.PHONY install.lib includes install.defs.mk
+-
+-# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
+-install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
+-${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
+-	${_MKTARGET_INSTALL}
+-	${HOST_INSTALL_DIR} ${HOST_LIBDIR}
+-	${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
++install:	.PHONY includes install.defs.mk
+ 
+ .for _f in ${INCFILES}
+-HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
+-${HOST_INCSDIR}/compat/${_f}: ${_f}
++INCINSTFILES+= ${INCSDIR}/${_f}
++${INCSDIR}/${_f}: ${_f}
+ 	${_MKTARGET_INSTALL}
+-	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
++	${INSTALL_FILE} ${.ALLSRC} ${.TARGET}
+ .endfor
+ 
+ .for _d in ${INCSUBDIRS}
+-HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d}
+-${HOST_INCSDIR}/compat/${_d}:
++INCINSTDIRS+= ${INCSDIR}/${_d}
++${INCSDIR}/${_d}:
+ 	${_MKTARGET_INSTALL}
+-	${HOST_INSTALL_DIR} ${.TARGET}
++	${INSTALL_DIR} ${.TARGET}
+ .endfor
+ 
+-# Install include files in ${TOOLDIR}/include/compat
+-includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES}
++# Install include files in ${INCSDIR}
++includes: .PHONY ${INCINSTDIRS} .WAIT ${INCINSTFILES}
+ 	@(cd include && find . -name '*.h' -print | while read f ; do \
+-	    ${HOST_INSTALL_FILE} $$f ${HOST_INCSDIR}/compat/$$f ; \
++	    ${INSTALL_FILE} $$f ${INCSDIR}/$$f ; \
+ 	done)
+ 
+ 
+-# Install defs.mk in ${TOOLDIR}/share/compat
+-install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
+-${HOST_SHAREDIR}/compat/defs.mk: defs.mk
++# Install defs.mk in ${DATADIR}
++install.defs.mk: .PHONY ${DATADIR}/defs.mk
++${DATADIR}/defs.mk: defs.mk
+ 	${_MKTARGET_INSTALL}
+-	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}
+-	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat
+-	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
+-
+-# bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS
+-
+-HOST_CPPFLAGS:=	${CPPFLAGS}
+-CPPFLAGS:=	# empty
+-
+-.include <bsd.hostlib.mk>
+-
+-# Use uninstalled copy of host-mkdep
+-HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
+-HOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
+-MKDEP=		${HOST_MKDEP}
++	${INSTALL_DIR} ${DATADIR}
++	${INSTALL_FILE} ${.ALLSRC} ${.TARGET}
+ 
+-# Use uninstalled copy of the install program
+-INSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
+-INSTALL=	${INSTALL_OBJ}/xinstall
++.include <bsd.lib.mk>
+ 
+ # Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
+ # configure.ac.  See more detailed instructions in configure.ac.
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix b/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix
index 1e9331480007..8f24d28409f9 100644
--- a/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/default.nix
@@ -16,6 +16,10 @@ let
     tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE";
   };
 
+  netbsdSetupHook = makeSetupHook {
+    name = "netbsd-setup-hook";
+  } ./setup-hook.sh;
+
   otherSplices = {
     selfBuildBuild = pkgsBuildBuild.netbsd;
     selfBuildHost = pkgsBuildHost.netbsd;
@@ -24,6 +28,12 @@ let
     selfTargetTarget = pkgsTargetTarget.netbsd or {}; # might be missing
   };
 
+  defaultMakeFlags = [
+    "MKSOFTFLOAT=${if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"
+      then "yes"
+      else "no"}"
+  ];
+
 in lib.makeScopeWithSplicing
   splicePackages
   newScope
@@ -60,7 +70,7 @@ in lib.makeScopeWithSplicing
     extraPaths = [ ];
 
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install tsort lorder mandoc groff statHook rsync
     ];
@@ -86,6 +96,8 @@ in lib.makeScopeWithSplicing
 
     BSD_PATH = attrs.path;
 
+    makeFlags = defaultMakeFlags;
+
     strictDeps = true;
 
     meta = with lib; {
@@ -93,6 +105,7 @@ in lib.makeScopeWithSplicing
       platforms = platforms.unix;
       license = licenses.bsd2;
     };
+
   } // lib.optionalAttrs stdenv'.hasCC {
     # TODO should CC wrapper set this?
     CPP = "${stdenv'.cc.targetPrefix}cpp";
@@ -118,7 +131,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
 
     buildInputs = with self; [];
-    nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook rsync ];
+    nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook netbsdSetupHook rsync ];
 
     skipIncludesPhase = true;
 
@@ -126,6 +139,7 @@ in lib.makeScopeWithSplicing
       patchShebangs configure
       ${self.make.postPatch}
     '';
+
     buildPhase = ''
       runHook preBuild
 
@@ -133,6 +147,7 @@ in lib.makeScopeWithSplicing
 
       runHook postBuild
     '';
+
     installPhase = ''
       runHook preInstall
 
@@ -143,6 +158,7 @@ in lib.makeScopeWithSplicing
 
       runHook postInstall
     '';
+
     extraPaths = with self; [ make.src ] ++ make.extraPaths;
   };
 
@@ -159,13 +175,17 @@ in lib.makeScopeWithSplicing
       ./compat-setup-hook.sh
     ];
 
-    # the build system re-runs `./configure` with `HOST_CC` (which is their
-    # name for Build CC) as a compiler to make `defs.mk`, which is installed
-    depsBuildBuild = [ buildPackages.stdenv.cc ] ++ commonDeps;
-    HOST_CC = "${buildPackages.stdenv.cc.targetPrefix}cc";
+    preConfigure = ''
+      make include/.stamp configure nbtool_config.h.in defs.mk.in
+    '';
+
+    configurePlatforms = [ "build" "host" ];
+    configureFlags = [
+      "--cache-file=config.cache"
+    ];
 
     nativeBuildInputs = with buildPackages.netbsd; commonDeps ++ [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       rsync
     ];
@@ -174,18 +194,36 @@ in lib.makeScopeWithSplicing
 
     # temporarily use gnuinstall for bootstrapping
     # bsdinstall will be built later
-    makeFlags = [
+    makeFlags = defaultMakeFlags ++ [
       "INSTALL=${buildPackages.coreutils}/bin/install"
-      "TOOLDIR=$(out)"
+      "DATADIR=$(out)/share"
+      # Can't sort object files yet
+      "LORDER=echo"
+      "TSORT=cat"
+      # Can't process man pages yet
+      "MKSHARE=no"
+    ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+      # GNU objcopy produces broken .a libs which won't link into dependers.
+      # Makefiles only invoke `$OBJCOPY -x/-X`, so cctools strip works here.
+      "OBJCOPY=${buildPackages.darwin.cctools}/bin/strip"
     ];
     RENAME = "-D";
 
-    patches = [ ./compat.patch ];
+    passthru.tests = { netbsd-install = self.install; };
 
-    postInstall = ''
-      mv $out/include/compat/* $out/include
-      rmdir $out/include/compat
+    patches = [
+      ./compat-cxx-safe-header.patch
+      ./compat-dont-configure-twice.patch
+      ./compat-no-force-native.patch
+    ];
+
+    preInstall = ''
+      makeFlagsArray+=('INSTALL_FILE=''${INSTALL} ''${COPY} ''${PRESERVE} ''${RENAME}')
+      makeFlagsArray+=('INSTALL_DIR=''${INSTALL} -d')
+      makeFlagsArray+=('INSTALL_SYMLINK=''${INSTALL} ''${SYMLINK} ''${RENAME}')
+    '';
 
+    postInstall = ''
       # why aren't these installed by netbsd?
       install -D compat_defs.h $out/include/compat_defs.h
       install -D $BSDSRCDIR/include/cdbw.h $out/include/cdbw.h
@@ -238,7 +276,7 @@ in lib.makeScopeWithSplicing
     sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
     extraPaths = with self; [ mtree.src make.src ];
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       mandoc groff rsync
     ];
@@ -254,6 +292,7 @@ in lib.makeScopeWithSplicing
 
       runHook postInstall
     '';
+    setupHook = ./install-setup-hook.sh;
   };
 
   fts = mkDerivation {
@@ -262,7 +301,7 @@ in lib.makeScopeWithSplicing
     sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
     version = "9.2";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook rsync
+      bsdSetupHook netbsdSetupHook rsync
     ];
     propagatedBuildInputs = with self; compatIfNeeded;
     extraPaths = with self; [
@@ -298,7 +337,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "18nqwlndfc34qbbgqx5nffil37jfq9aw663ippasfxd2hlyc106x";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff rsync
     ];
@@ -320,7 +359,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff rsync
     ];
@@ -331,7 +370,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff rsync
     ];
@@ -347,7 +386,41 @@ in lib.makeScopeWithSplicing
     path = "usr.bin/make";
     sha256 = "0vi73yicbmbp522qzqvd979cx6zm5jakhy77xh73c1kygf8klccs";
     version = "9.2";
-    postPatch = ''
+
+   postPatch = ''
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.doc.mk \
+       --replace '-o ''${DOCOWN}' "" \
+       --replace '-g ''${DOCGRP}' ""
+     for mk in $BSDSRCDIR/share/mk/bsd.inc.mk $BSDSRCDIR/share/mk/bsd.kinc.mk; do
+       substituteInPlace $mk \
+         --replace '-o ''${BINOWN}' "" \
+         --replace '-g ''${BINGRP}' ""
+     done
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.kmodule.mk \
+       --replace '-o ''${KMODULEOWN}' "" \
+       --replace '-g ''${KMODULEGRP}' ""
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.lib.mk \
+       --replace '-o ''${LIBOWN}' "" \
+       --replace '-g ''${LIBGRP}' "" \
+       --replace '-o ''${DEBUGOWN}' "" \
+       --replace '-g ''${DEBUGGRP}' ""
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.lua.mk \
+       --replace '-o ''${LIBOWN}' "" \
+       --replace '-g ''${LIBGRP}' ""
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.man.mk \
+       --replace '-o ''${MANOWN}' "" \
+       --replace '-g ''${MANGRP}' ""
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.nls.mk \
+       --replace '-o ''${NLSOWN}' "" \
+       --replace '-g ''${NLSGRP}' ""
+     substituteInPlace $BSDSRCDIR/share/mk/bsd.prog.mk \
+       --replace '-o ''${BINOWN}' "" \
+       --replace '-g ''${BINGRP}' "" \
+       --replace '-o ''${RUMPBINOWN}' "" \
+       --replace '-g ''${RUMPBINGRP}' "" \
+       --replace '-o ''${DEBUGOWN}' "" \
+       --replace '-g ''${DEBUGGRP}' ""
+
       # make needs this to pick up our sys make files
       export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
 
@@ -433,11 +506,11 @@ in lib.makeScopeWithSplicing
     HOSTPROG = "tic";
     buildInputs = with self; compatIfNeeded;
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff nbperf
     ];
-    makeFlags = [ "TOOLDIR=$(out)" ];
+    makeFlags = defaultMakeFlags ++ [ "TOOLDIR=$(out)" ];
     extraPaths = with self; [
       libterminfo.src
       (fetchNetBSD "usr.bin/tic" "9.2" "1mwdfg7yx1g43ss378qsgl5rqhsxskqvsd2mqvrn38qw54i8v5i1")
@@ -465,7 +538,7 @@ in lib.makeScopeWithSplicing
     sha256 = "1yz3n4hncdkk6kp595fh2q5lg150vpqg8iw2dccydkyw4y3hgsjj";
     NIX_CFLAGS_COMPILE = [ "-DMAKE_BOOTSTRAP" ];
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal install mandoc byacc flex rsync
     ];
     buildInputs = with self; compatIfNeeded;
@@ -483,15 +556,31 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "0nxnmj4c8s3hb9n3fpcmd0zl3l1nmhivqgi9a35sis943qvpgl9h";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff rsync nbperf rpcgen
     ];
+
+    # The makefiles define INCSDIR per subdirectory, so we have to set
+    # something else on the command line so those definitions aren't
+    # overridden.
+    postPatch = ''
+      find "$BSDSRCDIR" -name Makefile -exec \
+        sed -i -E \
+          -e 's_/usr/include_''${INCSDIR0}_' \
+          {} \;
+    '';
+
+    # multiple header dirs, see above
+    postConfigure = ''
+      makeFlags=''${makeFlags/INCSDIR/INCSDIR0}
+    '';
+
     extraPaths = with self; [ common ];
     headersOnly = true;
     noCC = true;
     meta.platforms = lib.platforms.netbsd;
-    makeFlags = [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ];
+    makeFlags = defaultMakeFlags ++ [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ];
   };
 
   common = fetchNetBSD "common" "9.2" "1pfylz9r3ap5wnwwbwczbfjb1m5qdyspzbnmxmcdkpzz2zgj64b9";
@@ -502,15 +591,23 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "03s18q8d9giipf05bx199fajc2qwikji0djz7hw63d2lya6bfnpj";
 
-    # Fix this error when building bootia32.efi and bootx64.efi:
-    # error: PHDR segment not covered by LOAD segment
-    patches = [ ./no-dynamic-linker.patch ];
+    patches = [
+      # Fix this error when building bootia32.efi and bootx64.efi:
+      # error: PHDR segment not covered by LOAD segment
+      ./no-dynamic-linker.patch
+
+      # multiple header dirs, see above
+      ./sys-headers-incsdir.patch
+    ];
+
+    # multiple header dirs, see above
+    inherit (self.include) postPatch;
 
     CONFIG = "GENERIC";
 
     propagatedBuildInputs = with self; [ include ];
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal install tsort lorder statHook rsync uudecode config genassym
     ];
 
@@ -518,9 +615,11 @@ in lib.makeScopeWithSplicing
       pushd arch/$MACHINE/conf
       config $CONFIG
       popd
-    '';
+    ''
+      # multiple header dirs, see above
+      + self.include.postConfigure;
 
-    makeFlags = [ "FIRMWAREDIR=$(out)/libdata/firmware" ];
+    makeFlags = defaultMakeFlags ++ [ "FIRMWAREDIR=$(out)/libdata/firmware" ];
     hardeningDisable = [ "pic" ];
     MKKMOD = "no";
     NIX_CFLAGS_COMPILE = [ "-Wa,--no-warn" ];
@@ -573,7 +672,7 @@ in lib.makeScopeWithSplicing
     sha256 = "02gm5a5zhh8qp5r5q5r7x8x6x50ir1i0ncgsnfwh1vnrz6mxbq7z";
     extraPaths = with self; [ common libc.src sys.src ];
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       byacc install tsort lorder mandoc statHook
     ];
@@ -588,7 +687,7 @@ in lib.makeScopeWithSplicing
     buildInputs = with self; [ libterminfo libcurses ];
     propagatedBuildInputs = with self; compatIfNeeded;
     SHLIBINSTALLDIR = "$(out)/lib";
-    makeFlags = [ "LIBDO.terminfo=${self.libterminfo}/lib" ];
+    makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ];
     postPatch = ''
       sed -i '1i #undef bool_t' el.h
       substituteInPlace config.h \
@@ -607,7 +706,7 @@ in lib.makeScopeWithSplicing
     version = "9.2";
     sha256 = "0pq05k3dj0dfsczv07frnnji92mazmy2qqngqbx2zgqc1x251414";
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal install tsort lorder mandoc statHook nbperf tic
     ];
     buildInputs = with self; compatIfNeeded;
@@ -640,7 +739,7 @@ in lib.makeScopeWithSplicing
     ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
     propagatedBuildInputs = with self; compatIfNeeded;
     MKDOC = "no"; # missing vfontedpr
-    makeFlags = [ "LIBDO.terminfo=${self.libterminfo}/lib" ];
+    makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ];
     postPatch = lib.optionalString (!stdenv.isDarwin) ''
       substituteInPlace printw.c \
         --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \
@@ -667,10 +766,10 @@ in lib.makeScopeWithSplicing
     path = "lib/librpcsvc";
     version = "9.2";
     sha256 = "1q34pfiyjbrgrdqm46jwrsqms49ly6z3b0xh1wg331zga900vq5n";
-    makeFlags = [ "INCSDIR=$(out)/include/rpcsvc" ];
+    makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(out)/include/rpcsvc" ];
     meta.platforms = lib.platforms.netbsd;
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install tsort lorder rpcgen statHook
     ];
@@ -748,7 +847,7 @@ in lib.makeScopeWithSplicing
     sha256 = "0al5jfazvhlzn9hvmnrbchx4d0gm282hq5gp4xs2zmj9ycmf6d03";
     meta.platforms = lib.platforms.netbsd;
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff flex
       byacc genassym gencat lorder tsort statHook rsync
@@ -766,7 +865,7 @@ in lib.makeScopeWithSplicing
     # Hack to prevent a symlink being installed here for compatibility.
     SHLINKINSTALLDIR = "/usr/libexec";
     USE_FORT = "yes";
-    makeFlags = [ "BINDIR=$(out)/libexec" "CLIBOBJ=${self.libc}/lib" ];
+    makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/libexec" "CLIBOBJ=${self.libc}/lib" ];
     extraPaths = with self; [ libc.src ] ++ libc.extraPaths;
   };
 
@@ -786,7 +885,7 @@ in lib.makeScopeWithSplicing
       (fetchNetBSD "external/bsd/jemalloc" "9.2" "0cq704swa0h2yxv4gc79z2lwxibk9k7pxh3q5qfs7axx3jx3n8kb")
     ];
     nativeBuildInputs = with buildPackages.netbsd; [
-      bsdSetupHook
+      bsdSetupHook netbsdSetupHook
       makeMinimal
       install mandoc groff flex
       byacc genassym gencat lorder tsort statHook rsync rpcgen
@@ -797,7 +896,7 @@ in lib.makeScopeWithSplicing
     SHLIBINSTALLDIR = "$(out)/lib";
     MKPICINSTALL = "yes";
     NLSDIR = "$(out)/share/nls";
-    makeFlags = [ "FILESDIR=$(out)/var/db"];
+    makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db"];
     postInstall = ''
       pushd ${self.headers}
       find . -type d -exec mkdir -p $out/\{} \;
@@ -851,7 +950,7 @@ in lib.makeScopeWithSplicing
     noCC = true;
     version = "9.2";
     sha256 = "0svfc0byk59ri37pyjslv4c4rc7zw396r73mr593i78d39q5g3ad";
-    makeFlags = [ "BINDIR=$(out)/share" ];
+    makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ];
   };
 
   misc = mkDerivation {
@@ -859,7 +958,7 @@ in lib.makeScopeWithSplicing
     noCC = true;
     version = "9.2";
     sha256 = "1j2cdssdx6nncv8ffj7f7ybl7m9hadjj8vm8611skqdvxnjg6nbc";
-    makeFlags = [ "BINDIR=$(out)/share" ];
+    makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ];
   };
 
   man = mkDerivation {
@@ -867,7 +966,7 @@ in lib.makeScopeWithSplicing
     noCC = true;
     version = "9.2";
     sha256 = "1l4lmj4kmg8dl86x94sr45w0xdnkz8dn4zjx0ipgr9bnq98663zl";
-    makeFlags = [ "FILESDIR=$(out)/share" ];
+    makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/share" ];
   };
   #
   # END MISCELLANEOUS
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/install-setup-hook.sh b/nixpkgs/pkgs/os-specific/bsd/netbsd/install-setup-hook.sh
new file mode 100644
index 000000000000..4bfd4d785fac
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/install-setup-hook.sh
@@ -0,0 +1,8 @@
+addNetBSDInstallMakeFlags() {
+  export INSTALL_FILE="install -U -c"
+  export INSTALL_DIR="install -U -d"
+  export INSTALL_LINK="install -U -l h"
+  export INSTALL_SYMLINK="install -U -l s"
+}
+
+preConfigureHooks+=(addNetBSDInstallMakeFlags)
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/setup-hook.sh b/nixpkgs/pkgs/os-specific/bsd/netbsd/setup-hook.sh
new file mode 100644
index 000000000000..fa8b19e7d8ce
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/setup-hook.sh
@@ -0,0 +1,15 @@
+mergeNetBSDSourceDir() {
+  # merge together all extra paths
+  # there should be a better way to do this
+  chmod -R u+w $BSDSRCDIR
+  for path in $extraPaths; do
+    rsync -Er --chmod u+w $path/ $BSDSRCDIR/
+  done
+}
+
+addNetBSDMakeFlags() {
+  makeFlags="INCSDIR=${!outputDev}/include $makeFlags"
+}
+
+postUnpackHooks+=(mergeNetBSDSourceDir)
+preConfigureHooks+=(addNetBSDMakeFlags)
diff --git a/nixpkgs/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch b/nixpkgs/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch
new file mode 100644
index 000000000000..ed85f8ea5b0c
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 3f1e18dc659d..163362b82f94 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,6 +2,8 @@
+ 
+ .include <bsd.own.mk>
+ 
++INCSDIR= ${INCSDIR0}
++
+ SUBDIR=	altq arch compat dev fs miscfs \
+ 	net net80211 netatalk netbt netcan netipsec netinet netinet6 \
+         netmpls netsmb \
diff --git a/nixpkgs/pkgs/os-specific/bsd/setup-hook.sh b/nixpkgs/pkgs/os-specific/bsd/setup-hook.sh
index 98fee66f5dfe..4bdfde68b62e 100644
--- a/nixpkgs/pkgs/os-specific/bsd/setup-hook.sh
+++ b/nixpkgs/pkgs/os-specific/bsd/setup-hook.sh
@@ -36,11 +36,6 @@ addMakeFlags() {
   export MKUNPRIVED=yes
   export EXTERNAL_TOOLCHAIN=yes
 
-  export INSTALL_FILE="install -U -c"
-  export INSTALL_DIR="xinstall -U -d"
-  export INSTALL_LINK="install -U -l h"
-  export INSTALL_SYMLINK="install -U -l s"
-
   makeFlags="MACHINE=$MACHINE $makeFlags"
   makeFlags="MACHINE_ARCH=$MACHINE_ARCH $makeFlags"
   makeFlags="AR=$AR $makeFlags"
@@ -63,15 +58,9 @@ addMakeFlags() {
 }
 
 setBSDSourceDir() {
-  # merge together all extra paths
-  # there should be a better way to do this
   sourceRoot=$PWD/$sourceRoot
   export BSDSRCDIR=$sourceRoot
   export _SRC_TOP_=$BSDSRCDIR
-  chmod -R u+w $sourceRoot
-  for path in $extraPaths; do
-    rsync -Er --chmod u+w $path/ $sourceRoot/
-  done
 
   cd $sourceRoot
   if [ -d "$BSD_PATH" ]
@@ -85,7 +74,7 @@ includesPhase() {
 
     local flagsArray=(
          $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
-         DESTDIR=${!outputInclude} includes
+         includes
     )
 
     echoCmd 'includes flags' "${flagsArray[@]}"
diff --git a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
index cb85566b5128..66190b7b4e37 100644
--- a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -69,7 +69,13 @@ appleDerivation' stdenv {
     #define TARGET_OS_UNIX          0
     #define TARGET_OS_EMBEDDED      0
     #define TARGET_OS_IPHONE        0
+    #define TARGET_OS_IOS           0
+    #define TARGET_OS_WATCH         0
+    #define TARGET_OS_BRIDGE        0
+    #define TARGET_OS_TV            0
+    #define TARGET_OS_SIMULATOR     0
     #define TARGET_IPHONE_SIMULATOR 0
+    #define TARGET_OS_NANO          0
     #define TARGET_OS_LINUX         0
 
     #define TARGET_CPU_PPC          0
diff --git a/nixpkgs/pkgs/os-specific/darwin/sigtool/default.nix b/nixpkgs/pkgs/os-specific/darwin/sigtool/default.nix
index 933ef784879f..4c573af95be1 100644
--- a/nixpkgs/pkgs/os-specific/darwin/sigtool/default.nix
+++ b/nixpkgs/pkgs/os-specific/darwin/sigtool/default.nix
@@ -1,24 +1,18 @@
-{ lib, stdenv, fetchFromGitHub, pkg-config, cmake, makeWrapper, openssl }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, openssl }:
 
-stdenv.mkDerivation {
-  name = "sigtool";
+stdenv.mkDerivation rec {
+  pname = "sigtool";
+  version = "0.1.2";
 
   src = fetchFromGitHub {
     owner = "thefloweringash";
     repo = "sigtool";
-    rev = "4a3719b42dc91c3f513df94048851cc98e7c7fcf";
-    sha256 = "04ra1cx7k1sdbkj5yrvl0s3l333vpir8rnm8k1dh2zy1w0a6hpqa";
+    rev = "v${version}";
+    sha256 = "sha256-v4udqW37vwcqBdqfvfwHnoyXpuLFt188ekVCPCPsTPM";
   };
 
-  nativeBuildInputs = [ pkg-config makeWrapper ];
+  nativeBuildInputs = [ pkg-config ];
   buildInputs = [ openssl ];
 
   installFlags = [ "PREFIX=$(out)" ];
-
-  # Upstream (me) asserts the driver script is optional.
-  postInstall = ''
-    substitute $NIX_BUILD_TOP/$sourceRoot/codesign.sh $out/bin/codesign \
-      --replace sigtool "$out/bin/sigtool"
-    chmod a+x $out/bin/codesign
-  '';
 }
diff --git a/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff b/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff
index fa6edf98b3de..d96f6c9c4fef 100644
--- a/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff
+++ b/nixpkgs/pkgs/os-specific/darwin/trash/trash.diff
@@ -7,7 +7,7 @@ index 5e4306f..9c975fc 100644
  	@echo ---- Compiling:
  	@echo ======================================
 -	$(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
-+	$(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
++	$(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
  
  analyze:
  	@echo
diff --git a/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix b/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix
index 57f8ba0d33b3..b67d737034e4 100644
--- a/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/915resolution/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
-  name = "915resolution-0.5.3";
+  pname = "915resolution";
+  version = "0.5.3";
 
   src = fetchurl {
-    url = "http://915resolution.mango-lang.org/${name}.tar.gz";
+    url = "http://915resolution.mango-lang.org/915resolution-${version}.tar.gz";
     sha256 = "0hmmy4kkz3x6yigz6hk99416ybznd67dpjaxap50nhay9f1snk5n";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/acpid/default.nix b/nixpkgs/pkgs/os-specific/linux/acpid/default.nix
index d28ff447681e..2b8dac0c8e43 100644
--- a/nixpkgs/pkgs/os-specific/linux/acpid/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/acpid/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
-  name = "acpid-2.0.32";
+  pname = "acpid";
+  version = "2.0.32";
 
   src = fetchurl {
-    url = "mirror://sourceforge/acpid2/${name}.tar.xz";
+    url = "mirror://sourceforge/acpid2/acpid-${version}.tar.xz";
     sha256 = "0zhmxnhnhg4v1viw82yjr22kram6k5k1ixznhayk8cnw7q5x7lpj";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix b/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix
index 4a3d1a36bd74..d494e95e3db6 100644
--- a/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/acpitool/default.nix
@@ -7,10 +7,11 @@ let
    };
 
 in stdenv.mkDerivation rec {
-  name = "acpitool-0.5.1";
+  pname = "acpitool";
+  version = "0.5.1";
 
   src = fetchurl {
-    url = "mirror://sourceforge/acpitool/${name}.tar.bz2";
+    url = "mirror://sourceforge/acpitool/acpitool-${version}.tar.bz2";
     sha256 = "004fb6cd43102918b6302cf537a2db7ceadda04aef2e0906ddf230f820dad34f";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/afuse/default.nix b/nixpkgs/pkgs/os-specific/linux/afuse/default.nix
index 75c44e111725..5bf32fbe6661 100644
--- a/nixpkgs/pkgs/os-specific/linux/afuse/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/afuse/default.nix
@@ -1,11 +1,14 @@
-{ lib, stdenv, fetchurl, pkg-config, autoreconfHook, fuse }:
+{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, fuse }:
 
-stdenv.mkDerivation {
-  name = "afuse-0.4.1";
+stdenv.mkDerivation rec {
+  pname = "afuse";
+  version = "0.4.1";
 
-  src = fetchurl {
-    url = "https://github.com/pcarrier/afuse/archive/v0.4.1.tar.gz";
-    sha256 = "1sfhicmxppkvdd4z9klfn63snb71gr9hff6xij1gzk94xg6m0ycc";
+  src = fetchFromGitHub {
+    owner = "pcarrier";
+    repo = "afuse";
+    rev = "v${version}";
+    sha256 = "06i855h8a1w2jfly2gfy7vwhb2fp74yxbf3r69s28lki2kzwjar6";
   };
 
   nativeBuildInputs = [ autoreconfHook pkg-config ];
diff --git a/nixpkgs/pkgs/os-specific/linux/alsa-project/alsa-firmware/default.nix b/nixpkgs/pkgs/os-specific/linux/alsa-project/alsa-firmware/default.nix
index a627a7762a89..8ad48c41408b 100644
--- a/nixpkgs/pkgs/os-specific/linux/alsa-project/alsa-firmware/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/alsa-project/alsa-firmware/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, buildPackages, autoreconfHook, fetchurl, fetchpatch }:
 
 stdenv.mkDerivation rec {
-  name = "alsa-firmware-1.2.1";
+  pname = "alsa-firmware";
+  version = "1.2.1";
 
   src = fetchurl {
-    url = "mirror://alsa/firmware/${name}.tar.bz2";
+    url = "mirror://alsa/firmware/alsa-firmware-${version}.tar.bz2";
     sha256 = "1aq8z8ajpjvcx7bwhwp36bh5idzximyn77ygk3ifs0my3mbpr8mf";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix b/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix
index 5acf8e560e3d..344913888d57 100644
--- a/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/apparmor/default.nix
@@ -20,7 +20,7 @@
 }:
 
 let
-  apparmor-version = "3.0.1";
+  apparmor-version = "3.0.3";
 
   apparmor-meta = component: with lib; {
     homepage = "https://apparmor.net/";
@@ -32,7 +32,7 @@ let
 
   apparmor-sources = fetchurl {
     url = "https://launchpad.net/apparmor/${lib.versions.majorMinor apparmor-version}/${apparmor-version}/+download/apparmor-${apparmor-version}.tar.gz";
-    sha256 = "096zbg3v7b51x7f1ly61mzd3iy9alad6sd4lam98j2d6v5ragbcg";
+    sha256 = "0nasq8pdmzkrf856yg1v8z5hcs0nn6gw2qr60ab0a7j9ixfv0g8m";
   };
 
   aa-teardown = writeShellScript "aa-teardown" ''
@@ -56,7 +56,7 @@ let
       name = "0003-Added-missing-typedef-definitions-on-parser.patch";
       sha256 = "0yyaqz8jlmn1bm37arggprqz0njb4lhjni2d9c8qfqj0kll0bam0";
     })
-    ];
+  ];
 
   # Set to `true` after the next FIXME gets fixed or this gets some
   # common derivation infra. Too much copy-paste to fix one by one.
diff --git a/nixpkgs/pkgs/os-specific/linux/audit/default.nix b/nixpkgs/pkgs/os-specific/linux/audit/default.nix
index 30327fb1082e..6fa7ba28d8e3 100644
--- a/nixpkgs/pkgs/os-specific/linux/audit/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/audit/default.nix
@@ -8,10 +8,11 @@
 assert enablePython -> python != null;
 
 stdenv.mkDerivation rec {
-  name = "audit-2.8.5"; # at the next release, remove the patches below!
+  pname = "audit";
+  version = "2.8.5"; # at the next release, remove the patches below!
 
   src = fetchurl {
-    url = "https://people.redhat.com/sgrubb/audit/${name}.tar.gz";
+    url = "https://people.redhat.com/sgrubb/audit/audit-${version}.tar.gz";
     sha256 = "1dzcwb2q78q7x41shcachn7f4aksxbxd470yk38zh03fch1l2p8f";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix b/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix
index fbd34afdaf8f..4d081225f11e 100644
--- a/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/bbswitch/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, fetchpatch, kernel, runtimeShell }:
+{ lib, stdenv, fetchFromGitHub, fetchpatch, kernel, runtimeShell }:
 
 let
   baseName = "bbswitch";
@@ -10,9 +10,11 @@ in
 stdenv.mkDerivation {
   inherit name;
 
-  src = fetchurl {
-    url = "https://github.com/Bumblebee-Project/${baseName}/archive/v${version}.tar.gz";
-    sha256 = "0xql1nv8dafnrcg54f3jsi3ny3cd2ca9iv73pxpgxd2gfczvvjkn";
+  src = fetchFromGitHub {
+    owner = "Bumblebee-Project";
+    repo = "bbswitch";
+    rev = "v${version}";
+    hash = "sha256-FHC8myKnouNDERVds2QCJj1ZstjHrOzFpb+FDiSBjL4=";
   };
 
   patches = [
diff --git a/nixpkgs/pkgs/os-specific/linux/bcc/default.nix b/nixpkgs/pkgs/os-specific/linux/bcc/default.nix
index 221f38faa879..929981df4706 100644
--- a/nixpkgs/pkgs/os-specific/linux/bcc/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/bcc/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub
+{ lib, stdenv, fetchFromGitHub, fetchpatch
 , makeWrapper, cmake, llvmPackages, kernel
 , flex, bison, elfutils, python, luajit, netperf, iperf, libelf
 , systemtap, bash, libbpf
@@ -29,6 +29,12 @@ python.pkgs.buildPythonApplication rec {
     # This is needed until we fix
     # https://github.com/NixOS/nixpkgs/issues/40427
     ./fix-deadlock-detector-import.patch
+    # Add definition for BTF_KIND_FLOAT, added in Linux 5.14
+    # Can be removed once linuxHeaders (used here via glibc) are bumped to 5.14+.
+    (fetchpatch {
+      url = "https://salsa.debian.org/debian/bpfcc/-/raw/71136ef5b66a2ecefd635a7aca2e0e835ff09095/debian/patches/0004-compat-defs.patch";
+      sha256 = "05s1zxihwkvbl2r2mqc5dj7fpcipqyvwr11v8b9hqbwjkm3qpz40";
+    })
   ];
 
   propagatedBuildInputs = [ python.pkgs.netaddr ];
diff --git a/nixpkgs/pkgs/os-specific/linux/bluez/default.nix b/nixpkgs/pkgs/os-specific/linux/bluez/default.nix
index a3899fd47c58..3d345e68f3c3 100644
--- a/nixpkgs/pkgs/os-specific/linux/bluez/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/bluez/default.nix
@@ -21,11 +21,11 @@
   ];
 in stdenv.mkDerivation rec {
   pname = "bluez";
-  version = "5.60";
+  version = "5.61";
 
   src = fetchurl {
     url = "mirror://kernel/linux/bluetooth/${pname}-${version}.tar.xz";
-    sha256 = "sha256-cQmZWA0B7lnsWF5efAf9lO3e3AAaom/nRkxUb52UUwQ=";
+    sha256 = "sha256-g6/WxSF5VUv+q7y1OP7C62vpCorDxAhxtJ162LScQjs=";
   };
 
   buildInputs = [
diff --git a/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix b/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix
index 12655c3bed66..92e7606c9bdb 100644
--- a/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/bridge-utils/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, autoreconfHook }:
 
 stdenv.mkDerivation rec {
-  name = "bridge-utils-1.5";
+  pname = "bridge-utils";
+  version = "1.5";
 
   src = fetchurl {
-    url = "mirror://sourceforge/bridge/${name}.tar.gz";
+    url = "mirror://sourceforge/bridge/bridge-utils-${version}.tar.gz";
     sha256 = "42f9e5fb8f6c52e63a98a43b81bd281c227c529f194913e1c51ec48a393b6688";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix b/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix
index 6f94d0f89254..d64996c4961e 100644
--- a/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/cpufrequtils/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, libtool, gettext }:
 
 stdenv.mkDerivation rec {
-  name = "cpufrequtils-008";
+  pname = "cpufrequtils";
+  version = "008";
 
   src = fetchurl {
-    url = "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/${name}.tar.gz";
+    url = "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils-${version}.tar.gz";
     sha256 = "127i38d4w1hv2dzdy756gmbhq25q3k34nqb2s0xlhsfhhdqs0lq0";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/cpupower-gui/default.nix b/nixpkgs/pkgs/os-specific/linux/cpupower-gui/default.nix
new file mode 100644
index 000000000000..2fcc55e14cb3
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/cpupower-gui/default.nix
@@ -0,0 +1,93 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, buildPythonApplication
+, appstream-glib
+, dbus-python
+, desktop-file-utils
+, gettext
+, glib
+, gobject-introspection
+, gtk3
+, hicolor-icon-theme
+, libappindicator
+, libhandy
+, meson
+, ninja
+, pkg-config
+, pygobject3
+, pyxdg
+, systemd
+, wrapGAppsHook
+}:
+
+buildPythonApplication rec {
+  pname = "cpupower-gui";
+  version = "1.0.0";
+
+  # This packages doesn't have a setup.py
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "vagnum08";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "05lvpi3wgyi741sd8lgcslj8i7yi3wz7jwl7ca3y539y50hwrdas";
+  };
+
+  nativeBuildInputs = [
+    appstream-glib
+    desktop-file-utils # needed for update-desktop-database
+    gettext
+    glib # needed for glib-compile-schemas
+    gobject-introspection # need for gtk namespace to be available
+    hicolor-icon-theme # needed for postinstall script
+    meson
+    ninja
+    pkg-config
+    wrapGAppsHook
+
+    # Python packages
+    dbus-python
+    libappindicator
+    pygobject3
+    pyxdg
+  ];
+
+  buildInputs = [
+    glib
+    gtk3
+    libhandy
+  ];
+
+  propagatedBuildInputs = [
+    dbus-python
+    libappindicator
+    pygobject3
+    pyxdg
+  ];
+
+  mesonFlags = [
+    "-Dsystemddir=${placeholder "out"}/lib/systemd"
+  ];
+
+  preConfigure = ''
+    patchShebangs build-aux/meson/postinstall.py
+  '';
+
+  strictDeps = false;
+  dontWrapGApps = true;
+
+  makeWrapperArgs = [ "\${gappsWrapperArgs[@]}" ];
+
+  postFixup = ''
+    wrapPythonProgramsIn $out/lib "$out $propagatedBuildInputs"
+  '';
+
+  meta = with lib; {
+    description = "Change the frequency limits of your cpu and its governor";
+    homepage = "https://github.com/vagnum08/cpupower-gui/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ unode ];
+  };
+}
diff --git a/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix b/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix
index e7304e196798..9522e9e52241 100644
--- a/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation rec {
   pname = "cryptsetup";
-  version = "2.3.6";
+  version = "2.4.0";
 
   outputs = [ "out" "dev" "man" ];
 
   src = fetchurl {
-    url = "mirror://kernel/linux/utils/cryptsetup/v2.3/${pname}-${version}.tar.xz";
-    sha256 = "sha256-spa3oh6ldsKxgGEcyxnQauyN3a7ffHBLDGqBIQwlY18=";
+    url = "mirror://kernel/linux/utils/cryptsetup/v2.4/${pname}-${version}.tar.xz";
+    sha256 = "sha256-xci9oxFZqcAQ6nLnCAU8xCUs9e69ylIOFQq8Bgkof/g=";
   };
 
   # Disable 4 test cases that fail in a sandbox
@@ -29,6 +29,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-cryptsetup-reencrypt"
     "--with-crypto_backend=openssl"
+    "--disable-ssh-token"
   ];
 
   nativeBuildInputs = [ pkg-config ];
diff --git a/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix b/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix
index 86f6f916cefc..fbf47204b3e6 100644
--- a/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/devmem2/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation {
-  name = "devmem2-2004-08-05";
+  pname = "devmem2";
+  version = "unstable-2004-08-05";
 
   src = fetchurl {
     urls = [
diff --git a/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix b/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix
index f754882ccd01..8a083b8b894d 100644
--- a/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/disk-indicator/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchgit, libX11 }:
 
 stdenv.mkDerivation {
-  name = "disk-indicator-2014-05-19";
+  pname = "disk-indicator";
+  version = "unstable-2014-05-19";
 
   src = fetchgit {
     url = "git://github.com/MeanEYE/Disk-Indicator.git";
diff --git a/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix b/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix
index a4e09492debd..a12d97280f19 100644
--- a/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/dmidecode/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, fetchpatch }:
 
 stdenv.mkDerivation rec {
-  name = "dmidecode-3.2";
+  pname = "dmidecode";
+  version = "3.2";
 
   src = fetchurl {
-    url = "mirror://savannah/dmidecode/${name}.tar.xz";
+    url = "mirror://savannah/dmidecode/dmidecode-${version}.tar.xz";
     sha256 = "1pcfhcgs2ifdjwp7amnsr3lq95pgxpr150bjhdinvl505px0cw07";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix b/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
index c1e0dfc5ae43..3a6f31fa5523 100644
--- a/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, fetchpatch, lvm2 }:
 
 stdenv.mkDerivation rec {
-  name = "dmraid-1.0.0.rc16";
+  pname = "dmraid";
+  version = "1.0.0.rc16";
 
   src = fetchurl {
-    url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/${name}.tar.bz2";
+    url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/dmraid-${version}.tar.bz2";
     sha256 = "0m92971gyqp61darxbiri6a48jz3wq3gkp8r2k39320z0i6w8jgq";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/drbd/default.nix b/nixpkgs/pkgs/os-specific/linux/drbd/default.nix
index ae3e986e14af..85be205749ac 100644
--- a/nixpkgs/pkgs/os-specific/linux/drbd/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/drbd/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, flex, systemd, perl }:
 
 stdenv.mkDerivation rec {
-  name = "drbd-8.4.4";
+  pname = "drbd";
+  version = "8.4.4";
 
   src = fetchurl {
-    url = "http://oss.linbit.com/drbd/8.4/${name}.tar.gz";
+    url = "http://oss.linbit.com/drbd/8.4/drbd-${version}.tar.gz";
     sha256 = "1w4889h1ak7gy9w33kd4fgjlfpgmp6hzfya16p1pkc13bjf22mm0";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix b/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix
index 63c539602f12..6171f8ed3073 100644
--- a/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/edac-utils/default.nix
@@ -2,7 +2,8 @@
 , sysfsutils, dmidecode, kmod }:
 
 stdenv.mkDerivation {
-  name = "edac-utils-2015-01-07";
+  pname = "edac-utils";
+  version = "unstable-2015-01-07";
 
   src = fetchFromGitHub {
     owner = "grondo";
diff --git a/nixpkgs/pkgs/os-specific/linux/ell/default.nix b/nixpkgs/pkgs/os-specific/linux/ell/default.nix
index a43b9eff3c81..5fea8c197963 100644
--- a/nixpkgs/pkgs/os-specific/linux/ell/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/ell/default.nix
@@ -7,14 +7,14 @@
 
 stdenv.mkDerivation rec {
   pname = "ell";
-  version = "0.41";
+  version = "0.43";
 
   outputs = [ "out" "dev" ];
 
   src = fetchgit {
     url = "https://git.kernel.org/pub/scm/libs/${pname}/${pname}.git";
     rev = version;
-    sha256 = "sha256-UCE+PgGmbePlOoAc8jXxCX6fHr16qf1AQMKxizfSTJM=";
+    sha256 = "sha256-ttKFKV8spxnkFpZHV4Dn9BxJdjxYLWYrHY+qq6uAOlg=";
   };
 
   nativeBuildInputs = [
diff --git a/nixpkgs/pkgs/os-specific/linux/firejail/default.nix b/nixpkgs/pkgs/os-specific/linux/firejail/default.nix
index 1a9b7e34f5a2..47fce3df5332 100644
--- a/nixpkgs/pkgs/os-specific/linux/firejail/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/firejail/default.nix
@@ -20,6 +20,9 @@ stdenv.mkDerivation rec {
     # By default fbuilder hardcodes the firejail binary to the install path.
     # On NixOS the firejail binary is a setuid wrapper available in $PATH.
     ./fbuilder-call-firejail-on-path.patch
+    # Disable symlink check on /etc/hosts, see
+    # https://github.com/netblue30/firejail/issues/2758#issuecomment-805174951
+    ./remove-link-check.patch
   ];
 
   prePatch = ''
diff --git a/nixpkgs/pkgs/os-specific/linux/firejail/remove-link-check.patch b/nixpkgs/pkgs/os-specific/linux/firejail/remove-link-check.patch
new file mode 100644
index 000000000000..477df57a2411
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/firejail/remove-link-check.patch
@@ -0,0 +1,48 @@
+From ccc726f8ec877d8cda720daa2498e43629b6dd48 Mon Sep 17 00:00:00 2001
+From: Jonas Heinrich <onny@project-insanity.org>
+Date: Sun, 19 Sep 2021 11:48:06 +0200
+Subject: [PATCH 1/2] remove hosts file link check
+
+---
+ src/firejail/fs_hostname.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/src/firejail/fs_hostname.c b/src/firejail/fs_hostname.c
+index 42255070c4..97ce70f9c1 100644
+--- a/src/firejail/fs_hostname.c
++++ b/src/firejail/fs_hostname.c
+@@ -132,10 +132,6 @@ char *fs_check_hosts_file(const char *fname) {
+ 	invalid_filename(fname);
+ 	char *rv = expand_home(fname, cfg.homedir);
+ 
+-	// no a link
+-	if (is_link(rv))
+-		goto errexit;
+-
+ 	// the user has read access to the file
+ 	if (access(rv, R_OK))
+ 		goto errexit;
+
+From c2c51e7ca56075e7388b4f50922b148615d1b125 Mon Sep 17 00:00:00 2001
+From: Jonas Heinrich <onny@project-insanity.org>
+Date: Sun, 19 Sep 2021 11:49:08 +0200
+Subject: [PATCH 2/2] remove hosts file link check
+
+---
+ src/firejail/fs_hostname.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/firejail/fs_hostname.c b/src/firejail/fs_hostname.c
+index 97ce70f9c1..b228707131 100644
+--- a/src/firejail/fs_hostname.c
++++ b/src/firejail/fs_hostname.c
+@@ -154,9 +154,6 @@ void fs_mount_hosts_file(void) {
+ 	struct stat s;
+ 	if (stat("/etc/hosts", &s) == -1)
+ 		goto errexit;
+-	// not a link
+-	if (is_link("/etc/hosts"))
+-		goto errexit;
+ 	// owned by root
+ 	if (s.st_uid != 0)
+ 		goto errexit;
diff --git a/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix b/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix
index 79de65fcb981..389078db0af5 100644
--- a/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/firmware/b43-firmware-cutter/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "b43-fwcutter-019";
+  pname = "b43-fwcutter";
+  version = "019";
 
   src = fetchurl {
-    url = "https://bues.ch/b43/fwcutter/${name}.tar.bz2";
+    url = "https://bues.ch/b43/fwcutter/b43-fwcutter-${version}.tar.bz2";
     sha256 = "1ki1f5fy3yrw843r697f8mqqdz0pbsbqnvg4yzkhibpn1lqqbsnn";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix b/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix
index 6cbaa4acb8d2..3363140ad569 100644
--- a/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchFromGitHub }:
 with lib;
 stdenv.mkDerivation {
-  name = "rtl8192su-unstable-2016-10-05";
+  pname = "rtl8192su";
+  version = "unstable-2016-10-05";
 
   src = fetchFromGitHub {
     owner = "chunkeey";
diff --git a/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix b/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix
index a7bc36106996..4d0ae9a1d5a7 100644
--- a/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/firmware/system76-firmware/default.nix
@@ -2,13 +2,13 @@
 rustPlatform.buildRustPackage rec {
   pname = "system76-firmware";
   # Check Makefile when updating, make sure postInstall matches make install
-  version = "1.0.28";
+  version = "1.0.29";
 
   src = fetchFromGitHub {
     owner = "pop-os";
     repo = pname;
     rev = version;
-    sha256 = "sha256-hv8Vdpg/Tt3eo2AdFlOEG182jH5Oy7/BX3p1EMPQjnc=";
+    sha256 = "sha256-4wvVls6Z42GtC/MVFTvCv1UV/w5nt4p9oTMU4Bqh4JU=";
   };
 
   nativeBuildInputs = [ pkg-config makeWrapper ];
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoBuildFlags = [ "--workspace" ];
 
-  cargoSha256 = "sha256-A39zvxvZB3j59giPAVeucHPzqwofnugmLweiPXh5Uzg=";
+  cargoSha256 = "sha256-x2FO4UWtsvUeKgPxaqjdxtp9vWJq9vLIqQPyGF8nQG4=";
 
   # Purposefully don't install systemd unit file, that's for NixOS
   postInstall = ''
diff --git a/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix b/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix
index 18cdc21f0b60..08c35d79f3dc 100644
--- a/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/fswebcam/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, libv4l, gd }:
 
 stdenv.mkDerivation rec {
-  name = "fswebcam-20200725";
+  pname = "fswebcam";
+  version = "2020-07-25";
 
   src = fetchurl {
-    url = "https://www.sanslogic.co.uk/fswebcam/files/${name}.tar.gz";
+    url = "https://www.sanslogic.co.uk/fswebcam/files/fswebcam-${lib.replaceStrings ["."] [""] version}.tar.gz";
     sha256 = "1dazsrcaw9s30zz3jpxamk9lkff5dkmflp1s0jjjvdbwa0k6k6ii";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/fxload/default.nix b/nixpkgs/pkgs/os-specific/linux/fxload/default.nix
index 3255c992f864..8c1a778ec8bf 100644
--- a/nixpkgs/pkgs/os-specific/linux/fxload/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/fxload/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "fxload-2002_04_11";
+stdenv.mkDerivation rec {
+  pname = "fxload";
+  version = "2002.04.11";
 
   src = fetchurl {
-    url = "mirror://sourceforge/linux-hotplug/fxload-2002_04_11.tar.gz";
+    url = "mirror://sourceforge/linux-hotplug/fxload-${lib.replaceStrings ["."] ["_"] version}.tar.gz";
     sha256 = "1hql93bp3dxrv1p67nc63xsbqwljyynm997ysldrc3n9ifi6s48m";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix b/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix
index ce90a1d432f7..fcf75ac7821a 100644
--- a/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/google-authenticator/default.nix
@@ -1,12 +1,14 @@
-{ stdenv, lib, fetchurl, autoreconfHook, pam, qrencode }:
+{ stdenv, lib, fetchFromGitHub, autoreconfHook, pam, qrencode }:
 
 stdenv.mkDerivation rec {
   pname = "google-authenticator-libpam";
   version = "1.09";
 
-  src = fetchurl {
-    url = "https://github.com/google/google-authenticator-libpam/archive/${version}.tar.gz";
-    sha256 = "0dyhgizl2jcrnfn5sxipxawqrbr6qgjh7aggw8fz3hix861pj7db";
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "google-authenticator-libpam";
+    rev = version;
+    hash = "sha256-DS0h6FWMNKnSSj039bH6iyWrERa5M7LBSkbyig6pyxY=";
   };
 
   nativeBuildInputs = [ autoreconfHook ];
diff --git a/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix b/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix
index 3e4b08151463..301a218ff62e 100644
--- a/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/hd-idle/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "hd-idle-1.05";
+  pname = "hd-idle";
+  version = "1.05";
 
   src = fetchurl {
-    url = "mirror://sourceforge/project/hd-idle/${name}.tgz";
+    url = "mirror://sourceforge/project/hd-idle/hd-idle-${version}.tgz";
     sha256 = "031sm996s0rhy3z91b9xvyimsj2yd2fhsww2al2hxda5s5wzxzjf";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/ioport/default.nix b/nixpkgs/pkgs/os-specific/linux/ioport/default.nix
index 543495ec2afc..6da154648fc2 100644
--- a/nixpkgs/pkgs/os-specific/linux/ioport/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/ioport/default.nix
@@ -1,12 +1,16 @@
 { lib, stdenv, perl, fetchurl }:
 
-stdenv.mkDerivation {
-  name = "ioport-1.2";
+stdenv.mkDerivation rec {
+  pname = "ioport";
+  version = "1.2";
+
   src = fetchurl {
-    url = "https://people.redhat.com/rjones/ioport/files/ioport-1.2.tar.gz";
+    url = "https://people.redhat.com/rjones/ioport/files/ioport-${version}.tar.gz";
     sha256 = "1h4d5g78y7kla0zl25jgyrk43wy3m3bygqg0blki357bc55irb3z";
   };
+
   buildInputs = [ perl ];
+
   meta = with lib; {
     description = "Direct access to I/O ports from the command line";
     homepage = "https://people.redhat.com/rjones/ioport/";
diff --git a/nixpkgs/pkgs/os-specific/linux/iotop-c/default.nix b/nixpkgs/pkgs/os-specific/linux/iotop-c/default.nix
index ca0eddac6664..ea40ff79f64a 100644
--- a/nixpkgs/pkgs/os-specific/linux/iotop-c/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/iotop-c/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "iotop-c";
-  version = "1.18";
+  version = "1.19";
 
   src = fetchFromGitHub {
     owner = "Tomas-M";
     repo = "iotop";
     rev = "v${version}";
-    sha256 = "sha256-5RbxryvRKWJvjuJJwDK6GYnwdtHGfW7XEc75q4omxIA=";
+    sha256 = "sha256-CuZwOIhjl6fpEvfw/4CTjKQkxazLL/NGujmNcx1Jrbc=";
   };
 
   nativeBuildInputs = [ pkg-config ];
diff --git a/nixpkgs/pkgs/os-specific/linux/iotop/default.nix b/nixpkgs/pkgs/os-specific/linux/iotop/default.nix
index a91175aa59f3..0376ff1a55ec 100644
--- a/nixpkgs/pkgs/os-specific/linux/iotop/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/iotop/default.nix
@@ -1,10 +1,11 @@
 { lib, fetchurl, python3Packages, fetchpatch }:
 
 python3Packages.buildPythonApplication rec {
-  name = "iotop-0.6";
+  pname = "iotop";
+  version = "0.6";
 
   src = fetchurl {
-    url = "http://guichaz.free.fr/iotop/files/${name}.tar.bz2";
+    url = "http://guichaz.free.fr/iotop/files/iotop-${version}.tar.bz2";
     sha256 = "0nzprs6zqax0cwq8h7hnszdl3d2m4c2d4vjfxfxbnjfs9sia5pis";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/iproute/default.nix b/nixpkgs/pkgs/os-specific/linux/iproute/default.nix
index ea3c4d36958f..74003ff83b83 100644
--- a/nixpkgs/pkgs/os-specific/linux/iproute/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/iproute/default.nix
@@ -1,17 +1,25 @@
-{ lib, stdenv, fetchurl
+{ lib, stdenv, fetchurl, fetchpatch
 , buildPackages, bison, flex, pkg-config
 , db, iptables, libelf, libmnl
 }:
 
 stdenv.mkDerivation rec {
   pname = "iproute2";
-  version = "5.13.0";
+  version = "5.14.0";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/net/${pname}/${pname}-${version}.tar.xz";
-    sha256 = "sha256-cqLlN3TKyeZfe2F97rsgWfh+iWDW6XE+TXiM6pZvGzY=";
+    sha256 = "1m4ifnxq7lxnm95l5354z8dk3xj6w9isxmbz53266drgln2sf3r1";
   };
 
+  patches = [
+    # To avoid ./configure failing due to invalid arguments:
+    (fetchpatch { # configure: restore backward compatibility
+      url = "https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/patch/?id=a3272b93725a406bc98b67373da67a4bdf6fcdb0";
+      sha256 = "0hyagh2lf6rrfss4z7ca8q3ydya6gg7vfhh25slhpgcn6lnk0xbv";
+    })
+  ];
+
   preConfigure = ''
     # Don't try to create /var/lib/arpd:
     sed -e '/ARPDDIR/d' -i Makefile
diff --git a/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix b/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix
index 127232139016..8a4cde0c79ed 100644
--- a/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix
+++ b/nixpkgs/pkgs/os-specific/linux/iproute/mptcp.nix
@@ -11,12 +11,13 @@ iproute2.overrideAttrs (oa: rec {
     sha256 = "07fihvwlaj0ng8s8sxqhd0a9h1narcnp4ibk88km9cpsd32xv4q3";
   };
 
-  preConfigure = ''
-    # Don't try to create /var/lib/arpd:
-    sed -e '/ARPDDIR/d' -i Makefile
+  preConfigure = oa.preConfigure + ''
     patchShebangs configure
   '';
 
+  # We override "patches" to never apply any iproute2 patches:
+  patches = [ ];
+
   meta = with lib; {
     homepage = "https://github.com/multipath-tcp/iproute-mptcp";
     description = "IP-Route extensions for MultiPath TCP";
diff --git a/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix b/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix
index 33152cc51c13..f10364121a46 100644
--- a/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/ipsec-tools/default.nix
@@ -7,10 +7,11 @@
 # the time being.
 
 stdenv.mkDerivation rec {
-  name = "ipsec-tools-0.8.2";
+  pname = "ipsec-tools";
+  version = "0.8.2";
 
   src = fetchurl {
-    url = "mirror://sourceforge/ipsec-tools/${name}.tar.bz2";
+    url = "mirror://sourceforge/ipsec-tools/ipsec-tools-${version}.tar.bz2";
     sha256 = "0b9gfbz78k2nj0k7jdlm5kajig628ja9qm0z5yksiwz22s3v7dlf";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/iwd/default.nix b/nixpkgs/pkgs/os-specific/linux/iwd/default.nix
index e0a1a566d777..33e1f1783ab3 100644
--- a/nixpkgs/pkgs/os-specific/linux/iwd/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/iwd/default.nix
@@ -8,16 +8,17 @@
 , readline
 , openssl
 , python3Packages
+, fetchpatch
 }:
 
 stdenv.mkDerivation rec {
   pname = "iwd";
-  version = "1.15";
+  version = "1.17";
 
   src = fetchgit {
     url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git";
     rev = version;
-    sha256 = "sha256-qGQDIzJfeBT9VLwr9Ci9vXcM0ZvFvjL2E9PcKoZ8E94=";
+    sha256 = "sha256-uWWdKjxctz8fdiIkSiuOYNcZPhxEWDXaA8QPLnd/I9c=";
   };
 
   outputs = [ "out" "man" ]
@@ -56,6 +57,14 @@ stdenv.mkDerivation rec {
     "--with-systemd-networkdir=${placeholder "out"}/lib/systemd/network/"
   ];
 
+  patches = [
+    # Fix failure in test-eapol. Remove when bumping to 1.18
+    (fetchpatch {
+      url = "https://git.kernel.org/pub/scm/network/wireless/iwd.git/patch/?id=ed10b00afa3f4c087b46d7ba0b60a47bd05d8b39";
+      sha256 = "0n8ixrbfh428ajncakcb9kd2n4fw82kw9sfskn1d9ny0lrg39nvg";
+    })
+  ];
+
   postUnpack = ''
     mkdir -p iwd/ell
     ln -s ${ell.src}/ell/useful.h iwd/ell/useful.h
diff --git a/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix b/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix
index 554898cedebc..12e4c15e62c0 100644
--- a/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/jujuutils/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, linuxHeaders }:
 
-stdenv.mkDerivation {
-  name = "jujuutils-0.2";
+stdenv.mkDerivation rec {
+  pname = "jujuutils";
+  version = "0.2";
 
   src = fetchurl {
-    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jujuutils/jujuutils-0.2.tar.gz";
+    url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jujuutils/jujuutils-${version}.tar.gz";
     sha256 = "1r74m7s7rs9d6y7cffi7mdap3jf96qwm1v6jcw53x5cikgmfxn4x";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix b/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix
index c82f872e4889..717fdaee72a5 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/common-config.nix
@@ -35,7 +35,12 @@ let
   options = {
 
     debug = {
-      DEBUG_INFO                = if (features.debug or false) then yes else no;
+      # Necessary for BTF
+      DEBUG_INFO                = mkMerge [
+        (whenOlder "5.2" (if (features.debug or false) then yes else no))
+        (whenAtLeast "5.2" yes)
+      ];
+      DEBUG_INFO_BTF            = whenAtLeast "5.2" (option yes);
       DEBUG_KERNEL              = yes;
       DEBUG_DEVRES              = no;
       DYNAMIC_DEBUG             = yes;
@@ -881,6 +886,22 @@ let
       # Keeping it a built-in ensures it will be used if possible.
       FB_SIMPLE = yes;
 
+    } // optionalAttrs (versionAtLeast version "5.4" && (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux")) {
+      # Required for various hardware features on Chrome OS devices
+      CHROME_PLATFORMS = yes;
+      CHROMEOS_TBMC = module;
+
+      CROS_EC = module;
+
+      CROS_EC_I2C = module;
+      CROS_EC_SPI = module;
+      CROS_EC_LPC = module;
+      CROS_EC_ISHTP = module;
+
+      CROS_KBD_LED_BACKLIGHT = module;
+    } // optionalAttrs (versionAtLeast version "5.4" && stdenv.hostPlatform.system == "x86_64-linux") {
+      CHROMEOS_LAPTOP = module;
+      CHROMEOS_PSTORE = module;
     };
   };
 in
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json b/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json
index 70a180e737eb..832e516e6efd 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/hardened/patches.json
@@ -13,26 +13,26 @@
     },
     "5.10": {
         "extra": "-hardened1",
-        "name": "linux-hardened-5.10.63-hardened1.patch",
-        "sha256": "1v1w6ybfkgqisdprny9bb658443hbld86r96cvzqdkmd8wfh4513",
-        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.10.63-hardened1/linux-hardened-5.10.63-hardened1.patch"
+        "name": "linux-hardened-5.10.67-hardened1.patch",
+        "sha256": "1yvfqkcffrva9hf4ns0jkksnvkj58h87msim0yhanlyp5jyz3l1p",
+        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.10.67-hardened1/linux-hardened-5.10.67-hardened1.patch"
     },
     "5.13": {
         "extra": "-hardened1",
-        "name": "linux-hardened-5.13.15-hardened1.patch",
-        "sha256": "1g75jh5j9qbh4wbiy2wnc982i2gld2845ai47rczcj7ciycba8n7",
-        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.13.15-hardened1/linux-hardened-5.13.15-hardened1.patch"
+        "name": "linux-hardened-5.13.19-hardened1.patch",
+        "sha256": "1cj99y2xn7l89lf4mn7arp0r98r4nmvql3ffjpngzv8hsf79xgg7",
+        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.13.19-hardened1/linux-hardened-5.13.19-hardened1.patch"
     },
     "5.14": {
         "extra": "-hardened1",
-        "name": "linux-hardened-5.14.2-hardened1.patch",
-        "sha256": "0hcw61bavhyr9v621ajsrl2zgz7kc0z8r7p5kzm37dnlggwl4qh3",
-        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.14.2-hardened1/linux-hardened-5.14.2-hardened1.patch"
+        "name": "linux-hardened-5.14.6-hardened1.patch",
+        "sha256": "0db5jvbvrk93x745ylxwnmx6ldwhmaqdnb2hfa35j0i2xjaw4hxx",
+        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.14.6-hardened1/linux-hardened-5.14.6-hardened1.patch"
     },
     "5.4": {
         "extra": "-hardened1",
-        "name": "linux-hardened-5.4.144-hardened1.patch",
-        "sha256": "1vm19d5cwxw3l2s4h7sbzrhk60m24nhbjdlpqd1bkbm8x8zcp9f3",
-        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.4.144-hardened1/linux-hardened-5.4.144-hardened1.patch"
+        "name": "linux-hardened-5.4.147-hardened1.patch",
+        "sha256": "1jkvfpckmj9ig4nsxxiigawkay05lk8r9fps16iaq6lz2mf9vqsb",
+        "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.4.147-hardened1/linux-hardened-5.4.147-hardened1.patch"
     }
 }
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix
index 8869d0cf653c..4fd140a361c5 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.14.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "4.14.246";
+  version = "4.14.247";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0fpgig84shpas1jc0h4s3aw9brkcq1as84gjbk4bfhc48bpi4mlw";
+    sha256 = "1kdhlsqpmw68xnfiyx98id8wis6kkxca2d4n7w2ncax0kyzrwyz7";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix
index d081f92332b2..ada819f4850d 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.19.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "4.19.206";
+  version = "4.19.207";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1h44lvzxd0cngj71bk8qba9dz7jlqj68ir6xjwfafglb81ppgsxp";
+    sha256 = "1fb658n89xf9asnaqi0bnh64ir2f78bdqyjvfb983qad9wqsadym";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix
index 1469508eb0e3..f1e4329c2d41 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,12 +1,12 @@
 { buildPackages, fetchurl, perl, buildLinux, nixosTests, stdenv, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.4.283";
+  version = "4.4.284";
   extraMeta.branch = "4.4";
   extraMeta.broken = stdenv.isAarch64;
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1d9v4h4cbc4i371lhhwpxbmg88gna6xyi2ahfvv0clz60802y982";
+    sha256 = "00xkd2p181cfkys4nri93xy7snmn8g2481x3qz0js7g9p3kz5bqf";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix
index 89f45b8021a2..22f506f56581 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,12 +1,12 @@
 { buildPackages, fetchurl, perl, buildLinux, nixosTests, stdenv, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.9.282";
+  version = "4.9.283";
   extraMeta.branch = "4.9";
   extraMeta.broken = stdenv.isAarch64;
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "059fin4si93ya13xy831w84q496ksxidpd3kyw38918sfy4p6wk7";
+    sha256 = "0pdh1lyhdp5c5n39wpr622kgchgf30iqk853a2rv9m3s3fry50lm";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.10.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.10.nix
index 313666a471a0..720b619049a0 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.10.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.10.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "5.10.64";
+  version = "5.10.68";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
-    sha256 = "02p36mf41nsa4bamw18vhgbca094q2blbqqljdsb9qid9b94pf1y";
+    sha256 = "08cl4bg9k331apj5fjl3jx6s6l543dnbjc1cfvin951m7l787ahv";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.13.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.13.nix
index 888c6a291969..3f5ae2e13f54 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.13.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.13.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "5.13.16";
+  version = "5.13.19";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
-    sha256 = "1ljigvcg4q6ckr8kna3q5iyjsy7x5mrf1ycqfy0ibbhn9hbqjna9";
+    sha256 = "0yxbcd1k4l4cmdn0hzcck4s0yvhvq9fpwp120dv9cz4i9rrfqxz8";
   };
 } // (args.argsOverride or { }))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.14.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.14.nix
index 2a07ac2a0a95..45d39795db6f 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.14.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.14.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "5.14.3";
+  version = "5.14.7";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
-    sha256 = "1n5808v3vb2c27pv4f8r4avqzqp20dylclbc83cj2872d6z41hy6";
+    sha256 = "1avypasvic298823xzpzzkjbmfv9s8bjnmq92ri62qbakx23j9dg";
   };
 } // (args.argsOverride or { }))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix
index 4d01f1a7e618..ff4f019fc51c 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-5.4.nix
@@ -3,7 +3,7 @@
 with lib;
 
 buildLinux (args // rec {
-  version = "5.4.145";
+  version = "5.4.148";
 
   # modDirVersion needs to be x.y.z, will automatically add .0 if needed
   modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@@ -13,6 +13,6 @@ buildLinux (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
-    sha256 = "1yb8vk5sbnyswylkpqw5i4n9cmnmlrfmbrnmy3nif579q8p7ixsw";
+    sha256 = "1cwibh0y112hip5yd0n692rv44jh4sk2g6mj5n44g754k4i366a6";
   };
 } // (args.argsOverride or {}))
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-lqx.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-lqx.nix
index 118f0e632e65..e4c9f03539f6 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-lqx.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-lqx.nix
@@ -1,8 +1,8 @@
 { lib, fetchFromGitHub, buildLinux, linux_zen, ... } @ args:
 
 let
-  version = "5.13.15";
-  suffix = "lqx1";
+  version = "5.14.6";
+  suffix = "lqx4";
 in
 
 buildLinux (args // {
@@ -14,11 +14,11 @@ buildLinux (args // {
     owner = "zen-kernel";
     repo = "zen-kernel";
     rev = "v${version}-${suffix}";
-    sha256 = "sha256-YDdBOB49NkX2V+lA7JeKRXfpo81/MSoLDOsPjphhBJA=";
+    sha256 = "sha256-arje/B/oXW/2QUHKi1vJ2n20zNbri1bcMU58mE0evOM=";
   };
 
   extraMeta = {
-    branch = "5.13/master";
+    branch = "5.14/master";
     maintainers = with lib.maintainers; [ atemu ];
     description = linux_zen.meta.description + " (Same as linux_zen but less aggressive release schedule)";
   };
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
index 826d99883e4d..daa3c67da962 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
@@ -6,7 +6,7 @@
 , ... } @ args:
 
 let
-  version = "5.10.59-rt52"; # updated by ./update-rt.sh
+  version = "5.10.65-rt53"; # updated by ./update-rt.sh
   branch = lib.versions.majorMinor version;
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
@@ -18,14 +18,14 @@ in buildLinux (args // {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
-    sha256 = "107anv16khx055rpkvfd532rdcfg4ffbs7bhp45hdqi3bz0ssg1k";
+    sha256 = "0riyq1gdm18642fpnhpcw8hspcjqzprzhqnygjxabjjvrvdxxlzd";
   };
 
   kernelPatches = let rt-patch = {
     name = "rt";
     patch = fetchurl {
       url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
-      sha256 = "0i66z1njppn9qvl8msarcgbvmgby6hv8w0k0rmlizwj09i1pmwdx";
+      sha256 = "1sxyic3895dch3x7cabiip5lxv9wqypn22hcy02jg9825260cmd3";
     };
   }; in [ rt-patch ] ++ kernelPatches;
 
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-xanmod.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-xanmod.nix
index 1f899af55aca..3c02140d1357 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-xanmod.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-xanmod.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, buildLinux, fetchFromGitHub, ... } @ args:
 
 let
-  version = "5.14.3";
+  version = "5.14.7";
   release = "1";
   suffix = "xanmod${release}-cacule";
 in
@@ -13,7 +13,7 @@ buildLinux (args // rec {
     owner = "xanmod";
     repo = "linux";
     rev = modDirVersion;
-    sha256 = "sha256-nl8DktW2TsV20ii/f41TsSotE/yBRBH3SYlWKLsfT50=";
+    sha256 = "sha256-W3NAiKMs5ZO/OesWzvfzGqgGa/5A49Gy0a8E4yWY2c8=";
   };
 
   structuredExtraConfig = with lib.kernel; {
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix b/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix
index b19b52132352..1c064059047e 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix
@@ -2,7 +2,7 @@
 
 let
   # having the full version string here makes it easier to update
-  modDirVersion = "5.14.1-zen1";
+  modDirVersion = "5.14.3-zen1";
   parts = lib.splitString "-" modDirVersion;
   version = lib.elemAt parts 0;
   suffix = lib.elemAt parts 1;
@@ -19,7 +19,7 @@ buildLinux (args // {
     owner = "zen-kernel";
     repo = "zen-kernel";
     rev = "v${modDirVersion}";
-    sha256 = "sha256-InfDIs+eELLJE5aw7mD8Jo7SlrpeI/ZuD3z4TyFf7/k=";
+    sha256 = "sha256-ByewBT+1z83jCuEMmNvtmhHaEk4qjHa2Kgue8wVfPIY=";
   };
 
   structuredExtraConfig = with lib.kernel; {
diff --git a/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix b/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix
index 77add0aef539..12eca63e2162 100644
--- a/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -1,5 +1,5 @@
 { lib, buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl
-, libelf, cpio, elfutils, zstd, gawk, python3Minimal
+, libelf, cpio, elfutils, zstd, gawk, python3Minimal, zlib, pahole
 , writeTextFile
 }:
 
@@ -316,10 +316,12 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPat
       ++ optional  (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf
       # Removed util-linuxMinimal since it should not be a dependency.
       ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ]
-      ++ optional  (lib.versionAtLeast version "5.2")  cpio
+      ++ optionals (lib.versionAtLeast version "5.2")  [ cpio pahole ]
       ++ optional  (lib.versionAtLeast version "5.8")  elfutils
       ;
 
+  buildInputs = optional (lib.versionAtLeast version "5.2") zlib;
+
   hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ];
 
   # Absolute paths for compilers avoid any PATH-clobbering issues.
diff --git a/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch b/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch
index e112e6915250..4d9931b03eef 100644
--- a/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch
+++ b/nixpkgs/pkgs/os-specific/linux/kmod/darwin.patch
@@ -69,14 +69,17 @@ diff --git a/shared/macro.h b/shared/macro.h
 index 4fc5405..b5a2702 100644
 --- a/shared/macro.h
 +++ b/shared/macro.h
-@@ -71,3 +71,7 @@
- #endif
- 
- #define UNIQ __COUNTER__
-+
-+ #if !defined(__linux__)
+@@ -53,6 +53,10 @@
+ #define CONCATENATE(x, y) XCONCATENATE(x, y)
+ #define UNIQ(x) CONCATENATE(x, __COUNTER__)
+
++#if !defined(__linux__)
 +#define program_invocation_short_name getprogname()
 +#endif
++
+ /* Temporaries for importing index handling */
+ #define NOFAIL(x) (x)
+ #define fatal(x...) do { } while (0)
 diff --git a/shared/missing.h b/shared/missing.h
 index 4c0d136..ad8ec0f 100644
 --- a/shared/missing.h
diff --git a/nixpkgs/pkgs/os-specific/linux/kmod/default.nix b/nixpkgs/pkgs/os-specific/linux/kmod/default.nix
index ef8296cf16f0..2cb263854ab8 100644
--- a/nixpkgs/pkgs/os-specific/linux/kmod/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kmod/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, autoreconfHook, pkg-config
-, libxslt, xz, elf-header
+, libxslt, xz, zstd, elf-header
 , withStatic ? stdenv.hostPlatform.isStatic
 }:
 
@@ -9,23 +9,24 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "kmod";
-  version = "27";
+  version = "29";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/kernel/${pname}/${pname}-${version}.tar.xz";
-    sha256 = "035wzfzjx4nwidk747p8n085mgkvy531ppn16krrajx2dkqzply1";
+    sha256 = "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b";
   };
 
   nativeBuildInputs = [ autoreconfHook pkg-config libxslt ];
-  buildInputs = [ xz ] ++ lib.optional stdenv.isDarwin elf-header;
+  buildInputs = [ xz zstd ] ++ lib.optional stdenv.isDarwin elf-header;
 
   configureFlags = [
     "--sysconfdir=/etc"
     "--with-xz"
+    "--with-zstd"
     "--with-modulesdirs=${modulesDirs}"
   ] ++ lib.optional withStatic "--enable-static";
 
-  patches = [ ./module-dir.patch ./no-name-field.patch ]
+  patches = [ ./module-dir.patch ]
     ++ lib.optional stdenv.isDarwin ./darwin.patch
     ++ lib.optional withStatic ./enable-static.patch;
 
@@ -49,7 +50,7 @@ in stdenv.mkDerivation rec {
     homepage = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/";
     downloadPage = "https://www.kernel.org/pub/linux/utils/kernel/kmod/";
     changelog = "https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/plain/NEWS?h=v${version}";
-    license = licenses.lgpl21;
+    license = with licenses; [ lgpl21Plus gpl2Plus ]; # GPLv2+ for tools
     platforms = platforms.unix;
   };
 }
diff --git a/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch b/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch
deleted file mode 100644
index 282f59e55e52..000000000000
--- a/nixpkgs/pkgs/os-specific/linux/kmod/no-name-field.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-
----
- tools/modinfo.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/tools/modinfo.c b/tools/modinfo.c
-index 0231bb0..7b2259e 100644
---- a/tools/modinfo.c
-+++ b/tools/modinfo.c
-@@ -178,7 +178,10 @@ static int modinfo_do(struct kmod_module *mod)
- 	is_builtin = (filename == NULL);
- 
- 	if (is_builtin) {
--		printf("%-16s%s%c", "name:", kmod_module_get_name(mod), separator);
-+		if (field == NULL || field != NULL && streq(field, "name")){
-+			printf("%-16s%s%c", "name:",
-+			       kmod_module_get_name(mod), separator);
-+		}
- 		filename = "(builtin)";
- 	}
- 
--- 
-2.28.0
-
diff --git a/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix b/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix
index 6db3a9583ecd..53b4cd60fb1c 100644
--- a/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/kmscube/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchgit, autoreconfHook, libdrm, libX11, libGL, mesa, pkg-config }:
 
 stdenv.mkDerivation {
-  name = "kmscube-2018-06-17";
+  pname = "kmscube";
+  version = "unstable-2018-06-17";
 
   src = fetchgit {
     url = "git://anongit.freedesktop.org/mesa/kmscube";
diff --git a/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix b/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix
index 30ec6cdc7b51..56e412379f80 100644
--- a/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/latencytop/default.nix
@@ -1,13 +1,14 @@
 { lib, stdenv, fetchurl, ncurses, glib, pkg-config, gtk2 }:
 
 stdenv.mkDerivation rec {
-  name = "latencytop-0.5";
+  pname = "latencytop";
+  version = "0.5";
 
   patchPhase = "sed -i s,/usr,$out, Makefile";
   preInstall = "mkdir -p $out/sbin";
 
   src = fetchurl {
-    urls = [ "http://latencytop.org/download/${name}.tar.gz"
+    urls = [ "http://latencytop.org/download/latencytop-${version}.tar.gz"
      "http://dbg.download.sourcemage.org/mirror/latencytop-0.5.tar.gz" ];
     sha256 = "1vq3j9zdab6njly2wp900b3d5244mnxfm88j2bkiinbvxbxp4zwy";
   };
diff --git a/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix b/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix
index c422f5e01bb4..d5be78e913b7 100644
--- a/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/libatasmart/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, pkg-config, udev, buildPackages }:
 
 stdenv.mkDerivation rec {
-  name = "libatasmart-0.19";
+  pname = "libatasmart";
+  version = "0.19";
 
   src = fetchurl {
-    url = "http://0pointer.de/public/${name}.tar.xz";
+    url = "http://0pointer.de/public/libatasmart-${version}.tar.xz";
     sha256 = "138gvgdwk6h4ljrjsr09pxk1nrki4b155hqdzyr8mlk3bwsfmw31";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix b/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
index 2e497584fab8..649ad88a3d18 100644
--- a/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/libbpf/default.nix
@@ -7,30 +7,15 @@ with builtins;
 
 stdenv.mkDerivation rec {
   pname = "libbpf";
-  version = "0.1.1";
+  version = "0.4.0";
 
   src = fetchFromGitHub {
     owner  = "libbpf";
     repo   = "libbpf";
     rev    = "v${version}";
-    sha256 = "0ilnnm4q22f8fagwp8kb37licy4ks861i2iqh2djsypqhnxvx3fv";
+    sha256 = "1by5w7g3i2fc10bi6f0j8jqi2nq0x8r973j2qx7qlfryjxr7b2v3";
   };
 
-  patches = [
-    (fetchpatch { # included upstream for > 0.1.0
-      name = "link-zlib.patch";
-      url = "https://github.com/libbpf/libbpf/commit/8b14cb43ff837.diff";
-      sha256 = "17mvjrs7s727drz013a8qlyj0345ldi2kph6pazcmxv6kl1qrz2z";
-    })
-  ];
-  patchFlags = "-p2";
-  # https://github.com/libbpf/libbpf/pull/201#issuecomment-689174740
-  postPatch = ''
-    substituteInPlace ../scripts/check-reallocarray.sh \
-      --replace 'mktemp /tmp/' 'mktemp ' \
-      --replace '/bin/rm' 'rm'
-  '';
-
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ libelf zlib ];
 
diff --git a/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix b/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix
deleted file mode 100644
index 2abe07b0964e..000000000000
--- a/nixpkgs/pkgs/os-specific/linux/libfabric/default.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook, libpsm2 }:
-
-stdenv.mkDerivation rec {
-  pname = "libfabric";
-  version = "1.13.0";
-
-  enableParallelBuilding = true;
-
-  src = fetchFromGitHub {
-    owner = "ofiwg";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "sha256-felGKpdihOi4TCp95T1ti7fErQVphP0vYGRKEwlQt4Q=";
-  };
-
-  nativeBuildInputs = [ pkg-config autoreconfHook ] ;
-
-  buildInputs = [ libpsm2 ] ;
-
-  configureFlags = [ "--enable-psm2=${libpsm2}" ] ;
-
-  meta = with lib; {
-    homepage = "http://libfabric.org/";
-    description = "Open Fabric Interfaces";
-    license = with licenses; [ gpl2 bsd2 ];
-    platforms = [ "x86_64-linux" ];
-    maintainers = [ maintainers.bzizou ];
-  };
-}
diff --git a/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix b/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix
index 1ac4580b13f1..8b979d479562 100644
--- a/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/libpsm2/default.nix
@@ -13,6 +13,12 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ numactl pkg-config ];
 
+  makeFlags = [
+    # Disable blanket -Werror to avoid build failures
+    # on fresh toolchains like gcc-11.
+    "WERROR="
+  ];
+
   installFlags = [
     "DESTDIR=$(out)"
     "UDEVDIR=/etc/udev"
@@ -35,7 +41,7 @@ stdenv.mkDerivation rec {
     homepage = "https://github.com/intel/opa-psm2";
     description = "The PSM2 library supports a number of fabric media and stacks";
     license = with licenses; [ gpl2 bsd3 ];
-   platforms = [ "x86_64-linux" ];
+    platforms = [ "x86_64-linux" ];
     maintainers = [ maintainers.bzizou ];
   };
 }
diff --git a/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix b/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix
index 87b7d33c5d84..653094c91884 100644
--- a/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/libvolume_id/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "libvolume_id-0.81.1";
+stdenv.mkDerivation rec {
+  pname = "libvolume_id";
+  version = "0.81.1";
 
   src = fetchurl {
-    url = "https://www.marcuscom.com/downloads/libvolume_id-0.81.1.tar.bz2";
+    url = "https://www.marcuscom.com/downloads/libvolume_id-${version}.tar.bz2";
     sha256 = "029z04vdxxsl8gycm9whcljhv6dy4b12ybsxdb99jr251gl1ifs5";
   };
 
@@ -21,5 +22,6 @@ stdenv.mkDerivation {
   meta = with lib; {
     platforms = platforms.linux;
     license = licenses.gpl2;
+    homepage = "http://www.marcuscom.com/downloads/";
   };
 }
diff --git a/nixpkgs/pkgs/os-specific/linux/lightum/default.nix b/nixpkgs/pkgs/os-specific/linux/lightum/default.nix
index ec56a89ce88f..8da12d78bc93 100644
--- a/nixpkgs/pkgs/os-specific/linux/lightum/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/lightum/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchgit, libX11, libXScrnSaver, libXext, glib, dbus, pkg-config, systemd }:
 
 stdenv.mkDerivation {
-  name = "lightum-2014-06-07";
+  pname = "lightum";
+  version = "unstable-2014-06-07";
   src = fetchgit {
     url = "https://github.com/poliva/lightum";
     rev = "123e6babe0669b23d4c1dfa5511088608ff2baa8";
diff --git a/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix b/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix
index 8bbd3ab7f427..19d6f10e3de1 100644
--- a/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/lksctp-tools/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "lksctp-tools-1.0.17";
+  pname = "lksctp-tools";
+  version = "1.0.17";
 
   src = fetchurl {
-    url = "mirror://sourceforge/lksctp/${name}.tar.gz";
+    url = "mirror://sourceforge/lksctp/lksctp-tools-${version}.tar.gz";
     sha256 = "05da6c2v3acc18ndvmkrag6x5lf914b7s0xkkr6wkvrbvd621sqs";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix b/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix
index 21324a5d6ce7..fda11400e8f5 100644
--- a/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/lm-sensors/default.nix
@@ -1,5 +1,12 @@
-{ lib, stdenv, fetchzip, bison, flex, which, perl
-, sensord ? false, rrdtool ? null
+{ lib
+, stdenv
+, fetchFromGitHub
+, bison
+, flex
+, which
+, perl
+, sensord ? false
+, rrdtool ? null
 }:
 
 assert sensord -> rrdtool != null;
@@ -7,16 +14,18 @@ assert sensord -> rrdtool != null;
 stdenv.mkDerivation rec {
   pname = "lm-sensors";
   version = "3.6.0";
-  dashedVersion = lib.replaceStrings ["."] ["-"] version;
+  dashedVersion = lib.replaceStrings [ "." ] [ "-" ] version;
 
-  src = fetchzip {
-    url = "https://github.com/lm-sensors/lm-sensors/archive/V${dashedVersion}.tar.gz";
-    sha256 = "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn";
+  src = fetchFromGitHub {
+    owner = "lm-sensors";
+    repo = "lm-sensors";
+    rev = "V${dashedVersion}";
+    hash = "sha256-9lfHCcODlS7sZMjQhK0yQcCBEoGyZOChx/oM0CU37sY=";
   };
 
   nativeBuildInputs = [ bison flex which ];
   buildInputs = [ perl ]
-   ++ lib.optional sensord rrdtool;
+    ++ lib.optional sensord rrdtool;
 
   makeFlags = [
     "PREFIX=${placeholder "out"}"
diff --git a/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix b/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix
index 6286735b758b..d87820f24664 100644
--- a/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/lsscsi/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
-stdenv.mkDerivation {
-  name = "lsscsi-0.32";
+stdenv.mkDerivation rec {
+  pname = "lsscsi";
+  version = "0.32";
 
   src = fetchurl {
-    url = "http://sg.danny.cz/scsi/lsscsi-0.32.tgz";
+    url = "http://sg.danny.cz/scsi/lsscsi-${version}.tgz";
     sha256 = "sha256-CoAOnpTcoqtwLWXXJ3eujK4Hjj100Ly+1kughJ6AKaE=";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix b/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix
index 2e52e49639e2..fed7152d07ae 100644
--- a/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/lvm2/default.nix
@@ -67,23 +67,14 @@ stdenv.mkDerivation rec {
     sed -i 's|^#define LVM_CONFIGURE_LINE.*$|#define LVM_CONFIGURE_LINE "<removed>"|g' ./include/configure.h
   '';
 
-
-  patches = lib.optionals stdenv.hostPlatform.isMusl [
-    (fetchpatch {
-      name = "fix-stdio-usage.patch";
-      url = "https://git.alpinelinux.org/aports/plain/main/lvm2/fix-stdio-usage.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
-      sha256 = "0m6wr6qrvxqi2d2h054cnv974jq1v65lqxy05g1znz946ga73k3p";
-    })
+  patches = [
+    # Musl fixes from Alpine.
+    ./fix-stdio-usage.patch
     (fetchpatch {
       name = "mallinfo.patch";
       url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
       sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0";
     })
-    (fetchpatch {
-      name = "mlockall-default-config.patch";
-      url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mlockall-default-config.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
-      sha256 = "1ivbj3sphgf8n1ykfiv5rbw7s8dgnj5jcr9jl2v8cwf28lkacw5l";
-    })
   ];
 
   doCheck = false; # requires root
diff --git a/nixpkgs/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch b/nixpkgs/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch
new file mode 100644
index 000000000000..59666ffbad5a
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch
@@ -0,0 +1,53 @@
+diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
+index 296618686..96343eeb7 100644
+--- a/lib/commands/toolcontext.c
++++ b/lib/commands/toolcontext.c
+@@ -1619,7 +1619,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
+ 	/* FIXME Make this configurable? */
+ 	reset_lvm_errno(1);
+ 
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	/* Set in/out stream buffering before glibc */
+ 	if (set_buffering
+ #ifdef SYS_gettid
+@@ -2006,7 +2006,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
+ 
+ 	if (cmd->pending_delete_mem)
+ 		dm_pool_destroy(cmd->pending_delete_mem);
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	if (cmd->linebuffer) {
+ 		/* Reset stream buffering to defaults */
+ 		if (is_valid_fd(STDIN_FILENO) &&
+diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
+index d97ff5720..bbbda82bd 100644
+--- a/tools/lvmcmdline.c
++++ b/tools/lvmcmdline.c
+@@ -3342,7 +3342,7 @@ static int _check_standard_fds(void)
+ 	int err = is_valid_fd(STDERR_FILENO);
+ 
+ 	if (!is_valid_fd(STDIN_FILENO) &&
+-	    !(stdin = fopen(_PATH_DEVNULL, "r"))) {
++	    !freopen(_PATH_DEVNULL, "r", stdin)) {
+ 		if (err)
+ 			perror("stdin stream open");
+ 		else
+@@ -3352,7 +3352,7 @@ static int _check_standard_fds(void)
+ 	}
+ 
+ 	if (!is_valid_fd(STDOUT_FILENO) &&
+-	    !(stdout = fopen(_PATH_DEVNULL, "w"))) {
++	    !freopen(_PATH_DEVNULL, "w", stdout)) {
+ 		if (err)
+ 			perror("stdout stream open");
+ 		/* else no stdout */
+@@ -3360,7 +3360,7 @@ static int _check_standard_fds(void)
+ 	}
+ 
+ 	if (!is_valid_fd(STDERR_FILENO) &&
+-	    !(stderr = fopen(_PATH_DEVNULL, "w"))) {
++	    !freopen(_PATH_DEVNULL, "w", stderr)) {
+ 		printf("stderr stream open: %s\n",
+ 		       strerror(errno));
+ 		return 0;
diff --git a/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix b/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix
index 441476d5f065..fe9c11ace1f6 100644
--- a/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/mba6x_bl/default.nix
@@ -1,7 +1,8 @@
 { fetchFromGitHub, kernel, lib, stdenv }:
 
 stdenv.mkDerivation {
-  name = "mba6x_bl-2016-12-08";
+  pname = "mba6x_bl";
+  version = "unstable-2016-12-08";
 
   src = fetchFromGitHub {
     owner = "patjak";
diff --git a/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix b/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
index 935ded637097..01d2bba32a4d 100644
--- a/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/mdadm/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, util-linux, coreutils, fetchurl, groff, system-sendmail }:
 
 stdenv.mkDerivation rec {
-  name = "mdadm-4.1";
+  pname = "mdadm";
+  version = "4.1";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.xz";
+    url = "mirror://kernel/linux/utils/raid/mdadm/mdadm-${version}.tar.xz";
     sha256 = "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix b/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix
index 8a2cf69dd368..eb58dc553676 100644
--- a/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/mingetty/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
-stdenv.mkDerivation {
-  name = "mingetty-1.08";
+stdenv.mkDerivation rec {
+  pname = "mingetty";
+  version = "1.08";
 
   src = fetchurl {
-    url = "mirror://sourceforge/mingetty/mingetty-1.08.tar.gz";
+    url = "mirror://sourceforge/mingetty/mingetty-${version}.tar.gz";
     sha256 = "05yxrp44ky2kg6qknk1ih0kvwkgbn9fbz77r3vci7agslh5wjm8g";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix b/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
index eeea1d74dcac..da2ba4b9ff2d 100644
--- a/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
@@ -1,13 +1,14 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "mkinitcpio-nfs-utils-0.3";
+  pname = "mkinitcpio-nfs-utils";
+  version = "0.3";
 
   src = fetchurl {
-    url = "https://sources.archlinux.org/other/mkinitcpio/${name}.tar.xz";
+    url = "https://sources.archlinux.org/other/mkinitcpio/mkinitcpio-nfs-utils-${version}.tar.xz";
     sha256 = "0fc93sfk41ycpa33083kyd7i4y00ykpbhj5qlw611bjghj4x946j";
     # ugh, upstream...
-    name = "${name}.tar.gz";
+    name = "mkinitcpio-nfs-utils-${version}.tar.gz";
   };
 
   makeFlags = [ "DESTDIR=$(out)" "bindir=/bin" ];
diff --git a/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix b/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
index 3498625be757..d5129ca7f73a 100644
--- a/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/mxu11x0/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchurl, kernel }:
 
 stdenv.mkDerivation {
-  name = "mxu11x0-1.4-${kernel.version}";
+  pname = "mxu11x0";
+  version = "1.4-${kernel.version}";
 
   src = fetchurl {
     url = "https://www.moxa.com/Moxa/media/PDIM/S100000385/moxa-uport-1000-series-linux-3.x-and-4.x-for-uport-11x0-series-driver-v1.4.tgz";
diff --git a/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix b/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix
index 0121c4a6f1c8..23bc8ff0dfad 100644
--- a/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/nss_ldap/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl, openldap, perl}:
 
-stdenv.mkDerivation {
-  name = "nss_ldap-265";
+stdenv.mkDerivation rec {
+  pname = "nss_ldap";
+  version = "265";
 
   src = fetchurl {
-    url = "http://www.padl.com/download/nss_ldap-265.tar.gz";
+    url = "http://www.padl.com/download/nss_ldap-${version}.tar.gz";
     sha256 = "1a16q9p97d2blrj0h6vl1xr7dg7i4s8x8namipr79mshby84vdbp";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/numad/default.nix b/nixpkgs/pkgs/os-specific/linux/numad/default.nix
index 21d5a871f4e9..0526c02f75f8 100644
--- a/nixpkgs/pkgs/os-specific/linux/numad/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/numad/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "numad-0.5";
+  pname = "numad";
+  version = "0.5";
 
   src = fetchurl {
-    url = "https://git.fedorahosted.org/cgit/numad.git/snapshot/${name}.tar.xz";
+    url = "https://git.fedorahosted.org/cgit/numad.git/snapshot/numad-${version}.tar.xz";
     sha256 = "08zd1yc3w00yv4mvvz5sq1gf91f6p2s9ljcd72m33xgnkglj60v4";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix b/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix
index 7dccdccaf7b8..6d21a4fca61b 100644
--- a/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -19,10 +19,10 @@ rec {
   # Policy: use the highest stable version as the default (on our master).
   stable = if stdenv.hostPlatform.system == "x86_64-linux"
     then generic {
-      version = "470.63.01";
-      sha256_64bit = "sha256:057dsc0j3136r5gc08id3rwz9c0x7i01xkcwfk77vqic9b6486kg";
-      settingsSha256 = "sha256:0lizp4hn49yvca2yd76yh3awld98pkaa35a067lpcld35vb5brgv";
-      persistencedSha256 = "sha256:1f3gdpa23ipjy2xwf7qnxmw7w8xxhqy25rmcz34xkngjf4fn4pbs";
+      version = "470.74";
+      sha256_64bit = "sha256:0snzrb78f283rl92r5cqnr7bdk3yfkqpjac80sqskwi9wgg17r9k";
+      settingsSha256 = "sha256:0hd9973l0zd8a0ia1dysfrk30jqxff1rr07b79ggvqd1xnvv0iqn";
+      persistencedSha256 = "sha256:0i8wfhz53hdnabdcx9awki3nk6xa6dadzn91iswhmfm4jj6964jf";
     }
     else legacy_390;
 
diff --git a/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix b/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix
index 282d9728821e..6f58e3e8f1d9 100644
--- a/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix
+++ b/nixpkgs/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -111,7 +111,7 @@ let
       description = "X.org driver and kernel module for NVIDIA graphics cards";
       license = licenses.unfreeRedistributable;
       platforms = [ "x86_64-linux" ] ++ optionals (!i686bundled) [ "i686-linux" ];
-      maintainers = with maintainers; [ baracoder ];
+      maintainers = with maintainers; [ ];
       priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
       inherit broken;
     };
diff --git a/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix b/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
index 33df8c0cc345..b7f1b6574404 100644
--- a/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
@@ -9,7 +9,8 @@
 {lib, stdenv, xorg, expat, libdrm}:
 
 stdenv.mkDerivation {
-  name = "xorg-sys-opengl-3";
+  pname = "xorg-sys-opengl";
+  version = "3";
   builder = ./builder.sh;
   neededLibs = map (p: p.out)
     [xorg.libXxf86vm xorg.libXext expat libdrm stdenv.cc.cc];
diff --git a/nixpkgs/pkgs/os-specific/linux/otpw/default.nix b/nixpkgs/pkgs/os-specific/linux/otpw/default.nix
index fed7930bf148..14381ac68c16 100644
--- a/nixpkgs/pkgs/os-specific/linux/otpw/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/otpw/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, pam }:
 
 stdenv.mkDerivation rec {
-  name = "otpw-1.3";
+  pname = "otpw";
+  version = "1.3";
 
   src = fetchurl {
-    url = "https://www.cl.cam.ac.uk/~mgk25/download/${name}.tar.gz";
+    url = "https://www.cl.cam.ac.uk/~mgk25/download/otpw-${version}.tar.gz";
     sha256 = "1k3hc7xbxz6hkc55kvddi3cibafwf93ivn58sy1l888d3l5dwmrk";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix b/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix
index bfe9ac7c830c..4b2cc7a3822b 100644
--- a/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pam_ccreds/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl, pam, openssl, db}:
 
 stdenv.mkDerivation rec {
-  name = "pam_ccreds-10";
+  pname = "pam_ccreds";
+  version = "10";
 
   src = fetchurl {
-    url = "https://www.padl.com/download/${name}.tar.gz";
+    url = "https://www.padl.com/download/pam_ccreds-${version}.tar.gz";
     sha256 = "1h7zyg1b1h69civyvrj95w22dg0y7lgw3hq4gqkdcg35w1y76fhz";
   };
   patchPhase = ''
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix b/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix
index cb04fa5b4242..af5fbccff052 100644
--- a/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pam_krb5/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, pam, libkrb5 }:
 
 stdenv.mkDerivation rec {
-  name = "pam-krb5-4.10";
+  pname = "pam-krb5";
+  version = "4.10";
 
   src = fetchurl {
-    url = "https://archives.eyrie.org/software/kerberos/${name}.tar.gz";
+    url = "https://archives.eyrie.org/software/kerberos/pam-krb5-${version}.tar.gz";
     sha256 = "09wzxd5zrj5bzqpb01qf148npj5k8hmd2bx2ij1qsy40hdxqyq79";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix b/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix
index e327a551b231..988256808dbb 100644
--- a/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pam_ldap/default.nix
@@ -1,10 +1,11 @@
 { stdenv, fetchurl, pam, openldap, perl }:
 
 stdenv.mkDerivation rec {
-  name = "pam_ldap-186";
+  pname = "pam_ldap";
+  version = "186";
 
   src = fetchurl {
-    url = "https://www.padl.com/download/${name}.tar.gz";
+    url = "https://www.padl.com/download/pam_ldap-${version}.tar.gz";
     sha256 = "0lv4f7hc02jrd2l3gqxd247qq62z11sp3fafn8lgb8ymb7aj5zn8";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix b/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix
index 1a66e986d8b2..8411c4fdbfaf 100644
--- a/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pam_usb/default.nix
@@ -33,10 +33,11 @@ let
 in
 
 stdenv.mkDerivation rec {
-  name = "pam_usb-0.5.0";
+  pname = "pam_usb";
+  version = "0.5.0";
 
   src = fetchurl {
-    url = "mirror://sourceforge/pamusb/${name}.tar.gz";
+    url = "mirror://sourceforge/pamusb/pam_usb-${version}.tar.gz";
     sha256 = "1g1w0s9d8mfld8abrn405ll5grv3xgs0b0hsganrz6qafdq9j7q1";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix b/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix
index a4da6be691e9..bca58bd808eb 100644
--- a/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pcmciautils/default.nix
@@ -7,10 +7,11 @@
 
 # FIXME: should add an option to choose between hotplug and udev.
 stdenv.mkDerivation rec {
-  name = "pcmciautils-018";
+  pname = "pcmciautils";
+  version = "018";
 
   src = fetchurl {
-    url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/${name}.tar.gz";
+    url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/pcmciautils-${version}.tar.gz";
     sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix b/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix
index 113cceb50a45..8c3e31e45384 100644
--- a/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/perf-tools/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchFromGitHub, perl }:
 
 stdenv.mkDerivation {
-  name = "perf-tools-20171219";
+  pname = "perf-tools";
+  version = "unstable-2017-12-19";
 
   src = fetchFromGitHub {
     owner = "brendangregg";
diff --git a/nixpkgs/pkgs/os-specific/linux/pflask/default.nix b/nixpkgs/pkgs/os-specific/linux/pflask/default.nix
index f3e63133d1e1..92294b58e42a 100644
--- a/nixpkgs/pkgs/os-specific/linux/pflask/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pflask/default.nix
@@ -1,13 +1,14 @@
-{ lib, stdenv, fetchurl, python, wafHook }:
+{ lib, stdenv, fetchFromGitHub, python, wafHook }:
 
 stdenv.mkDerivation rec {
   pname = "pflask";
-  version = "git-2015-12-17";
-  rev = "599418bb6453eaa0ccab493f9411f13726c1a636";
+  version = "unstable-2015-12-17";
 
-  src = fetchurl {
-    url = "https://github.com/ghedo/pflask/archive/${rev}.tar.gz";
-    sha256 = "2545fca37f9da484b46b6fb5e3a9bbba6526a9725189fe4af5227ef6e6fca440";
+  src = fetchFromGitHub {
+    owner = "ghedo";
+    repo = "pflask";
+    rev = "599418bb6453eaa0ccab493f9411f13726c1a636";
+    hash = "sha256-0RjitZd2JUK7WUEJuw4qhUx3joY5OI0Hh74mTzp7GmY=";
   };
 
   nativeBuildInputs = [ wafHook ];
@@ -15,9 +16,9 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Lightweight process containers for Linux";
-    homepage    = "https://ghedo.github.io/pflask/";
-    license     = lib.licenses.bsd2;
-    platforms   = lib.platforms.linux;
+    homepage = "https://ghedo.github.io/pflask/";
+    license = lib.licenses.bsd2;
+    platforms = lib.platforms.linux;
     maintainers = with lib.maintainers; [ ];
   };
 }
diff --git a/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix b/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix
index 17723983c696..4076641717f4 100644
--- a/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/pm-utils/default.nix
@@ -12,10 +12,11 @@ let
 in
 
 stdenv.mkDerivation rec {
-  name = "pm-utils-1.4.1";
+  pname = "pm-utils";
+  version = "1.4.1";
 
   src = fetchurl {
-    url = "https://pm-utils.freedesktop.org/releases/${name}.tar.gz";
+    url = "https://pm-utils.freedesktop.org/releases/pm-utils-${version}.tar.gz";
     sha256 = "02qc6zaf7ams6qcc470fwb6jvr4abv3lrlx16clqpn36501rkn4f";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/procdump/default.nix b/nixpkgs/pkgs/os-specific/linux/procdump/default.nix
index 75ca2cb165e0..0b40a4dd0365 100644
--- a/nixpkgs/pkgs/os-specific/linux/procdump/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/procdump/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "procdump";
-  version = "1.1.1";
+  version = "1.2";
 
   src = fetchFromGitHub {
     owner = "Microsoft";
     repo = "ProcDump-for-Linux";
     rev = version;
-    sha256 = "0h5fhk39d10kjbinzw1yp6nr8w8l300mn9qxrkpivdkyfn6bpq2f";
+    sha256 = "sha256-gVswAezHl7E2cBTJEQhPFXhHkzhWVHSpPF8m0s8+ekc=";
   };
 
   nativeBuildInputs = [ zlib ];
diff --git a/nixpkgs/pkgs/os-specific/linux/qmk-udev-rules/default.nix b/nixpkgs/pkgs/os-specific/linux/qmk-udev-rules/default.nix
new file mode 100644
index 000000000000..7fb5b092ca42
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/qmk-udev-rules/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+## Usage
+# In NixOS, simply add this package to services.udev.packages:
+#   services.udev.packages = [ pkgs.qmk-udev-rules ];
+
+stdenv.mkDerivation rec {
+  pname = "qmk-udev-rules";
+  version = "0.13.23";
+
+  src = fetchFromGitHub {
+    owner = "qmk";
+    repo = "qmk_firmware";
+    rev = version;
+    sha256 = "08d2ri9g6lky3ixd5h0scm95hgc52lcjr3vcnmpdxn780q9ygmkm";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+    install -D util/udev/50-qmk.rules $out/lib/udev/rules.d/50-qmk.rules
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/qmk/qmk_firmware";
+    description = "Official QMK udev rules list";
+    platforms = platforms.linux;
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ ekleog ];
+  };
+}
diff --git a/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix b/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix
index 851a903cf072..facf690a9bd4 100644
--- a/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/sch_cake/default.nix
@@ -3,7 +3,8 @@
 assert lib.versionAtLeast kernel.version "4.4";
 
 stdenv.mkDerivation {
-  name = "sch_cake-2017-07-16";
+  pname = "sch_cake";
+  version = "unstable-2017-07-16";
 
   src = fetchFromGitHub {
     owner = "dtaht";
diff --git a/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix b/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix
index 08e61a98f6b9..a9137b18f39d 100644
--- a/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/sdparm/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "sdparm";
-  version = "1.11";
+  version = "1.12";
 
   src = fetchurl {
     url = "http://sg.danny.cz/sg/p/${pname}-${version}.tar.xz";
-    sha256 = "1nqjc4w2w47zavcbf5xmm53x1zbwgljaw1lpajcdi537cgy32fa8";
+    sha256 = "sha256-xMnvr9vrZi4vlxJwfsSQkyvU0BC7ESmueplSZUburb4=";
   };
 
   meta = with lib; {
diff --git a/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix b/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix
index 64525052af20..1510981c1767 100644
--- a/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/smemstat/default.nix
@@ -2,10 +2,10 @@
 
 stdenv.mkDerivation rec {
   pname = "smemstat";
-  version = "0.02.08";
+  version = "0.02.10";
   src = fetchurl {
     url = "https://kernel.ubuntu.com/~cking/tarballs/smemstat/smemstat-${version}.tar.xz";
-    sha256 = "1agigvkv1868cskivzrwyiixl658x5bv7xpz4xjc8mlii4maivpp";
+    sha256 = "sha256-Vrs1jOg5yHdEffVo769aaxSawo4iZtGrFJ65Nu+RhcU=";
   };
   buildInputs = [ ncurses ];
   installFlags = [ "DESTDIR=$(out)" ];
diff --git a/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix b/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix
index 4daac076e587..b5f067fffd72 100644
--- a/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/sysfsutils/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "sysfsutils-2.1.0";
+  pname = "sysfsutils";
+  version = "2.1.0";
 
   src = fetchurl {
-    url = "mirror://sourceforge/linux-diag/${name}.tar.gz";
+    url = "mirror://sourceforge/linux-diag/sysfsutils-${version}.tar.gz";
     sha256 = "e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix b/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix
index 78992a0f870a..4d9844f516b0 100644
--- a/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/sysklogd/default.nix
@@ -1,10 +1,11 @@
 {lib, stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "sysklogd-1.5.1";
+stdenv.mkDerivation rec {
+  pname = "sysklogd";
+  version = "1.5.1";
 
   src = fetchurl {
-    url = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.5.1.tar.gz";
+    url = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${version}.tar.gz";
     sha256 = "00f2wy6f0qng7qzga4iicyzl9j8b7mp6mrpfky5jxj93ms2w2rji";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix b/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix
index 2eff999ac7cf..2d5b3e2ab558 100644
--- a/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/sysstat/default.nix
@@ -1,10 +1,11 @@
 { lib, stdenv, fetchurl, gettext, bzip2 }:
 
 stdenv.mkDerivation rec {
-  name = "sysstat-12.4.3";
+  pname = "sysstat";
+  version = "12.4.3";
 
   src = fetchurl {
-    url = "http://pagesperso-orange.fr/sebastien.godard/${name}.tar.xz";
+    url = "http://pagesperso-orange.fr/sebastien.godard/sysstat-${version}.tar.xz";
     sha256 = "sha256-rkMkMfRarLyrrPu+Ep4lBeIVyvqc6ZbXVQxgkaRvC/0=";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/system76-power/default.nix b/nixpkgs/pkgs/os-specific/linux/system76-power/default.nix
index fbc26ca87199..38ce20deeab8 100644
--- a/nixpkgs/pkgs/os-specific/linux/system76-power/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/system76-power/default.nix
@@ -2,19 +2,19 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "system76-power";
-  version = "1.1.16";
+  version = "1.1.17";
 
   src = fetchFromGitHub {
     owner = "pop-os";
     repo = "system76-power";
     rev = version;
-    sha256 = "sha256-OtrhvUkNNgg6KlrqjwiBKL4zuQZBWevb0xgtSlEW2rQ=";
+    sha256 = "sha256-9ndukZPNB0qtU0hA9eUYpiAC8Tw1eF16W+sVU7XKvsg=";
   };
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ dbus libusb1 ];
 
-  cargoSha256 = "sha256-ImACDbnUbwc0ZXgF3xxzes8+vUjt76B1xxgqzhgAYX4=";
+  cargoSha256 = "sha256-6mtBY77d2WAwTpj+g0KVpW/n39uanAL2GNHWC8Qbtqk=";
 
   postInstall = ''
     install -D -m 0644 data/system76-power.conf $out/etc/dbus-1/system.d/system76-power.conf
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch
index ac2d00181602..8a1cdc1da847 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch
@@ -1,4 +1,4 @@
-From 2f4a5e9c9ef1cd57662e8bd4c24e1029a00d55b5 Mon Sep 17 00:00:00 2001
+From 57e31a2d4a5d5bd7a9e1cd8a0d8bc6a00624ad68 Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Tue, 8 Jan 2013 15:46:30 +0100
 Subject: [PATCH 01/19] Start device units for uninitialised encrypted devices
@@ -13,7 +13,7 @@ unit.  (However, this ignores the fsck unit, so it's not perfect...)
  1 file changed, 4 deletions(-)
 
 diff --git a/rules.d/99-systemd.rules.in b/rules.d/99-systemd.rules.in
-index 7c22eefdb7..e3a55e00b5 100644
+index 25b8a590a6..d18999ea87 100644
 --- a/rules.d/99-systemd.rules.in
 +++ b/rules.d/99-systemd.rules.in
 @@ -17,10 +17,6 @@ SUBSYSTEM=="ubi", TAG+="systemd"
@@ -28,5 +28,5 @@ index 7c22eefdb7..e3a55e00b5 100644
  SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root"
  SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks"
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch
index f54430f764e4..129e0825d9fe 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch
@@ -1,4 +1,4 @@
-From 4e96b2e074c4a4f4ce900409872ce2f86704ee5b Mon Sep 17 00:00:00 2001
+From 43465a392b47238a32f8719f603ed9e2c9bb0363 Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Fri, 12 Apr 2013 13:16:57 +0200
 Subject: [PATCH 02/19] Don't try to unmount /nix or /nix/store
@@ -12,7 +12,7 @@ https://github.com/NixOS/nixos/issues/126
  2 files changed, 4 insertions(+)
 
 diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
-index 292b97cd69..791b8e6b7e 100644
+index f683f05981..5a04c2c2a6 100644
 --- a/src/shared/fstab-util.c
 +++ b/src/shared/fstab-util.c
 @@ -40,6 +40,8 @@ bool fstab_is_extrinsic(const char *mount, const char *opts) {
@@ -25,10 +25,10 @@ index 292b97cd69..791b8e6b7e 100644
                          "/etc"))
                  return true;
 diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
-index 3a72a13e1a..541320dc9d 100644
+index c2a26242c0..9936398f32 100644
 --- a/src/shutdown/umount.c
 +++ b/src/shutdown/umount.c
-@@ -500,6 +500,8 @@ static int delete_md(MountPoint *m) {
+@@ -496,6 +496,8 @@ static int delete_md(MountPoint *m) {
  
  static bool nonunmountable_path(const char *path) {
          return path_equal(path, "/")
@@ -38,5 +38,5 @@ index 3a72a13e1a..541320dc9d 100644
                  || path_equal(path, "/usr")
  #endif
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch
index 37caffb97d76..91fdebc7ad38 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch
@@ -1,4 +1,4 @@
-From 3d1b2e56a6ed6cc86a64f6f89765a2900e576402 Mon Sep 17 00:00:00 2001
+From a99666d3d7012c2162fdacf84a57fc0b848fd957 Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Wed, 16 Apr 2014 10:59:28 +0200
 Subject: [PATCH 03/19] Fix NixOS containers
@@ -10,10 +10,10 @@ container, so checking early whether it exists will fail.
  1 file changed, 2 insertions(+)
 
 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index 7515380fcd..14f8a82eb8 100644
+index 04685fecba..0e5ece5f91 100644
 --- a/src/nspawn/nspawn.c
 +++ b/src/nspawn/nspawn.c
-@@ -5323,6 +5323,7 @@ static int run(int argc, char *argv[]) {
+@@ -5590,6 +5590,7 @@ static int run(int argc, char *argv[]) {
                                  goto finish;
                          }
                  } else {
@@ -21,7 +21,7 @@ index 7515380fcd..14f8a82eb8 100644
                          const char *p, *q;
  
                          if (arg_pivot_root_new)
-@@ -5337,6 +5338,7 @@ static int run(int argc, char *argv[]) {
+@@ -5604,6 +5605,7 @@ static int run(int argc, char *argv[]) {
                                  r = -EINVAL;
                                  goto finish;
                          }
@@ -30,5 +30,5 @@ index 7515380fcd..14f8a82eb8 100644
  
          } else {
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch
index 2f14a9d6a7e8..bdd205dd29e8 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch
@@ -1,4 +1,4 @@
-From 3a721cf70e952e933ef5374006bbb11a3a0ad36a Mon Sep 17 00:00:00 2001
+From 3f0780b25bdbe4156a2f761c90083bbba5f4d473 Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Thu, 1 May 2014 14:10:10 +0200
 Subject: [PATCH 04/19] Look for fsck in the right place
@@ -8,7 +8,7 @@ Subject: [PATCH 04/19] Look for fsck in the right place
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
-index 510689f3b7..25cab5acae 100644
+index cd7adfaeb9..68cebdd158 100644
 --- a/src/fsck/fsck.c
 +++ b/src/fsck/fsck.c
 @@ -368,7 +368,7 @@ static int run(int argc, char *argv[]) {
@@ -21,5 +21,5 @@ index 510689f3b7..25cab5acae 100644
                  cmdline[i++] = "-T";
  
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
index 0acccacd6135..8680d147ad17 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
@@ -1,4 +1,4 @@
-From 8b7f881cf22e98e907506f4c403b9e304e332bf9 Mon Sep 17 00:00:00 2001
+From 82698c6a5142e710c302f9c38367ed00d8ec94ba Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Fri, 19 Dec 2014 14:46:17 +0100
 Subject: [PATCH 05/19] Add some NixOS-specific unit directories
@@ -10,14 +10,14 @@ units provided by packages installed into the default profile via
 Also, remove /usr and /lib as these don't exist on NixOS.
 ---
  src/basic/path-lookup.c | 17 ++---------------
- src/core/systemd.pc.in  |  5 +++--
- 2 files changed, 5 insertions(+), 17 deletions(-)
+ src/core/systemd.pc.in  |  8 ++++----
+ 2 files changed, 6 insertions(+), 19 deletions(-)
 
 diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
-index 96b82170d0..bf66bd6b77 100644
+index 05eb17d66c..1cd141d012 100644
 --- a/src/basic/path-lookup.c
 +++ b/src/basic/path-lookup.c
-@@ -94,11 +94,7 @@ int xdg_user_data_dir(char **ret, const char *suffix) {
+@@ -91,11 +91,7 @@ int xdg_user_data_dir(char **ret, const char *suffix) {
  }
  
  static const char* const user_data_unit_paths[] = {
@@ -29,7 +29,7 @@ index 96b82170d0..bf66bd6b77 100644
          NULL
  };
  
-@@ -616,15 +612,13 @@ int lookup_paths_init(
+@@ -613,15 +609,13 @@ int lookup_paths_init(
                                          persistent_config,
                                          SYSTEM_CONFIG_UNIT_DIR,
                                          "/etc/systemd/system",
@@ -40,13 +40,13 @@ index 96b82170d0..bf66bd6b77 100644
                                          STRV_IFNOTNULL(runtime_attached),
                                          STRV_IFNOTNULL(generator),
 -                                        "/usr/local/lib/systemd/system",
-                                         SYSTEM_DATA_UNIT_PATH,
+                                         SYSTEM_DATA_UNIT_DIR,
 -                                        "/usr/lib/systemd/system",
 -                                        STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
                                          STRV_IFNOTNULL(generator_late));
                          break;
  
-@@ -640,14 +634,11 @@ int lookup_paths_init(
+@@ -637,14 +631,11 @@ int lookup_paths_init(
                                          persistent_config,
                                          USER_CONFIG_UNIT_DIR,
                                          "/etc/systemd/user",
@@ -62,7 +62,7 @@ index 96b82170d0..bf66bd6b77 100644
                                          STRV_IFNOTNULL(generator_late));
                          break;
  
-@@ -797,7 +788,6 @@ char **generator_binary_paths(UnitFileScope scope) {
+@@ -794,7 +785,6 @@ char **generator_binary_paths(UnitFileScope scope) {
                  case UNIT_FILE_SYSTEM:
                          add = strv_new("/run/systemd/system-generators",
                                         "/etc/systemd/system-generators",
@@ -70,7 +70,7 @@ index 96b82170d0..bf66bd6b77 100644
                                         SYSTEM_GENERATOR_DIR);
                          break;
  
-@@ -805,7 +795,6 @@ char **generator_binary_paths(UnitFileScope scope) {
+@@ -802,7 +792,6 @@ char **generator_binary_paths(UnitFileScope scope) {
                  case UNIT_FILE_USER:
                          add = strv_new("/run/systemd/user-generators",
                                         "/etc/systemd/user-generators",
@@ -78,7 +78,7 @@ index 96b82170d0..bf66bd6b77 100644
                                         USER_GENERATOR_DIR);
                          break;
  
-@@ -844,12 +833,10 @@ char **env_generator_binary_paths(bool is_system) {
+@@ -841,12 +830,10 @@ char **env_generator_binary_paths(bool is_system) {
                  if (is_system)
                          add = strv_new("/run/systemd/system-environment-generators",
                                          "/etc/systemd/system-environment-generators",
@@ -92,10 +92,10 @@ index 96b82170d0..bf66bd6b77 100644
  
                  if (!add)
 diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index b5cc8f94a5..a701cd05f8 100644
+index fc0f8c34fa..ded74ce50a 100644
 --- a/src/core/systemd.pc.in
 +++ b/src/core/systemd.pc.in
-@@ -38,10 +38,11 @@ systemdsystemconfdir=${systemd_system_conf_dir}
+@@ -38,10 +38,10 @@ systemdsystemconfdir=${systemd_system_conf_dir}
  systemd_user_conf_dir=${sysconfdir}/systemd/user
  systemduserconfdir=${systemd_user_conf_dir}
  
@@ -105,10 +105,22 @@ index b5cc8f94a5..a701cd05f8 100644
  
 -systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemd_user_unit_dir}:/usr/lib/systemd/user:/usr/share/systemd/user
 +systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/nix/var/nix/profiles/default/lib/systemd/user:/run/systemd/user:${systemduserunitdir}
-+
  systemduserunitpath=${systemd_user_unit_path}
  
  systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
+@@ -50,10 +50,10 @@ systemdsystemgeneratordir=${systemd_system_generator_dir}
+ systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
+ systemdusergeneratordir=${systemd_user_generator_dir}
+ 
+-systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
++systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:${systemd_system_generator_dir}
+ systemdsystemgeneratorpath=${systemd_system_generator_path}
+ 
+-systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemd_user_generator_dir}
++systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:${systemd_user_generator_dir}
+ systemdusergeneratorpath=${systemd_user_generator_path}
+ 
+ systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch
index bda27ac1762f..f6fa5833518c 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch
@@ -1,4 +1,4 @@
-From 7a6529ee27028860b93bc539e8bbf3f2374d712f Mon Sep 17 00:00:00 2001
+From e2a8db60ebfb1e0477ce989f6c3d4a95f2e08120 Mon Sep 17 00:00:00 2001
 From: Eelco Dolstra <eelco.dolstra@logicblox.com>
 Date: Mon, 11 May 2015 15:39:38 +0200
 Subject: [PATCH 06/19] Get rid of a useless message in user sessions
@@ -9,23 +9,23 @@ Namely lots of variants of
 
 in containers.
 ---
- src/core/unit.c | 3 ++-
+ src/core/manager.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
-diff --git a/src/core/unit.c b/src/core/unit.c
-index 45a417a090..8af3cb08d6 100644
---- a/src/core/unit.c
-+++ b/src/core/unit.c
-@@ -2163,7 +2163,8 @@ static void unit_check_binds_to(Unit *u) {
-         }
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 8884437347..e23d47b4a4 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -1375,7 +1375,8 @@ static unsigned manager_dispatch_stop_when_bound_queue(Manager *m) {
+                 if (!unit_is_bound_by_inactive(u, &culprit))
+                         continue;
  
-         assert(other);
--        log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
-+        if (u->type != UNIT_MOUNT || detect_container() <= 0)
-+                log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
+-                log_unit_debug(u, "Unit is stopped because bound to inactive unit %s.", culprit->id);
++                if (u->type != UNIT_MOUNT || detect_container() <= 0)
++                        log_unit_debug(u, "Unit is stopped because bound to inactive unit %s.", culprit->id);
  
-         /* A unit we need to run is gone. Sniff. Let's stop this. */
-         r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, NULL, &error, NULL);
+                 /* If stopping a unit fails continuously we might enter a stop loop here, hence stop acting on the
+                  * service being unnecessary after a while. */
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
index d51e1c0f5668..17c53e2e5180 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch
@@ -1,4 +1,4 @@
-From 5580303956ca7d8eb431d23c2af0030c9cc0e6e9 Mon Sep 17 00:00:00 2001
+From 56ae06b48c6852071dfc57c1203c04f07309d757 Mon Sep 17 00:00:00 2001
 From: Gabriel Ebner <gebner@gebner.org>
 Date: Sun, 6 Dec 2015 14:26:36 +0100
 Subject: [PATCH 07/19] hostnamed, localed, timedated: disable methods that
@@ -11,10 +11,10 @@ Subject: [PATCH 07/19] hostnamed, localed, timedated: disable methods that
  3 files changed, 25 insertions(+)
 
 diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
-index a1794bdab1..77134731e1 100644
+index 36702f2fb0..669257ea2f 100644
 --- a/src/hostname/hostnamed.c
 +++ b/src/hostname/hostnamed.c
-@@ -643,6 +643,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
+@@ -797,6 +797,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
          if (r < 0)
                  return r;
  
@@ -24,7 +24,7 @@ index a1794bdab1..77134731e1 100644
          name = empty_to_null(name);
  
          context_read_etc_hostname(c);
-@@ -702,6 +705,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess
+@@ -860,6 +863,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess
          if (r < 0)
                  return r;
  
@@ -35,20 +35,20 @@ index a1794bdab1..77134731e1 100644
  
          context_read_machine_info(c);
 diff --git a/src/locale/localed.c b/src/locale/localed.c
-index 736dacdee9..53e0ee935e 100644
+index df0eb030d4..d026eae97e 100644
 --- a/src/locale/localed.c
 +++ b/src/locale/localed.c
-@@ -317,6 +317,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
+@@ -360,6 +360,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er
          if (r < 0)
                  return r;
  
 +        return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
-+            "Changing system settings via systemd is not supported on NixOS.");
++                                 "Changing system settings via systemd is not supported on NixOS.");
 +
+         use_localegen = locale_gen_check_available();
+ 
          /* If single locale without variable name is provided, then we assume it is LANG=. */
-         if (strv_length(l) == 1 && !strchr(l[0], '=')) {
-                 if (!locale_is_valid(l[0]))
-@@ -432,6 +435,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
+@@ -485,6 +488,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
          if (r < 0)
                  return r;
  
@@ -58,7 +58,7 @@ index 736dacdee9..53e0ee935e 100644
          keymap = empty_to_null(keymap);
          keymap_toggle = empty_to_null(keymap_toggle);
  
-@@ -606,6 +612,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
+@@ -665,6 +671,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err
          if (r < 0)
                  return r;
  
@@ -69,10 +69,10 @@ index 736dacdee9..53e0ee935e 100644
          model = empty_to_null(model);
          variant = empty_to_null(variant);
 diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
-index 76fe04900d..e87c4c8919 100644
+index 66b454269d..0a8fe25d0f 100644
 --- a/src/timedate/timedated.c
 +++ b/src/timedate/timedated.c
-@@ -646,6 +646,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
+@@ -668,6 +668,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
          if (r < 0)
                  return r;
  
@@ -83,7 +83,7 @@ index 76fe04900d..e87c4c8919 100644
          if (!timezone_is_valid(z, LOG_DEBUG))
                  return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid or not installed time zone '%s'", z);
  
-@@ -725,6 +729,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error
+@@ -747,6 +751,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error
          if (r < 0)
                  return r;
  
@@ -93,7 +93,7 @@ index 76fe04900d..e87c4c8919 100644
          if (lrtc == c->local_rtc && !fix_system)
                  return sd_bus_reply_method_return(m, NULL);
  
-@@ -907,6 +914,9 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error
+@@ -930,6 +937,9 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error
          if (r < 0)
                  return r;
  
@@ -104,5 +104,5 @@ index 76fe04900d..e87c4c8919 100644
          if (r < 0)
                  return r;
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch
index 2b1c02b233c7..f272ef23dc01 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch
@@ -1,32 +1,28 @@
-From 874698425f6d68fc0d662cb17c7c29e0af3e8c25 Mon Sep 17 00:00:00 2001
+From b783b2da164482f26ac5e6e347dc41930c072ea5 Mon Sep 17 00:00:00 2001
 From: Nikolay Amiantov <ab@fmap.me>
 Date: Thu, 7 Jul 2016 02:47:13 +0300
 Subject: [PATCH 08/19] Fix hwdb paths
 
 Patch by vcunat.
 ---
- src/libsystemd/sd-hwdb/sd-hwdb.c | 7 +------
- 1 file changed, 1 insertion(+), 6 deletions(-)
+ src/libsystemd/sd-hwdb/hwdb-internal.h | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
 
-diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c
-index cb3c77ce96..7b8c80071f 100644
---- a/src/libsystemd/sd-hwdb/sd-hwdb.c
-+++ b/src/libsystemd/sd-hwdb/sd-hwdb.c
-@@ -297,13 +297,8 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
- }
+diff --git a/src/libsystemd/sd-hwdb/hwdb-internal.h b/src/libsystemd/sd-hwdb/hwdb-internal.h
+index 5ddc2211e6..ee621eec46 100644
+--- a/src/libsystemd/sd-hwdb/hwdb-internal.h
++++ b/src/libsystemd/sd-hwdb/hwdb-internal.h
+@@ -82,8 +82,5 @@ struct trie_value_entry2_f {
+ } _packed_;
  
- static const char hwdb_bin_paths[] =
--        "/etc/systemd/hwdb/hwdb.bin\0"
-         "/etc/udev/hwdb.bin\0"
--        "/usr/lib/systemd/hwdb/hwdb.bin\0"
--#if HAVE_SPLIT_USR
--        "/lib/systemd/hwdb/hwdb.bin\0"
--#endif
--        UDEVLIBEXECDIR "/hwdb.bin\0";
-+        ;
- 
- _public_ int sd_hwdb_new(sd_hwdb **ret) {
-         _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
+ #define hwdb_bin_paths                          \
+-        "/etc/systemd/hwdb/hwdb.bin\0"          \
+-        "/etc/udev/hwdb.bin\0"                  \
+-        "/usr/lib/systemd/hwdb/hwdb.bin\0"      \
+-        _CONF_PATHS_SPLIT_USR_NULSTR("systemd/hwdb/hwdb.bin") \
+-        UDEVLIBEXECDIR "/hwdb.bin\0"
++        "/etc/udev/hwdb.bin\0"
++
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
index a1e8ec963c71..791e47065d6f 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
@@ -1,4 +1,4 @@
-From 367d0dad3d1853048569e315931cb8a27e16a098 Mon Sep 17 00:00:00 2001
+From e24c05ef8cfe48c4f0ebdb92e8147ae2151e4c87 Mon Sep 17 00:00:00 2001
 From: Nikolay Amiantov <ab@fmap.me>
 Date: Tue, 11 Oct 2016 13:12:08 +0300
 Subject: [PATCH 09/19] Change /usr/share/zoneinfo to /etc/zoneinfo
@@ -6,11 +6,11 @@ Subject: [PATCH 09/19] Change /usr/share/zoneinfo to /etc/zoneinfo
 NixOS uses this path.
 ---
  man/localtime.xml         | 4 ++--
- src/basic/time-util.c     | 6 +++---
+ src/basic/time-util.c     | 8 ++++----
  src/firstboot/firstboot.c | 2 +-
  src/nspawn/nspawn.c       | 4 ++--
  src/timedate/timedated.c  | 8 ++++----
- 5 files changed, 12 insertions(+), 12 deletions(-)
+ 5 files changed, 13 insertions(+), 13 deletions(-)
 
 diff --git a/man/localtime.xml b/man/localtime.xml
 index e486474c44..5f373d0723 100644
@@ -35,28 +35,37 @@ index e486474c44..5f373d0723 100644
      <literal>Etc/UTC</literal>. The resulting link should lead to the
      corresponding binary
 diff --git a/src/basic/time-util.c b/src/basic/time-util.c
-index 5318d6378d..04069dc27b 100644
+index 5d162e8ffe..1bec83e555 100644
 --- a/src/basic/time-util.c
 +++ b/src/basic/time-util.c
-@@ -1277,7 +1277,7 @@ int get_timezones(char ***ret) {
-         n_allocated = 2;
-         n_zones = 1;
+@@ -1269,7 +1269,7 @@ static int get_timezones_from_zone1970_tab(char ***ret) {
+ 
+         assert(ret);
  
 -        f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
 +        f = fopen("/etc/zoneinfo/zone1970.tab", "re");
-         if (f) {
-                 for (;;) {
-                         _cleanup_free_ char *line = NULL;
-@@ -1372,7 +1372,7 @@ bool timezone_is_valid(const char *name, int log_level) {
+         if (!f)
+                 return -errno;
+ 
+@@ -1308,7 +1308,7 @@ static int get_timezones_from_tzdata_zi(char ***ret) {
+         _cleanup_strv_free_ char **zones = NULL;
+         int r;
+ 
+-        f = fopen("/usr/share/zoneinfo/tzdata.zi", "re");
++        f = fopen("/etc/zoneinfo/tzdata.zi", "re");
+         if (!f)
+                 return -errno;
+ 
+@@ -1421,7 +1421,7 @@ int verify_timezone(const char *name, int log_level) {
          if (p - name >= PATH_MAX)
-                 return false;
+                 return -ENAMETOOLONG;
  
 -        t = strjoina("/usr/share/zoneinfo/", name);
 +        t = strjoina("/etc/zoneinfo/", name);
  
          fd = open(t, O_RDONLY|O_CLOEXEC);
-         if (fd < 0) {
-@@ -1470,7 +1470,7 @@ int get_timezone(char **ret) {
+         if (fd < 0)
+@@ -1512,7 +1512,7 @@ int get_timezone(char **ret) {
          if (r < 0)
                  return r; /* returns EINVAL if not a symlink */
  
@@ -66,10 +75,10 @@ index 5318d6378d..04069dc27b 100644
                  return -EINVAL;
  
 diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
-index 742b43f9fc..f2cb121816 100644
+index 2cb4f80d5d..ebeaeac52f 100644
 --- a/src/firstboot/firstboot.c
 +++ b/src/firstboot/firstboot.c
-@@ -459,7 +459,7 @@ static int process_timezone(void) {
+@@ -491,7 +491,7 @@ static int process_timezone(void) {
          if (isempty(arg_timezone))
                  return 0;
  
@@ -79,10 +88,10 @@ index 742b43f9fc..f2cb121816 100644
          (void) mkdir_parents(etc_localtime, 0755);
          if (symlink(e, etc_localtime) < 0)
 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index 14f8a82eb8..8632dadec6 100644
+index 0e5ece5f91..cc46435472 100644
 --- a/src/nspawn/nspawn.c
 +++ b/src/nspawn/nspawn.c
-@@ -1810,8 +1810,8 @@ static int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t u
+@@ -1887,8 +1887,8 @@ int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid
  static const char *timezone_from_path(const char *path) {
          return PATH_STARTSWITH_SET(
                          path,
@@ -94,10 +103,10 @@ index 14f8a82eb8..8632dadec6 100644
  
  static bool etc_writable(void) {
 diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
-index e87c4c8919..964a40ba81 100644
+index 0a8fe25d0f..2f02b9a520 100644
 --- a/src/timedate/timedated.c
 +++ b/src/timedate/timedated.c
-@@ -269,7 +269,7 @@ static int context_read_data(Context *c) {
+@@ -279,7 +279,7 @@ static int context_read_data(Context *c) {
  
          r = get_timezone(&t);
          if (r == -EINVAL)
@@ -106,7 +115,7 @@ index e87c4c8919..964a40ba81 100644
          else if (r < 0)
                  log_warning_errno(r, "Failed to get target of /etc/localtime: %m");
  
-@@ -293,7 +293,7 @@ static int context_write_data_timezone(Context *c) {
+@@ -303,7 +303,7 @@ static int context_write_data_timezone(Context *c) {
  
          if (isempty(c->zone) || streq(c->zone, "UTC")) {
  
@@ -115,7 +124,7 @@ index e87c4c8919..964a40ba81 100644
  
                          if (unlink("/etc/localtime") < 0 && errno != ENOENT)
                                  return -errno;
-@@ -301,9 +301,9 @@ static int context_write_data_timezone(Context *c) {
+@@ -311,9 +311,9 @@ static int context_write_data_timezone(Context *c) {
                          return 0;
                  }
  
@@ -128,5 +137,5 @@ index e87c4c8919..964a40ba81 100644
                          return -ENOMEM;
  
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch
index 334156495fcf..d9b048113862 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch
@@ -1,4 +1,4 @@
-From bf285fe7e12bd22f95c14bcefbb5008888c32bfa Mon Sep 17 00:00:00 2001
+From 09f6ca91b4131637038686dafd57b5da642c100e Mon Sep 17 00:00:00 2001
 From: Imuli <i@imu.li>
 Date: Wed, 19 Oct 2016 08:46:47 -0400
 Subject: [PATCH 10/19] localectl: use /etc/X11/xkb for list-x11-*
@@ -10,10 +10,10 @@ NixOS has an option to link the xkb data files to /etc/X11, but not to
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/locale/localectl.c b/src/locale/localectl.c
-index 7d2e887660..91c5139eed 100644
+index 548ac8eb2c..5e372f1566 100644
 --- a/src/locale/localectl.c
 +++ b/src/locale/localectl.c
-@@ -277,7 +277,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
+@@ -280,7 +280,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
          } state = NONE, look_for;
          int r;
  
@@ -23,5 +23,5 @@ index 7d2e887660..91c5139eed 100644
                  return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
  
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
index 902018ee4b91..f88b802b2988 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch
@@ -1,4 +1,4 @@
-From 293b19c5fdbda1b4ee579a7e8ba12f024a6f34c9 Mon Sep 17 00:00:00 2001
+From d5716cd93fdaad16b590a581f39d95954f40748e Mon Sep 17 00:00:00 2001
 From: Franz Pletz <fpletz@fnordicwalking.de>
 Date: Sun, 11 Feb 2018 04:37:44 +0100
 Subject: [PATCH 11/19] build: don't create statedir and don't touch prefixdir
@@ -8,11 +8,11 @@ Subject: [PATCH 11/19] build: don't create statedir and don't touch prefixdir
  1 file changed, 3 deletions(-)
 
 diff --git a/meson.build b/meson.build
-index 580964c3fa..f99d4f3ab5 100644
+index 738879eb21..453ee4b1c0 100644
 --- a/meson.build
 +++ b/meson.build
-@@ -3518,9 +3518,6 @@ install_data('LICENSE.GPL2',
-              'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
+@@ -3538,9 +3538,6 @@ install_data('LICENSE.GPL2',
+              'docs/GVARIANT-SERIALIZATION.md',
               install_dir : docdir)
  
 -meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
@@ -20,7 +20,7 @@ index 580964c3fa..f99d4f3ab5 100644
 -
  ############################################################
  
- check_help = find_program('tools/check-help.sh')
+ # Ensure that changes to the docs/ directory do not break the
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch
index 05fce10e8568..f5a6fde26b1f 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch
@@ -1,4 +1,4 @@
-From 63777e7f690b67952bf4571f8e09e5d8e769d3c0 Mon Sep 17 00:00:00 2001
+From 40a5df71e7af5feefacae9fc95bf94e72c6c12f4 Mon Sep 17 00:00:00 2001
 From: Andreas Rammhold <andreas@rammhold.de>
 Date: Fri, 2 Nov 2018 21:15:42 +0100
 Subject: [PATCH 12/19] inherit systemd environment when calling generators.
@@ -12,19 +12,20 @@ tries to gather environments with that they call
 "environment-generators" and then seems to pass that on to all the other
 executables that are being called from managers.
 ---
- src/core/manager.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
+ src/core/manager.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
 
 diff --git a/src/core/manager.c b/src/core/manager.c
-index 6858950107..07a599ede7 100644
+index e23d47b4a4..1047aadebc 100644
 --- a/src/core/manager.c
 +++ b/src/core/manager.c
-@@ -4142,9 +4142,14 @@ static int manager_run_generators(Manager *m) {
+@@ -4145,10 +4145,15 @@ static int manager_run_generators(Manager *m) {
          argv[4] = NULL;
  
          RUN_WITH_UMASK(0022)
 -                (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, NULL, NULL,
--                                           (char**) argv, m->transient_environment, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
+-                                           (char**) argv, m->transient_environment,
+-                                           EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID);
 -
 +                (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC,
 +                                    // On NixOS we must propagate PATH to generators so they are
@@ -33,10 +34,11 @@ index 6858950107..07a599ede7 100644
 +                                    // function (envp) is set to NULL. This propagates systemd's
 +                                    // environment (e.g. PATH) that was setup
 +                                    // before calling systemd from stage-2-init.sh.
-+                                    NULL, NULL, (char**) argv, /* NixOS: use inherited env */ NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
++                                    NULL, NULL, (char**) argv, /* NixOS: use inherited env */ NULL,
++                                    EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID);
          r = 0;
  
  finish:
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch
index b9bab2d387e9..da6aa2627ff8 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch
@@ -1,4 +1,4 @@
-From 561dc3b864d96753b5dc448e6e1a80460d5f0bc4 Mon Sep 17 00:00:00 2001
+From fe3aff271cf127c1484533237fe0a024e07ae7bc Mon Sep 17 00:00:00 2001
 From: Andreas Rammhold <andreas@rammhold.de>
 Date: Thu, 9 May 2019 11:15:22 +0200
 Subject: [PATCH 13/19] add rootprefix to lookup dir paths
@@ -34,5 +34,5 @@ index 2e60abb4f1..732ec51d36 100644
  #define CONF_PATHS(n)                           \
          CONF_PATHS_USR(n)                       \
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
index c737b61e749a..1ed19358a151 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
@@ -1,4 +1,4 @@
-From 8f619304804b02f4e9d7a340ca90359f96adc6e8 Mon Sep 17 00:00:00 2001
+From 31732478745f7a200004fb8ec013f54dbc536f2e Mon Sep 17 00:00:00 2001
 From: Nikolay Amiantov <ab@fmap.me>
 Date: Thu, 25 Jul 2019 20:45:55 +0300
 Subject: [PATCH 14/19] systemd-shutdown: execute scripts in
@@ -10,7 +10,7 @@ This is needed for NixOS to use such scripts as systemd directory is immutable.
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
-index 0d07865542..26d974ef73 100644
+index a98cfc4d8a..b0b34edda7 100644
 --- a/src/shutdown/shutdown.c
 +++ b/src/shutdown/shutdown.c
 @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) {
@@ -23,5 +23,5 @@ index 0d07865542..26d974ef73 100644
          /* The log target defaults to console, but the original systemd process will pass its log target in through a
           * command line argument, which will override this default. Also, ensure we'll never log to the journal or
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
index 3059216f7c58..2777de09fadb 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
@@ -1,4 +1,4 @@
-From 577b11afe38fc185d785ca8f125f518a4eb21a00 Mon Sep 17 00:00:00 2001
+From 3f2277b86f39cb55936ae11c2365feb283b547cb Mon Sep 17 00:00:00 2001
 From: Nikolay Amiantov <ab@fmap.me>
 Date: Thu, 25 Jul 2019 20:46:58 +0300
 Subject: [PATCH 15/19] systemd-sleep: execute scripts in
@@ -10,10 +10,10 @@ This is needed for NixOS to use such scripts as systemd directory is immutable.
  1 file changed, 1 insertion(+)
 
 diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
-index 39ab554290..880ac7ccb0 100644
+index a3aeb24633..0ed6a34d79 100644
 --- a/src/sleep/sleep.c
 +++ b/src/sleep/sleep.c
-@@ -178,6 +178,7 @@ static int execute(char **modes, char **states) {
+@@ -182,6 +182,7 @@ static int execute(
          };
          static const char* const dirs[] = {
                  SYSTEM_SLEEP_PATH,
@@ -22,5 +22,5 @@ index 39ab554290..880ac7ccb0 100644
          };
  
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
index ad19d910e1e7..6ef53e95d023 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
@@ -1,4 +1,4 @@
-From ba19f629c1806ca2d2ab58154e45bce4ae4a3f0c Mon Sep 17 00:00:00 2001
+From 330490aa8a44206bc03205654680913ab01408a1 Mon Sep 17 00:00:00 2001
 From: Florian Klink <flokli@flokli.de>
 Date: Sat, 7 Mar 2020 22:40:27 +0100
 Subject: [PATCH 16/19] kmod-static-nodes.service: Update ConditionFileNotEmpty
@@ -10,10 +10,10 @@ On NixOS, kernel modules of the currently booted systems are located at
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
-index f4170d6a99..9a6a591bea 100644
+index 777e82d16b..b6abc2bba0 100644
 --- a/units/kmod-static-nodes.service.in
 +++ b/units/kmod-static-nodes.service.in
-@@ -12,7 +12,7 @@ Description=Create list of static device nodes for the current kernel
+@@ -12,7 +12,7 @@ Description=Create List of Static Device Nodes
  DefaultDependencies=no
  Before=sysinit.target systemd-tmpfiles-setup-dev.service
  ConditionCapability=CAP_SYS_MODULE
@@ -23,5 +23,5 @@ index f4170d6a99..9a6a591bea 100644
  [Service]
  Type=oneshot
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
index 585a0aa112e3..775c8e098479 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
@@ -1,4 +1,4 @@
-From c639f311bd27c2bff62a22c34bc92613aaf77587 Mon Sep 17 00:00:00 2001
+From 216018be7b422586b937dae8fd83f51989479a41 Mon Sep 17 00:00:00 2001
 From: Florian Klink <flokli@flokli.de>
 Date: Sun, 8 Mar 2020 01:05:54 +0100
 Subject: [PATCH 17/19] path-util.h: add placeholder for DEFAULT_PATH_NORMAL
@@ -10,7 +10,7 @@ systemd itself uses extensively.
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/src/basic/path-util.h b/src/basic/path-util.h
-index d613709f0b..5cced4c115 100644
+index 26e7362d1f..a8f8a863ec 100644
 --- a/src/basic/path-util.h
 +++ b/src/basic/path-util.h
 @@ -24,11 +24,11 @@
@@ -29,5 +29,5 @@ index d613709f0b..5cced4c115 100644
  #if HAVE_SPLIT_USR
  #  define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0018-logind-seat-debus-show-CanMultiSession-again.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0018-logind-seat-debus-show-CanMultiSession-again.patch
index f634e74e663a..21d466b02bb8 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0018-logind-seat-debus-show-CanMultiSession-again.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0018-logind-seat-debus-show-CanMultiSession-again.patch
@@ -1,4 +1,4 @@
-From ebb37f81c28aaa80acd9187a7d77dcb3cb3828db Mon Sep 17 00:00:00 2001
+From beb594ff3bceb95598ffa8ec47c31bacb2449473 Mon Sep 17 00:00:00 2001
 From: Thomas Tuegel <ttuegel@mailbox.org>
 Date: Mon, 26 Oct 2020 21:21:38 +0100
 Subject: [PATCH 18/19] logind-seat-debus: show CanMultiSession again
@@ -9,10 +9,10 @@ Fixes the "switch user" function in Plasma < 5.20.
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
-index a60ed2d3c2..69b6271075 100644
+index cceb3b1d2d..94b4723bb9 100644
 --- a/src/login/logind-seat-dbus.c
 +++ b/src/login/logind-seat-dbus.c
-@@ -450,7 +450,7 @@ static const sd_bus_vtable seat_vtable[] = {
+@@ -419,7 +419,7 @@ static const sd_bus_vtable seat_vtable[] = {
  
          SD_BUS_PROPERTY("Id", "s", NULL, offsetof(Seat, id), SD_BUS_VTABLE_PROPERTY_CONST),
          SD_BUS_PROPERTY("ActiveSession", "(so)", property_get_active_session, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@@ -22,5 +22,5 @@ index a60ed2d3c2..69b6271075 100644
          SD_BUS_PROPERTY("CanGraphical", "b", property_get_can_graphical, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
          SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, 0),
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0019-pkg-config-derive-prefix-from-prefix.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0019-pkg-config-derive-prefix-from-prefix.patch
index 2d93cdef9a34..da071603557a 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/0019-pkg-config-derive-prefix-from-prefix.patch
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0019-pkg-config-derive-prefix-from-prefix.patch
@@ -1,4 +1,4 @@
-From 5439a516995f9fd57fc91c2cdd016bb18f31aadf Mon Sep 17 00:00:00 2001
+From 2e7477dc29095141a0556ded11f0ee370d82bfbb Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
 Date: Sun, 6 Dec 2020 08:34:19 +0100
 Subject: [PATCH 19/19] pkg-config: derive prefix from --prefix
@@ -16,7 +16,7 @@ Co-Authored-By: Florian Klink <flokli@flokli.de>
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index a701cd05f8..85d6911bdf 100644
+index ded74ce50a..0262f53154 100644
 --- a/src/core/systemd.pc.in
 +++ b/src/core/systemd.pc.in
 @@ -11,7 +11,7 @@
@@ -24,10 +24,10 @@ index a701cd05f8..85d6911bdf 100644
  # shall have underscores.
  
 -prefix=/usr
-+prefix=@prefix@
- root_prefix=@rootprefix_noslash@
++prefix={{PREFIX}}
+ root_prefix={{ROOTPREFIX_NOSLASH}}
  rootprefix=${root_prefix}
- sysconf_dir=@sysconfdir@
+ sysconf_dir={{SYSCONF_DIR}}
 -- 
-2.30.1
+2.32.0
 
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0020-core-respect-install_sysconfdir_samples-in-meson-fil.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0020-core-respect-install_sysconfdir_samples-in-meson-fil.patch
new file mode 100644
index 000000000000..4567c2fa3164
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0020-core-respect-install_sysconfdir_samples-in-meson-fil.patch
@@ -0,0 +1,31 @@
+From 1a2d24d210c9329e8b900fdb01576c57374581d8 Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <andreas@rammhold.de>
+Date: Mon, 26 Jul 2021 16:57:43 +0200
+Subject: [PATCH 20/20] core: respect install_sysconfdir_samples in meson file
+
+The refactoring done in e11a25cadbe caused the configuration files to be
+installed into the pkgsysconfdir regardless of the state of the
+install_sysconfdir_samples boolean that indicated whether or not the
+sample files should be installed.
+---
+ src/core/meson.build | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/core/meson.build b/src/core/meson.build
+index f0d2c6f642..4ff7e00e36 100644
+--- a/src/core/meson.build
++++ b/src/core/meson.build
+@@ -187,6 +187,10 @@ foreach item : in_files
+         file = item[0]
+         dir = item[1]
+ 
++        if not install_sysconfdir_samples and dir == pkgsysconfdir
++                continue
++        endif
++
+         custom_target(
+                 file,
+                 input : file + '.in',
+-- 
+2.32.0
+
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0021-login-respect-install_sysconfdir_samples-in-meson-fi.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0021-login-respect-install_sysconfdir_samples-in-meson-fi.patch
new file mode 100644
index 000000000000..b048249e0519
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0021-login-respect-install_sysconfdir_samples-in-meson-fi.patch
@@ -0,0 +1,29 @@
+From 189ba3af8b21cfc53527453907e800a2917b1bfd Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <andreas@rammhold.de>
+Date: Mon, 26 Jul 2021 17:20:34 +0200
+Subject: [PATCH] login: respect install_sysconfdir_samples in meson file
+
+The refactoring done in c900d89faa0 caused the configuration files to be
+installed into the pkgsysconfdir regardless of the state of the
+install_sysconfdir_samples boolean that indicates whether or not the
+sample files should be installed.
+---
+ src/login/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/login/meson.build b/src/login/meson.build
+index 8c20e6be65..b637adc9a2 100644
+--- a/src/login/meson.build
++++ b/src/login/meson.build
+@@ -67,7 +67,7 @@ pam_systemd_c = files('pam_systemd.c')
+ 
+ enable_logind = conf.get('ENABLE_LOGIND') == 1
+ in_files = [
+-        ['logind.conf',        pkgsysconfdir, enable_logind],
++        ['logind.conf',        pkgsysconfdir, enable_logind and install_sysconfdir_samples],
+         ['70-uaccess.rules',   udevrulesdir,  enable_logind and conf.get('HAVE_ACL') == 1],
+         ['71-seat.rules',      udevrulesdir,  enable_logind],
+         ['73-seat-late.rules', udevrulesdir,  enable_logind],
+-- 
+2.32.0
+
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0022-core-Handle-lookup-paths-being-symlinks.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0022-core-Handle-lookup-paths-being-symlinks.patch
new file mode 100644
index 000000000000..c7d022b1ffde
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0022-core-Handle-lookup-paths-being-symlinks.patch
@@ -0,0 +1,80 @@
+From 5f17b65d30480e489e135b403a072b38535b2911 Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <andreas@rammhold.de>
+Date: Wed, 18 Aug 2021 19:10:08 +0200
+Subject: [PATCH] core: handle lookup paths being symlinks
+
+With a recent change paths leaving the statically known lookup paths
+would be treated differently then those that remained within those. That
+was done (AFAIK) to consistently handle alias names. Unfortunately that
+means that on some distributions, especially those where /etc/ consists
+mostly of symlinks, would trigger that new detection for every single
+unit in /etc/systemd/system. The reason for that is that the units
+directory itself is already a symlink.
+---
+ src/basic/unit-file.c | 33 +++++++++++++++++++++++++++++++--
+ 1 file changed, 31 insertions(+), 2 deletions(-)
+
+diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c
+index 884a0674a9..3ae2a115d0 100644
+--- a/src/basic/unit-file.c
++++ b/src/basic/unit-file.c
+@@ -254,6 +254,7 @@ int unit_file_build_name_map(
+ 
+         _cleanup_hashmap_free_ Hashmap *ids = NULL, *names = NULL;
+         _cleanup_set_free_free_ Set *paths = NULL;
++        _cleanup_strv_free_ char **expanded_search_paths = NULL;
+         uint64_t timestamp_hash;
+         char **dir;
+         int r;
+@@ -273,6 +274,34 @@ int unit_file_build_name_map(
+                         return log_oom();
+         }
+ 
++        /* Go over all our search paths, chase their symlinks and store the
++         * result in the expanded_search_paths list.
++         *
++         * This is important for cases where any of the unit directories itself
++         * are symlinks into other directories and would therefore cause all of
++         * the unit files to be recognized as linked units.
++         *
++         * This is important for distributions such as NixOS where most paths
++         * in /etc/ are symlinks to some other location on the filesystem (e.g.
++         * into /nix/store/).
++         */
++        STRV_FOREACH(dir, (char**) lp->search_path) {
++                _cleanup_free_ char *resolved_dir = NULL;
++                r = strv_extend(&expanded_search_paths, *dir);
++                if (r < 0)
++                        return log_oom();
++
++                r = chase_symlinks(*dir, NULL, 0, &resolved_dir, NULL);
++                if (r < 0) {
++                        if (r != -ENOENT)
++                                log_warning_errno(r, "Failed to resolve symlink %s, ignoring: %m", *dir);
++                        continue;
++                }
++
++                if (strv_consume(&expanded_search_paths, TAKE_PTR(resolved_dir)) < 0)
++                        return log_oom();
++        }
++
+         STRV_FOREACH(dir, (char**) lp->search_path) {
+                 struct dirent *de;
+                 _cleanup_closedir_ DIR *d = NULL;
+@@ -351,11 +380,11 @@ int unit_file_build_name_map(
+                                         continue;
+                                 }
+ 
+-                                /* Check if the symlink goes outside of our search path.
++                                /* Check if the symlink goes outside of our (expanded) search path.
+                                  * If yes, it's a linked unit file or mask, and we don't care about the target name.
+                                  * Let's just store the link source directly.
+                                  * If not, let's verify that it's a good symlink. */
+-                                char *tail = path_startswith_strv(simplified, lp->search_path);
++                                char *tail = path_startswith_strv(simplified, expanded_search_paths);
+                                 if (!tail) {
+                                         log_debug("%s: linked unit file: %s → %s",
+                                                   __func__, filename, simplified);
+-- 
+2.32.0
+
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/0023-path-util-make-find_executable-work-without-proc-mounted.patch b/nixpkgs/pkgs/os-specific/linux/systemd/0023-path-util-make-find_executable-work-without-proc-mounted.patch
new file mode 100644
index 000000000000..026d0278797e
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/0023-path-util-make-find_executable-work-without-proc-mounted.patch
@@ -0,0 +1,29 @@
+From 93413acd3ef3a637a0f31a1d133b103e1dc81fd6 Mon Sep 17 00:00:00 2001
+From: Yu Watanabe <watanabe.yu+github@gmail.com>
+Date: Mon, 23 Aug 2021 06:16:48 +0900
+Subject: [PATCH] path-util: make find_executable() work without /proc mounted
+
+Follow-up for 888f65ace6296ed61285d31db846babf1c11885e.
+
+Hopefully fixes #20514.
+---
+ src/basic/path-util.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/basic/path-util.c b/src/basic/path-util.c
+index d11f254a9f6a..a21981616b59 100644
+--- a/src/basic/path-util.c
++++ b/src/basic/path-util.c
+@@ -630,7 +630,11 @@ static int check_x_access(const char *path, int *ret_fd) {
+                 return r;
+ 
+         r = access_fd(fd, X_OK);
+-        if (r < 0)
++        if (r == -ENOSYS) {
++                /* /proc is not mounted. Fallback to access(). */
++                if (access(path, X_OK) < 0)
++                        return -errno;
++        } else if (r < 0)
+                 return r;
+ 
+         if (ret_fd)
diff --git a/nixpkgs/pkgs/os-specific/linux/systemd/default.nix b/nixpkgs/pkgs/os-specific/linux/systemd/default.nix
index 01d2db5b2f1a..9f92c34cee6b 100644
--- a/nixpkgs/pkgs/os-specific/linux/systemd/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/systemd/default.nix
@@ -12,7 +12,6 @@
 , coreutils
 , gperf
 , getent
-, patchelf
 , glibcLocales
 , glib
 , substituteAll
@@ -40,6 +39,7 @@
 , gnupg
 , zlib
 , xz
+, tpm2-tss
 , libuuid
 , libapparmor
 , intltool
@@ -58,6 +58,12 @@
 , bashInteractive
 , libmicrohttpd
 
+  # the (optional) BPF feature requires bpftool, libbpf, clang and llmv-strip to be avilable during build time.
+  # Only libbpf should be a runtime dependency.
+, bpftools
+, libbpf
+, llvmPackages
+
 , withAnalyze ? true
 , withApparmor ? true
 , withCompression ? true  # adds bzip2, lz4 and xz
@@ -65,10 +71,12 @@
 , withCryptsetup ? true
 , withDocumentation ? true
 , withEfi ? stdenv.hostPlatform.isEfi
+, withFido2 ? true
 , withHomed ? false
 , withHostnamed ? true
 , withHwdb ? true
 , withImportd ? true
+, withLibBPF ? false # currently fails while generating BPF objects
 , withLocaled ? true
 , withLogind ? true
 , withMachined ? true
@@ -83,6 +91,7 @@
 , withShellCompletions ? true
 , withTimedated ? true
 , withTimesyncd ? true
+, withTpm2Tss ? true
 , withUserDb ? true
 , libfido2
 , p11-kit
@@ -90,7 +99,6 @@
   # name argument
 , pname ? "systemd"
 
-
 , libxslt
 , docbook_xsl
 , docbook_xml_dtd_42
@@ -108,15 +116,13 @@ assert withCoredump -> withCompression;
 
 assert withHomed -> withCryptsetup;
 
-assert withCryptsetup ->
-(cryptsetup != null);
+assert withCryptsetup -> (cryptsetup != null);
 let
   wantCurl = withRemote || withImportd;
-
-  version = "247.6";
+  version = "249.4";
 in
 stdenv.mkDerivation {
-  inherit version pname;
+  inherit pname version;
 
   # We use systemd/systemd-stable for src, and ship NixOS-specific patches inside nixpkgs directly
   # This has proven to be less error-prone than the previous systemd fork.
@@ -124,7 +130,7 @@ stdenv.mkDerivation {
     owner = "systemd";
     repo = "systemd-stable";
     rev = "v${version}";
-    sha256 = "sha256-7XYEq3Qw25suwjbtPzx9lVPHUu9ZY/1bADXl2wQbkJc=";
+    sha256 = "0pqi9gbk9kgwvd0idf13ybxz7s4h5przn01bwj6fna44jr0wy41c";
   };
 
   # If these need to be regenerated, `git am path/to/00*.patch` them into a
@@ -152,18 +158,26 @@ stdenv.mkDerivation {
     ./0018-logind-seat-debus-show-CanMultiSession-again.patch
     ./0019-pkg-config-derive-prefix-from-prefix.patch
 
-    # Fix -Werror=format.
-    (fetchpatch {
-      url = "https://github.com/systemd/systemd/commit/ab1aa6368a883bce88e3162fee2bea14aacedf23.patch";
-      sha256 = "1b280l5jrjsg8qhsang199mpqjhkpix4c8bm3blknjnq9iv43add";
-    })
-
-    # Fix CVE-2021-33910, disclosed 2021-07-20
-    (fetchpatch {
-      name = "CVE-2021-33910.patch";
-      url = "https://github.com/systemd/systemd/commit/441e0115646d54f080e5c3bb0ba477c892861ab9.patch";
-      sha256 = "1g1lk95igaadg67kah9bpi4zsc01rg398sd1247ghjsvl5hxn4v4";
-    })
+    # In v249 a bunch of meson files had been touched as part of the migration to
+    # jinja2 for templating. Unfortunately some of those files lost the `install_sysconfdir_samples` check.
+    # The following two patches are part of a PR that was filed to fix those cases.
+    # https://github.com/systemd/systemd/pull/20303
+    ./0020-core-respect-install_sysconfdir_samples-in-meson-fil.patch
+    ./0021-login-respect-install_sysconfdir_samples-in-meson-fi.patch
+
+    # In v248 or v249 we started to get in trouble due to our /etc/systemd/sytem being
+    # a symlink and thus being treated differently by systemd. With the below
+    # patch we mitigate that effect by special casing all our root unit dirs
+    # if they are symlinks. This does exactly what we need (AFAICT).
+    ./0022-core-Handle-lookup-paths-being-symlinks.patch
+
+    # The way files are being tested for being executable changed in v248/v249
+    # which caused our confinement setup to fail as we do not mount /proc by
+    # default.
+    # The issue has been reported upstream and this patch carries the upstream
+    # fix for the same. Upstream now has a test for this scenario.
+    # https://github.com/systemd/systemd/issues/20514
+    ./0023-path-util-make-find_executable-work-without-proc-mounted.patch
   ];
 
   postPatch = ''
@@ -177,14 +191,14 @@ stdenv.mkDerivation {
       "find_program('${stdenv.cc.bintools.targetPrefix}objcopy'"
   '' + (
     let
-      # The folllowing dlopen patches ensure that all the features that are
-      # implemented via dlopen(3) are available (or explicitly deactivated) by
-      # pointing dlopen to the absolute store path instead of relying on the
-      # linkers runtime lookup code.
+      # The folllowing patches references to dynamic libraries to ensure that
+      # all the features that are implemented via dlopen(3) are available (or
+      # explicitly deactivated) by pointing dlopen to the absolute store path
+      # instead of relying on the linkers runtime lookup code.
       #
-      # All of the dlopen calls have to be handled. When new ones are introduced
-      # by upstream (or one of our patches) they must be explicitly declared,
-      # otherwise the build will fail.
+      # All of the shared library references have to be handled. When new ones
+      # are introduced by upstream (or one of our patches) they must be
+      # explicitly declared, otherwise the build will fail.
       #
       # As of systemd version 247 we've seen a few errors like `libpcre2.… not
       # found` when using e.g. --grep with journalctl. Those errors should
@@ -203,32 +217,45 @@ stdenv.mkDerivation {
       # path location).
       #
       # To get a list of dynamically loaded libraries issue something like
-      # `grep -ri 'dlopen("lib' $src` and update the below list.
-      dlopenLibs = [
-        # We did never provide support for libxkbcommon & qrencode
-        { name = "libxkbcommon.so.0"; pkg = null; }
-        { name = "libqrencode.so.4"; pkg = null; }
-
-        # We did not provide libpwquality before so it is safe to disable it for
-        # now.
-        { name = "libpwquality.so.1"; pkg = null; }
-
-        # Only include cryptsetup if it is enabled. We might not be able to
-        # provide it during "bootstrap" in e.g. the minimal systemd build as
-        # cryptsetup has udev (aka systemd) in it's dependencies.
-        { name = "libcryptsetup.so.12"; pkg = if withCryptsetup then cryptsetup else null; }
-
-        # We are using libidn2 so we only provide that and ignore the others.
-        # Systemd does this decision during configure time and uses ifdef's to
-        # enable specific branches. We can safely ignore (nuke) the libidn "v1"
-        # libraries.
-        { name = "libidn2.so.0"; pkg = libidn2; }
-        { name = "libidn.so.12"; pkg = null; }
-        { name = "libidn.so.11"; pkg = null; }
-
-        # journalctl --grep requires libpcre so lets provide it
-        { name = "libpcre2-8.so.0"; pkg = pcre2; }
-      ];
+      # `grep -ri '"lib[a-zA-Z0-9-]*\.so[\.0-9a-zA-z]*"'' $src` and update the below list.
+      dlopenLibs =
+        let
+          opt = condition: pkg: if condition then pkg else null;
+        in
+        [
+          # bpf compilation support
+          { name = "libbpf.so.0"; pkg = opt withLibBPF libbpf; }
+
+          # We did never provide support for libxkbcommon & qrencode
+          { name = "libxkbcommon.so.0"; pkg = null; }
+          { name = "libqrencode.so.4"; pkg = null; }
+
+          # We did not provide libpwquality before so it is safe to disable it for
+          # now.
+          { name = "libpwquality.so.1"; pkg = null; }
+
+          # Only include cryptsetup if it is enabled. We might not be able to
+          # provide it during "bootstrap" in e.g. the minimal systemd build as
+          # cryptsetup has udev (aka systemd) in it's dependencies.
+          { name = "libcryptsetup.so.12"; pkg = opt withCryptsetup cryptsetup; }
+
+          # We are using libidn2 so we only provide that and ignore the others.
+          # Systemd does this decision during configure time and uses ifdef's to
+          # enable specific branches. We can safely ignore (nuke) the libidn "v1"
+          # libraries.
+          { name = "libidn2.so.0"; pkg = libidn2; }
+          { name = "libidn.so.12"; pkg = null; }
+          { name = "libidn.so.11"; pkg = null; }
+
+          # journalctl --grep requires libpcre so lets provide it
+          { name = "libpcre2-8.so.0"; pkg = pcre2; }
+
+          # Support for TPM2 in systemd-cryptsetup, systemd-repart and systemd-cryptenroll
+          { name = "libtss2-esys.so.0"; pkg = opt withTpm2Tss tpm2-tss; }
+          { name = "libtss2-rc.so.0"; pkg = opt withTpm2Tss tpm2-tss; }
+          { name = "libtss2-mu.so.0"; pkg = opt withTpm2Tss tpm2-tss; }
+          { name = "libfido2.so.1"; pkg = opt withFido2 libfido2; }
+        ];
 
       patchDlOpen = dl:
         let
@@ -236,9 +263,9 @@ stdenv.mkDerivation {
         in
         if dl.pkg == null then ''
           # remove the dependency on the library by replacing it with an invalid path
-          for file in $(grep -lr 'dlopen("${dl.name}"' src); do
+          for file in $(grep -lr '"${dl.name}"' src); do
             echo "patching dlopen(\"${dl.name}\", …) in $file to an invalid store path ("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}")…"
-            substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
+            substituteInPlace "$file" --replace '"${dl.name}"' '"/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-not-implemented/${dl.name}"'
           done
         '' else ''
           # ensure that the library we provide actually exists
@@ -247,22 +274,29 @@ stdenv.mkDerivation {
             exit 1
           fi
           # make the path to the dependency explicit
-          for file in $(grep -lr 'dlopen("${dl.name}"' src); do
+          for file in $(grep -lr '"${dl.name}"' src); do
             echo "patching dlopen(\"${dl.name}\", …) in $file to ${library}…"
-            substituteInPlace "$file" --replace 'dlopen("${dl.name}"' 'dlopen("${library}"'
+            substituteInPlace "$file" --replace '"${dl.name}"' '"${library}"'
           done
+
         '';
     in
     # patch all the dlopen calls to contain absolute paths to the libraries
     lib.concatMapStringsSep "\n" patchDlOpen dlopenLibs
   )
-  # finally ensure that there are no left-over dlopen calls that we didn't handle
+  # finally ensure that there are no left-over dlopen calls (or rather strings pointing to shared libraries) that we didn't handle
   + ''
-    if grep -qr 'dlopen("[^/]' src; then
-      echo "Found unhandled dlopen calls: "
-      grep -r 'dlopen("[^/]' src
+    if grep -qr '"lib[a-zA-Z0-9-]*\.so[\.0-9a-zA-z]*"' src; then
+      echo "Found unhandled dynamic library calls: "
+      grep -r '"lib[a-zA-Z0-9-]*\.so[\.0-9a-zA-z]*"' src
       exit 1
     fi
+  ''
+  # Finally patch shebangs that might need patching.
+  # Should no longer be necessary with v250.
+  # https://github.com/systemd/systemd/pull/19638
+  + ''
+    patchShebangs .
   '';
 
   outputs = [ "out" "man" "dev" ];
@@ -273,9 +307,7 @@ stdenv.mkDerivation {
       gperf
       ninja
       meson
-      coreutils # meson calls date, stat etc.
       glibcLocales
-      patchelf
       getent
       m4
 
@@ -286,8 +318,14 @@ stdenv.mkDerivation {
       docbook_xsl
       docbook_xml_dtd_42
       docbook_xml_dtd_45
-      (buildPackages.python3Packages.python.withPackages (ps: with ps; [ python3Packages.lxml ]))
-    ];
+      (buildPackages.python3Packages.python.withPackages (ps: with ps; [ lxml jinja2 ]))
+    ]
+    ++ lib.optional withLibBPF [
+      bpftools
+      llvmPackages.clang
+      llvmPackages.libllvm
+    ]
+  ;
 
   buildInputs =
     [
@@ -315,12 +353,15 @@ stdenv.mkDerivation {
     ++ lib.optional withResolved libgpgerror
     ++ lib.optional withSelinux libselinux
     ++ lib.optional withRemote libmicrohttpd
-    ++ lib.optionals withHomed [ p11-kit libfido2 ]
+    ++ lib.optionals withHomed [ p11-kit ]
+    ++ lib.optionals (withHomed || withCryptsetup) [ libfido2 ]
+    ++ lib.optionals withLibBPF [ libbpf ]
   ;
 
   #dontAddPrefix = true;
 
   mesonFlags = [
+    "-Dversion-tag=${version}"
     "-Ddbuspolicydir=${placeholder "out"}/share/dbus-1/system.d"
     "-Ddbussessionservicedir=${placeholder "out"}/share/dbus-1/services"
     "-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services"
@@ -368,14 +409,14 @@ stdenv.mkDerivation {
     "-Db_pie=true"
     "-Dinstall-sysconfdir=false"
     /*
-    As of now, systemd doesn't allow runtime configuration of these values. So
-    the settings in /etc/login.defs have no effect on it. Many people think this
-    should be supported however, see
-    - https://github.com/systemd/systemd/issues/3855
-    - https://github.com/systemd/systemd/issues/4850
-    - https://github.com/systemd/systemd/issues/9769
-    - https://github.com/systemd/systemd/issues/9843
-    - https://github.com/systemd/systemd/issues/10184
+      As of now, systemd doesn't allow runtime configuration of these values. So
+      the settings in /etc/login.defs have no effect on it. Many people think this
+      should be supported however, see
+      - https://github.com/systemd/systemd/issues/3855
+      - https://github.com/systemd/systemd/issues/4850
+      - https://github.com/systemd/systemd/issues/9769
+      - https://github.com/systemd/systemd/issues/9843
+      - https://github.com/systemd/systemd/issues/10184
     */
     "-Dsystem-uid-max=999"
     "-Dsystem-gid-max=999"
@@ -411,6 +452,8 @@ stdenv.mkDerivation {
     "-Dnss-mymachines=false"
     "-Dnss-resolve=false"
     "-Dnss-systemd=false"
+  ] ++ lib.optionals withLibBPF [
+    "-Dbpf-framework=true"
   ];
 
   preConfigure = ''
@@ -459,7 +502,8 @@ stdenv.mkDerivation {
         --replace '"tar"' '"${gnutar}/bin/tar"'
     done
 
-    substituteInPlace src/journal/catalog.c \
+
+    substituteInPlace src/libsystemd/sd-journal/catalog.c \
       --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
   '';
 
diff --git a/nixpkgs/pkgs/os-specific/linux/tbs/default.nix b/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
index d2b0bc08071e..f2a7b692baa3 100644
--- a/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
@@ -18,7 +18,8 @@ let
   };
 
 in stdenv.mkDerivation {
-  name = "tbs-2018.04.18-${kernel.version}";
+  pname = "tbs";
+  version = "2018.04.18-${kernel.version}";
 
   srcs = [ media build ];
   sourceRoot = build.name;
diff --git a/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix b/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix
index 549a607b1522..646e3702fed0 100644
--- a/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/tunctl/default.nix
@@ -1,9 +1,11 @@
 {lib, stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "tunctl-1.5";
+stdenv.mkDerivation rec {
+  pname = "tunctl";
+  version = "1.5";
+
   src = fetchurl {
-    url = "mirror://sourceforge/tunctl/tunctl-1.5.tar.gz";
+    url = "mirror://sourceforge/tunctl/tunctl-${version}.tar.gz";
     sha256 = "aa2a6c4cc6bfacb11e0d9f62334a6638a0d435475c61230116f00b6af8b14fff";
   };
 
diff --git a/nixpkgs/pkgs/os-specific/linux/usermount/default.nix b/nixpkgs/pkgs/os-specific/linux/usermount/default.nix
index d0c690a95274..87b38b9af6e4 100644
--- a/nixpkgs/pkgs/os-specific/linux/usermount/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/usermount/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchgit, pkg-config, dbus, libnotify, udisks2, gdk-pixbuf }:
 
 stdenv.mkDerivation {
-  name = "usermount-0.1";
+  pname = "usermount";
+  version = "0.1";
 
   src = fetchgit {
     url = "https://github.com/tom5760/usermount.git";
diff --git a/nixpkgs/pkgs/os-specific/linux/v86d/default.nix b/nixpkgs/pkgs/os-specific/linux/v86d/default.nix
index 36270cdfcc0e..254abb5838e8 100644
--- a/nixpkgs/pkgs/os-specific/linux/v86d/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/v86d/default.nix
@@ -1,14 +1,19 @@
-{ lib, stdenv, fetchurl
-, kernel, klibc
+{ lib
+, stdenv
+, fetchFromGitHub
+, kernel
+, klibc
 }:
 
 stdenv.mkDerivation rec {
   name = "v86d-${version}-${kernel.version}";
   version = "0.1.10";
 
-  src = fetchurl {
-    url = "https://github.com/mjanusz/v86d/archive/v86d-${version}.tar.gz";
-    sha256 = "1flnpp8rc945cxr6jr9dlm8mi8gr181zrp2say4269602s1a4ymg";
+  src = fetchFromGitHub {
+    owner = "mjanusz";
+    repo = "v86d";
+    rev = "v86d-${version}";
+    hash = "sha256-95LRzVbO/DyddmPwQNNQ290tasCGoQk7FDHlst6LkbA=";
   };
 
   patchPhase = ''
diff --git a/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix b/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix
index 7c93fa91854b..bba646e583b8 100644
--- a/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/xf86-video-nested/default.nix
@@ -3,7 +3,8 @@
 }:
 
 stdenv.mkDerivation {
-  name = "xf86-video-nested-2017-06-12";
+  pname = "xf86-video-nested";
+  version = "unstable-2017-06-12";
 
   src = fetchgit {
     url = "git://anongit.freedesktop.org/xorg/driver/xf86-video-nested";
diff --git a/nixpkgs/pkgs/os-specific/linux/zfs/default.nix b/nixpkgs/pkgs/os-specific/linux/zfs/default.nix
index bf45a5037616..c9f0438c86f5 100644
--- a/nixpkgs/pkgs/os-specific/linux/zfs/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/zfs/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub
+{ pkgs, lib, stdenv, fetchFromGitHub
 , autoreconfHook269, util-linux, nukeReferences, coreutils
 , perl, nixosTests
 , configFile ? "all"
@@ -16,7 +16,7 @@
 , enablePython ? true
 
 # for determining the latest compatible linuxPackages
-, linuxPackages_5_13
+, linuxPackages_5_14 ? pkgs.linuxKernel.packages.linux_5_14
 }:
 
 with lib;
@@ -196,6 +196,7 @@ let
         license = licenses.cddl;
         platforms = platforms.linux;
         maintainers = with maintainers; [ hmenke jcumming jonringer wizeman fpletz globin mic92 ];
+        mainProgram = "zfs";
         # If your Linux kernel version is not yet supported by zfs, try zfsUnstable.
         # On NixOS set the option boot.zfs.enableUnstable.
         broken = buildKernel && (kernelCompatible != null) && !kernelCompatible;
@@ -207,25 +208,28 @@ in {
   # to be adapted
   zfsStable = common {
     # check the release notes for compatible kernels
-    kernelCompatible = kernel.kernelAtLeast "3.10" && kernel.kernelOlder "5.14";
-    latestCompatibleLinuxPackages = linuxPackages_5_13;
+    kernelCompatible = kernel.kernelAtLeast "3.10" && kernel.kernelOlder "5.15";
+    latestCompatibleLinuxPackages = linuxPackages_5_14;
 
     # this package should point to the latest release.
-    version = "2.1.0";
+    version = "2.1.1";
 
-    sha256 = "sha256-YdY4SStXZGBBdAHdM3R/unco7ztxI3s0/buPSNSeh5o=";
+    sha256 = "sha256-UUuJa5w/GsEvsgH/BnXFsP/dsOt9wwmPqKzDxLPrhiY=";
   };
 
   zfsUnstable = common {
     # check the release notes for compatible kernels
     kernelCompatible = kernel.kernelAtLeast "3.10" && kernel.kernelOlder "5.15";
-    latestCompatibleLinuxPackages = linuxPackages_5_13;
+    latestCompatibleLinuxPackages = linuxPackages_5_14;
 
     # this package should point to a version / git revision compatible with the latest kernel release
-    version = "unstable-2021-08-30";
-    rev = "3b89d9518df2c7fd747e349873a3d4d498beb20e";
+    # IMPORTANT: Always use a tagged release candidate or commits from the
+    # zfs-<version>-staging branch, because this is tested by the OpenZFS
+    # maintainers.
+    version = "2.1.1";
+    # rev = "0000000000000000000000000000000000000000";
 
-    sha256 = "sha256-wVbjpVrPQmhJmMqdGUf0IwlCIoOsT7Zfj5lxSKcOsgg=";
+    sha256 = "sha256-UUuJa5w/GsEvsgH/BnXFsP/dsOt9wwmPqKzDxLPrhiY=";
 
     isUnstable = true;
   };