about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-09-21 00:04:52 -0700
committerAdam Joseph <adam@westernsemico.com>2023-01-22 00:27:19 -0800
commit42815b4a0ca4b1a433ce58f7bf92fb5fa1aec064 (patch)
tree55ec264893a2073faff7462246f8df167b36f415 /pkgs
parent5b66b6b8c23bf2003b99fac9fee2c743eb3ac253 (diff)
treewide: systemdSupport: use lib.meta.availableOn
Many packages have some kind of flag indicating whether or not to build with
systemd support.  Most of these default to `stdenv.isLinux`, but systemd does
not build on (and is marked `broken` for) `isStatic`.  Only a few packages have
the needed `&& !isStatic` in the default value for their parameter.

This commit moves the logic for the default value of these flags into
`systemd.meta.{platforms,badPlatforms}` and evaluates those conditions using
`lib.meta.availableOn`.

This provides three benefits:

1. The default values are set correctly (i.e. including `&& isStatic`)

2. The default values are set consistently

3. The way is paved for any future non-Linux systemd platforms (FreeBSD is
   reported to have experimental systemd support)
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/musikcube/default.nix8
-rw-r--r--pkgs/applications/editors/emacs/generic.nix2
-rw-r--r--pkgs/applications/graphics/drawpile/default.nix2
-rw-r--r--pkgs/applications/misc/prusa-slicer/default.nix3
-rw-r--r--pkgs/applications/misc/seatd/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix2
-rw-r--r--pkgs/applications/networking/msmtp/default.nix2
-rw-r--r--pkgs/applications/networking/p2p/transmission/default.nix2
-rw-r--r--pkgs/applications/networking/sync/onedrive/default.nix2
-rw-r--r--pkgs/applications/virtualization/docker/default.nix2
-rw-r--r--pkgs/applications/window-managers/sway/default.nix3
-rw-r--r--pkgs/applications/window-managers/sway/idle.nix2
-rw-r--r--pkgs/development/interpreters/erlang/generic-builder.nix2
-rw-r--r--pkgs/development/interpreters/php/generic.nix2
-rw-r--r--pkgs/development/libraries/dbus/default.nix2
-rw-r--r--pkgs/development/libraries/polkit/default.nix2
-rw-r--r--pkgs/development/libraries/vte/default.nix2
-rw-r--r--pkgs/development/libraries/webkitgtk/default.nix2
-rw-r--r--pkgs/development/libraries/yder/default.nix2
-rw-r--r--pkgs/misc/cups/default.nix2
-rw-r--r--pkgs/misc/screensavers/xscreensaver/default.nix2
-rw-r--r--pkgs/os-specific/linux/procps-ng/default.nix2
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix2
-rw-r--r--pkgs/servers/ldap/389/default.nix3
-rw-r--r--pkgs/servers/matrix-synapse/default.nix3
-rw-r--r--pkgs/servers/mautrix-facebook/default.nix7
-rw-r--r--pkgs/servers/mqtt/mosquitto/default.nix2
-rw-r--r--pkgs/servers/nfd/default.nix2
-rw-r--r--pkgs/servers/nosql/redis/default.nix2
-rw-r--r--pkgs/servers/pulseaudio/default.nix2
-rw-r--r--pkgs/servers/uwsgi/default.nix2
-rw-r--r--pkgs/tools/misc/brltty/default.nix2
-rw-r--r--pkgs/tools/misc/tmux/default.nix2
-rw-r--r--pkgs/tools/networking/dd-agent/datadog-agent.nix2
-rw-r--r--pkgs/tools/networking/openfortivpn/default.nix2
-rw-r--r--pkgs/tools/networking/openvpn/default.nix2
-rw-r--r--pkgs/tools/package-management/packagekit/default.nix2
-rw-r--r--pkgs/tools/system/htop/default.nix3
-rw-r--r--pkgs/tools/system/hw-probe/default.nix2
-rw-r--r--pkgs/tools/system/rsyslog/default.nix2
-rw-r--r--pkgs/top-level/beam-packages.nix6
41 files changed, 51 insertions, 51 deletions
diff --git a/pkgs/applications/audio/musikcube/default.nix b/pkgs/applications/audio/musikcube/default.nix
index 38e96c7f098e5..7dd7670d67f79 100644
--- a/pkgs/applications/audio/musikcube/default.nix
+++ b/pkgs/applications/audio/musikcube/default.nix
@@ -1,4 +1,6 @@
-{ cmake
+{ lib
+, stdenv
+, cmake
 , pkg-config
 , boost
 , curl
@@ -12,13 +14,11 @@
 , libopenmpt
 , mpg123
 , ncurses
-, lib
-, stdenv
 , taglib
 # Linux Dependencies
 , alsa-lib
 , pulseaudio
-, systemdSupport ? stdenv.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 # Darwin Dependencies
 , Cocoa
diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix
index cd68f0dbf5f33..feed7ba5b41e1 100644
--- a/pkgs/applications/editors/emacs/generic.nix
+++ b/pkgs/applications/editors/emacs/generic.nix
@@ -44,7 +44,7 @@
   else if withMotif then "motif"
   else if withAthena then "athena"
   else "lucid")
-, withSystemd ? stdenv.isLinux, systemd
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 
 assert (libXft != null) -> libpng != null;      # probably a bug
diff --git a/pkgs/applications/graphics/drawpile/default.nix b/pkgs/applications/graphics/drawpile/default.nix
index 09d51db254bac..76409860ffa99 100644
--- a/pkgs/applications/graphics/drawpile/default.nix
+++ b/pkgs/applications/graphics/drawpile/default.nix
@@ -25,7 +25,7 @@
 # optional server deps
 , libmicrohttpd
 , libsodium
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd ? null
 
 # options
diff --git a/pkgs/applications/misc/prusa-slicer/default.nix b/pkgs/applications/misc/prusa-slicer/default.nix
index 14a0d4453a25c..c0a1e7e0217d2 100644
--- a/pkgs/applications/misc/prusa-slicer/default.nix
+++ b/pkgs/applications/misc/prusa-slicer/default.nix
@@ -26,12 +26,11 @@
 , openvdb
 , pcre
 , qhull
-, systemd
 , tbb
 , wxGTK31
 , xorg
 , fetchpatch
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 let
   wxGTK-prusa = wxGTK31.overrideAttrs (old: rec {
diff --git a/pkgs/applications/misc/seatd/default.nix b/pkgs/applications/misc/seatd/default.nix
index 8c10219903dbc..f9a7cc928e10c 100644
--- a/pkgs/applications/misc/seatd/default.nix
+++ b/pkgs/applications/misc/seatd/default.nix
@@ -5,7 +5,7 @@
 , pkg-config
 , scdoc
 , stdenv
-, systemdSupport ? stdenv.isLinux, systemd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 50cbc80e0c7e9..23b47c84555f2 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -45,7 +45,7 @@
 , ungoogled ? false, ungoogled-chromium
 # Optional dependencies:
 , libgcrypt ? null # cupsSupport
-, systemdSupport ? stdenv.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 }:
 
diff --git a/pkgs/applications/networking/msmtp/default.nix b/pkgs/applications/networking/msmtp/default.nix
index 904239960181c..479d0980919c5 100644
--- a/pkgs/applications/networking/msmtp/default.nix
+++ b/pkgs/applications/networking/msmtp/default.nix
@@ -17,7 +17,7 @@
 , Security
 , withKeyring ? true
 , libsecret
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 }:
 
diff --git a/pkgs/applications/networking/p2p/transmission/default.nix b/pkgs/applications/networking/p2p/transmission/default.nix
index f3a33c2194cb0..8d605877a62ea 100644
--- a/pkgs/applications/networking/p2p/transmission/default.nix
+++ b/pkgs/applications/networking/p2p/transmission/default.nix
@@ -24,7 +24,7 @@
 , enableQt ? false
 , qt5
 , nixosTests
-, enableSystemd ? stdenv.isLinux
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , enableDaemon ? true
 , enableCli ? true
 , installLib ? false
diff --git a/pkgs/applications/networking/sync/onedrive/default.nix b/pkgs/applications/networking/sync/onedrive/default.nix
index d928978d3cf8d..6c64b755be0aa 100644
--- a/pkgs/applications/networking/sync/onedrive/default.nix
+++ b/pkgs/applications/networking/sync/onedrive/default.nix
@@ -8,7 +8,7 @@
 , curl
 , sqlite
 , libnotify
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 }:
 
diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
index fff9200285aa4..5027a8fd5c911 100644
--- a/pkgs/applications/virtualization/docker/default.nix
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -15,7 +15,7 @@ rec {
       , iptables, e2fsprogs, xz, util-linux, xfsprogs, git
       , procps, rootlesskit, slirp4netns, fuse-overlayfs, nixosTests
       , clientOnly ? !stdenv.isLinux, symlinkJoin
-      , withSystemd ? stdenv.isLinux, systemd
+      , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
       , withBtrfs ? stdenv.isLinux, btrfs-progs
       , withLvm ? stdenv.isLinux, lvm2
       , withSeccomp ? stdenv.isLinux, libseccomp
diff --git a/pkgs/applications/window-managers/sway/default.nix b/pkgs/applications/window-managers/sway/default.nix
index e49edbd190930..6cfc55240222a 100644
--- a/pkgs/applications/window-managers/sway/default.nix
+++ b/pkgs/applications/window-managers/sway/default.nix
@@ -6,9 +6,8 @@
 , nixosTests
 # Used by the NixOS module:
 , isNixOS ? false
-
 , enableXWayland ? true, xorg
-, systemdSupport ? stdenv.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 , dbusSupport ? true
 , dbus
 , trayEnabled ? systemdSupport && dbusSupport
diff --git a/pkgs/applications/window-managers/sway/idle.nix b/pkgs/applications/window-managers/sway/idle.nix
index 6479760a743e8..b410919022f12 100644
--- a/pkgs/applications/window-managers/sway/idle.nix
+++ b/pkgs/applications/window-managers/sway/idle.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, fetchFromGitHub
 , meson, ninja, pkg-config, scdoc, wayland-scanner
 , wayland, wayland-protocols, runtimeShell
-, systemdSupport ? stdenv.isLinux, systemd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix
index bdfca31d7f7fa..59e2286f84ee5 100644
--- a/pkgs/development/interpreters/erlang/generic-builder.nix
+++ b/pkgs/development/interpreters/erlang/generic-builder.nix
@@ -21,7 +21,7 @@
 , parallelBuild ? false
 , systemd
 , wxSupport ? true
-, systemdSupport ? stdenv.isLinux # systemd support in epmd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd # systemd support in epmd
   # updateScript deps
 , writeScript
 , common-updater-scripts
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix
index 5a363822bcaec..b8ceac621a619 100644
--- a/pkgs/development/interpreters/php/generic.nix
+++ b/pkgs/development/interpreters/php/generic.nix
@@ -52,7 +52,7 @@ let
     , cgotoSupport ? false
     , embedSupport ? false
     , ipv6Support ? true
-    , systemdSupport ? stdenv.isLinux
+    , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
     , valgrindSupport ? !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind
     , ztsSupport ? apxs2Support
     }@args:
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 795c2c51ddfcb..20856f2ad9b86 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -3,7 +3,7 @@
 , fetchurl
 , pkg-config
 , expat
-, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal
 , systemdMinimal
 , audit
 , libapparmor
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index 3db9e21bc7596..5c67eb1b65db4 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -21,7 +21,7 @@
 , docbook_xml_dtd_412
 , gtk-doc
 , coreutils
-, useSystemd ? stdenv.isLinux
+, useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal
 , systemdMinimal
 , elogind
 # A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault).
diff --git a/pkgs/development/libraries/vte/default.nix b/pkgs/development/libraries/vte/default.nix
index f87557ac4623a..3a82bafa3e124 100644
--- a/pkgs/development/libraries/vte/default.nix
+++ b/pkgs/development/libraries/vte/default.nix
@@ -24,7 +24,7 @@
 , zlib
 , icu
 , systemd
-, systemdSupport ? stdenv.hostPlatform.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 , nixosTests
 }:
 
diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix
index cfff2e7f853dc..4e22df60f5336 100644
--- a/pkgs/development/libraries/webkitgtk/default.nix
+++ b/pkgs/development/libraries/webkitgtk/default.nix
@@ -63,7 +63,7 @@
 , addOpenGLRunpath
 , enableGeoLocation ? true
 , withLibsecret ? true
-, systemdSupport ? stdenv.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 }:
 
 stdenv.mkDerivation (finalAttrs: {
diff --git a/pkgs/development/libraries/yder/default.nix b/pkgs/development/libraries/yder/default.nix
index fb26e27bc3e87..43b181fc348f9 100644
--- a/pkgs/development/libraries/yder/default.nix
+++ b/pkgs/development/libraries/yder/default.nix
@@ -6,7 +6,7 @@
 , systemd
 , check
 , subunit
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix
index b707647377ca3..06fdb4d65e729 100644
--- a/pkgs/misc/cups/default.nix
+++ b/pkgs/misc/cups/default.nix
@@ -9,7 +9,7 @@
 , libtiff
 , pam
 , dbus
-, enableSystemd ? stdenv.isLinux
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 , acl
 , gmp
diff --git a/pkgs/misc/screensavers/xscreensaver/default.nix b/pkgs/misc/screensavers/xscreensaver/default.nix
index 72e283eaf11c8..d2a6dfcec9546 100644
--- a/pkgs/misc/screensavers/xscreensaver/default.nix
+++ b/pkgs/misc/screensavers/xscreensaver/default.nix
@@ -5,7 +5,7 @@
 , gtk2, gdk-pixbuf, gdk-pixbuf-xlib, libxml2, pam
 , systemd, coreutils
 , forceInstallAllHacks ? false
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/os-specific/linux/procps-ng/default.nix b/pkgs/os-specific/linux/procps-ng/default.nix
index c87c337e61c3b..67b839a1bd367 100644
--- a/pkgs/os-specific/linux/procps-ng/default.nix
+++ b/pkgs/os-specific/linux/procps-ng/default.nix
@@ -7,7 +7,7 @@
 
   # `ps` with systemd support is able to properly report different
   # attributes like unit name, so we want to have it on linux.
-, withSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 
   # procps is mostly Linux-only. Most commands require a running Linux
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index 8df231c961e22..eeecc655aef92 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -6,7 +6,7 @@
 , ncurses
 , pamSupport ? true
 , pam
-, systemdSupport ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 , nlsSupport ? true
 , translateManpages ? true
diff --git a/pkgs/servers/ldap/389/default.nix b/pkgs/servers/ldap/389/default.nix
index ad857703baf31..4478c594330d8 100644
--- a/pkgs/servers/ldap/389/default.nix
+++ b/pkgs/servers/ldap/389/default.nix
@@ -26,8 +26,7 @@
 , python3
 , rustPlatform
 , openssl
-, systemd
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 , zlib
 , rsync
 , withCockpit ? true
diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix
index 778444eda0783..18041897f2327 100644
--- a/pkgs/servers/matrix-synapse/default.nix
+++ b/pkgs/servers/matrix-synapse/default.nix
@@ -1,5 +1,6 @@
 { lib, stdenv, fetchFromGitHub, python3, openssl, rustPlatform
-, enableSystemd ? stdenv.isLinux, nixosTests
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
+, nixosTests
 , enableRedis ? true
 , callPackage
 }:
diff --git a/pkgs/servers/mautrix-facebook/default.nix b/pkgs/servers/mautrix-facebook/default.nix
index e8eb6a8b86b6a..fcef839a9ddf9 100644
--- a/pkgs/servers/mautrix-facebook/default.nix
+++ b/pkgs/servers/mautrix-facebook/default.nix
@@ -1,9 +1,10 @@
-{ enableSystemd ? stdenv.isLinux
+{ lib
+, stdenv
+, systemd
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , fetchFromGitHub
 , fetchpatch
-, lib
 , python3
-, stdenv
 }:
 
 python3.pkgs.buildPythonPackage rec {
diff --git a/pkgs/servers/mqtt/mosquitto/default.nix b/pkgs/servers/mqtt/mosquitto/default.nix
index 0c574e5997570..f241f48ac52e2 100644
--- a/pkgs/servers/mqtt/mosquitto/default.nix
+++ b/pkgs/servers/mqtt/mosquitto/default.nix
@@ -10,7 +10,7 @@
 , libuv
 , libwebsockets
 , openssl
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 , fetchpatch
 }:
diff --git a/pkgs/servers/nfd/default.nix b/pkgs/servers/nfd/default.nix
index 08309213aaafe..58c4dd42936e1 100644
--- a/pkgs/servers/nfd/default.nix
+++ b/pkgs/servers/nfd/default.nix
@@ -10,7 +10,7 @@
 , systemd
 , wafHook
 , websocketpp
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , withWebSocket ? true
 }:
 
diff --git a/pkgs/servers/nosql/redis/default.nix b/pkgs/servers/nosql/redis/default.nix
index 5ec8361e2d7b8..300a5dd206704 100644
--- a/pkgs/servers/nosql/redis/default.nix
+++ b/pkgs/servers/nosql/redis/default.nix
@@ -1,6 +1,6 @@
 { lib, stdenv, fetchurl, lua, pkg-config, nixosTests
 , tcl, which, ps, getconf
-, withSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic, systemd
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 # dependency ordering is broken at the moment when building with openssl
 , tlsSupport ? !stdenv.hostPlatform.isStatic, openssl
 }:
diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index 11c56b925412e..57977ebf40965 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -9,7 +9,7 @@
 
 , x11Support ? false
 
-, useSystemd ? stdenv.isLinux
+, useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 
 , # Whether to support the JACK sound system as a backend.
   jackaudioSupport ? false
diff --git a/pkgs/servers/uwsgi/default.nix b/pkgs/servers/uwsgi/default.nix
index 01fa28d5d41e5..0a9ff0bcc1a24 100644
--- a/pkgs/servers/uwsgi/default.nix
+++ b/pkgs/servers/uwsgi/default.nix
@@ -3,7 +3,7 @@
 # plugins: list of strings, eg. [ "python2" "python3" ]
 , plugins ? []
 , pam, withPAM ? stdenv.isLinux
-, systemd, withSystemd ? stdenv.isLinux
+, systemd, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , libcap, withCap ? stdenv.isLinux
 , python2, python3, ncurses
 , ruby, php
diff --git a/pkgs/tools/misc/brltty/default.nix b/pkgs/tools/misc/brltty/default.nix
index fef13a8937287..5838c24172f8e 100644
--- a/pkgs/tools/misc/brltty/default.nix
+++ b/pkgs/tools/misc/brltty/default.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, fetchurl, pkg-config, python3, bluez
 , tcl, acl, kmod, coreutils, shadow, util-linux, udev
 , alsaSupport ? stdenv.isLinux, alsa-lib
-, systemdSupport ? stdenv.isLinux, systemd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/tools/misc/tmux/default.nix b/pkgs/tools/misc/tmux/default.nix
index 9ffe21c8cf5e5..139cadc70642c 100644
--- a/pkgs/tools/misc/tmux/default.nix
+++ b/pkgs/tools/misc/tmux/default.nix
@@ -6,7 +6,7 @@
 , libevent
 , ncurses
 , pkg-config
-, withSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic, systemd
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 , withUtf8proc ? true, utf8proc # gets Unicode updates faster than glibc
 , withUtempter ? stdenv.isLinux && !stdenv.hostPlatform.isMusl, libutempter
 }:
diff --git a/pkgs/tools/networking/dd-agent/datadog-agent.nix b/pkgs/tools/networking/dd-agent/datadog-agent.nix
index a0b3f357950ef..b3552a28e531d 100644
--- a/pkgs/tools/networking/dd-agent/datadog-agent.nix
+++ b/pkgs/tools/networking/dd-agent/datadog-agent.nix
@@ -8,7 +8,7 @@
 , pkg-config
 , systemd
 , hostname
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , extraTags ? [ ]
 }:
 
