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)
This commit is contained in:
Adam Joseph 2022-09-21 00:04:52 -07:00
parent 5b66b6b8c2
commit 42815b4a0c
41 changed files with 51 additions and 51 deletions

View File

@ -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

View File

@ -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

View File

@ -25,7 +25,7 @@
# optional server deps
, libmicrohttpd
, libsodium
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd ? null
# options

View File

@ -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 {

View File

@ -5,7 +5,7 @@
, pkg-config
, scdoc
, stdenv
, systemdSupport ? stdenv.isLinux, systemd
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
}:
stdenv.mkDerivation rec {

View File

@ -45,7 +45,7 @@
, ungoogled ? false, ungoogled-chromium
# Optional dependencies:
, libgcrypt ? null # cupsSupport
, systemdSupport ? stdenv.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
}:

View File

@ -17,7 +17,7 @@
, Security
, withKeyring ? true
, libsecret
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
}:

View File

@ -24,7 +24,7 @@
, enableQt ? false
, qt5
, nixosTests
, enableSystemd ? stdenv.isLinux
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, enableDaemon ? true
, enableCli ? true
, installLib ? false

View File

@ -8,7 +8,7 @@
, curl
, sqlite
, libnotify
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
}:

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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:

View File

@ -3,7 +3,7 @@
, fetchurl
, pkg-config
, expat
, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isStatic
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal
, systemdMinimal
, audit
, libapparmor

View File

@ -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).

View File

@ -24,7 +24,7 @@
, zlib
, icu
, systemd
, systemdSupport ? stdenv.hostPlatform.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
, nixosTests
}:

View File

@ -63,7 +63,7 @@
, addOpenGLRunpath
, enableGeoLocation ? true
, withLibsecret ? true
, systemdSupport ? stdenv.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
}:
stdenv.mkDerivation (finalAttrs: {

View File

@ -6,7 +6,7 @@
, systemd
, check
, subunit
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
}:
stdenv.mkDerivation rec {

View File

@ -9,7 +9,7 @@
, libtiff
, pam
, dbus
, enableSystemd ? stdenv.isLinux
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
, acl
, gmp

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -26,8 +26,7 @@
, python3
, rustPlatform
, openssl
, systemd
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
, zlib
, rsync
, withCockpit ? true

View File

@ -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
}:

View File

@ -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 {

View File

@ -10,7 +10,7 @@
, libuv
, libwebsockets
, openssl
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
, fetchpatch
}:

View File

@ -10,7 +10,7 @@
, systemd
, wafHook
, websocketpp
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, withWebSocket ? true
}:

View File

@ -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
}:

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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
}:

View File

@ -8,7 +8,7 @@
, pkg-config
, systemd
, hostname
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, extraTags ? [ ]
}:

View File

@ -2,7 +2,7 @@
, openssl
, ppp
, systemd
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, withPpp ? stdenv.isLinux
}:

View File

@ -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

View File

@ -22,7 +22,7 @@
, enableCommandNotFound ? false
, enableBashCompletion ? false
, bash-completion ? null
, enableSystemd ? stdenv.isLinux
, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
}:

View File

@ -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;

View File

@ -30,7 +30,7 @@
, xz
# Conditionally recommended
, systemdSupport ? stdenv.isLinux
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
# Recommended

View File

@ -10,7 +10,7 @@
, fastJson
, withKrb5 ? true
, libkrb5
, withSystemd ? stdenv.isLinux
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd
, withJemalloc ? true
, jemalloc

View File

@ -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