diff --git a/pkgs/tools/networking/openfortivpn/default.nix b/pkgs/tools/networking/openfortivpn/default.nix
index 0426066995d95..87b7ae1970cb3 100644
--- a/pkgs/tools/networking/openfortivpn/default.nix
+++ b/pkgs/tools/networking/openfortivpn/default.nix
@@ -2,7 +2,7 @@
 , openssl
 , ppp
 , systemd
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , withPpp ? stdenv.isLinux
 }:
 
diff --git a/pkgs/tools/networking/openvpn/default.nix b/pkgs/tools/networking/openvpn/default.nix
index d13ea566910b3..65e20ca67774d 100644
--- a/pkgs/tools/networking/openvpn/default.nix
+++ b/pkgs/tools/networking/openvpn/default.nix
@@ -7,7 +7,7 @@
 , openssl
 , openssl_1_1
 , pam
-, useSystemd ? stdenv.isLinux
+, useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 , update-systemd-resolved
 , util-linux
diff --git a/pkgs/tools/package-management/packagekit/default.nix b/pkgs/tools/package-management/packagekit/default.nix
index 95fecd2085068..b51a51da84f5a 100644
--- a/pkgs/tools/package-management/packagekit/default.nix
+++ b/pkgs/tools/package-management/packagekit/default.nix
@@ -22,7 +22,7 @@
 , enableCommandNotFound ? false
 , enableBashCompletion ? false
 , bash-completion ? null
-, enableSystemd ? stdenv.isLinux
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 }:
 
diff --git a/pkgs/tools/system/htop/default.nix b/pkgs/tools/system/htop/default.nix
index e3dca89c46468..cb79607ebbf88 100644
--- a/pkgs/tools/system/htop/default.nix
+++ b/pkgs/tools/system/htop/default.nix
@@ -2,8 +2,7 @@
 , ncurses
 , IOKit
 , sensorsSupport ? stdenv.isLinux, lm_sensors
-, systemdSupport ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
-, systemd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 }:
 
 assert systemdSupport -> stdenv.isLinux;
diff --git a/pkgs/tools/system/hw-probe/default.nix b/pkgs/tools/system/hw-probe/default.nix
index d483bdad221b6..ee538f92668a0 100644
--- a/pkgs/tools/system/hw-probe/default.nix
+++ b/pkgs/tools/system/hw-probe/default.nix
@@ -30,7 +30,7 @@
 , xz
 
 # Conditionally recommended
-, systemdSupport ? stdenv.isLinux
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 
 # Recommended
diff --git a/pkgs/tools/system/rsyslog/default.nix b/pkgs/tools/system/rsyslog/default.nix
index 09be16b1c945d..859f66990c565 100644
--- a/pkgs/tools/system/rsyslog/default.nix
+++ b/pkgs/tools/system/rsyslog/default.nix
@@ -10,7 +10,7 @@
 , fastJson
 , withKrb5 ? true
 , libkrb5
-, withSystemd ? stdenv.isLinux
+, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
 , systemd
 , withJemalloc ? true
 , jemalloc
diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix
index 2d0fde6d079c2..c727db80db6ae 100644
--- a/pkgs/top-level/beam-packages.nix
+++ b/pkgs/top-level/beam-packages.nix
@@ -1,11 +1,13 @@
-{ beam
+{ lib
+, beam
 , callPackage
 , openssl_1_1
 , wxGTK32
 , buildPackages
 , stdenv
 , wxSupport ? true
-, systemdSupport ? stdenv.isLinux
+, systemd
+, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
 }:
 
 let