systemd: use lib.meson* functions

This commit is contained in:
Anderson Torres 2023-11-24 07:29:08 -03:00
parent 396b66da33
commit 1129756b1a

View File

@ -449,73 +449,74 @@ stdenv.mkDerivation (finalAttrs: {
mesonBuildType = "release"; mesonBuildType = "release";
mesonFlags = [ mesonFlags = [
"-Dversion-tag=${version}" (lib.mesonOption "version-tag" version)
# We bump this variable on every (major) version change to ensure # We bump this variable on every (major) version change to ensure
# that we have known-good value for a timestamp that is in the (not so distant) past. # that we have known-good value for a timestamp that is in the (not so distant) past.
# This serves as a lower bound for valid system timestamps during startup. Systemd will # This serves as a lower bound for valid system timestamps during startup. Systemd will
# reset the system timestamp if this date is +- 15 years from the system time. # reset the system timestamp if this date is +- 15 years from the system time.
# See the systemd v250 release notes for further details: # See the systemd v250 release notes for further details:
# https://github.com/systemd/systemd/blob/60e930fc3e6eb8a36fbc184773119eb8d2f30364/NEWS#L258-L266 # https://github.com/systemd/systemd/blob/60e930fc3e6eb8a36fbc184773119eb8d2f30364/NEWS#L258-L266
"-Dtime-epoch=${releaseTimestamp}" (lib.mesonOption "time-epoch" releaseTimestamp)
"-Dmode=release" (lib.mesonOption "mode" "release")
"-Ddbuspolicydir=${placeholder "out"}/share/dbus-1/system.d" (lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
"-Ddbussessionservicedir=${placeholder "out"}/share/dbus-1/services" (lib.mesonOption "dbussessionservicedir" "${placeholder "out"}/share/dbus-1/services")
"-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services" (lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
"-Dpam=${lib.boolToString withPam}"
"-Dpamconfdir=${placeholder "out"}/etc/pam.d" (lib.mesonBool "pam" withPam)
"-Drootprefix=${placeholder "out"}" (lib.mesonOption "pamconfdir" "${placeholder "out"}/etc/pam.d")
"-Dpkgconfiglibdir=${placeholder "dev"}/lib/pkgconfig" (lib.mesonOption "rootprefix" "${placeholder "out"}")
"-Dpkgconfigdatadir=${placeholder "dev"}/share/pkgconfig" (lib.mesonOption "pkgconfiglibdir" "${placeholder "dev"}/lib/pkgconfig")
"-Dloadkeys-path=${kbd}/bin/loadkeys" (lib.mesonOption "pkgconfigdatadir" "${placeholder "dev"}/share/pkgconfig")
"-Dsetfont-path=${kbd}/bin/setfont" (lib.mesonOption "loadkeys-path" "${kbd}/bin/loadkeys")
"-Dtty-gid=3" # tty in NixOS has gid 3 (lib.mesonOption "setfont-path" "${kbd}/bin/setfont")
"-Ddebug-shell=${bashInteractive}/bin/bash" (lib.mesonOption "tty-gid" "3") # tty in NixOS has gid 3
"-Dglib=${lib.boolToString withTests}" (lib.mesonOption "debug-shell" "${bashInteractive}/bin/bash")
(lib.mesonBool "glib" withTests)
# while we do not run tests we should also not build them. Removes about 600 targets # while we do not run tests we should also not build them. Removes about 600 targets
"-Dtests=false" (lib.mesonBool "tests" false)
"-Dacl=${lib.boolToString withAcl}" (lib.mesonBool "acl" withAcl)
"-Danalyze=${lib.boolToString withAnalyze}" (lib.mesonBool "analyze" withAnalyze)
"-Daudit=${lib.boolToString withAudit}" (lib.mesonBool "audit" withAudit)
"-Dgcrypt=${lib.boolToString wantGcrypt}" (lib.mesonBool "gcrypt" wantGcrypt)
"-Dimportd=${lib.boolToString withImportd}" (lib.mesonBool "importd" withImportd)
"-Dlz4=${lib.boolToString withCompression}" (lib.mesonBool "lz4" withCompression)
"-Dhomed=${lib.boolToString withHomed}" (lib.mesonBool "homed" withHomed)
"-Dlogind=${lib.boolToString withLogind}" (lib.mesonBool "logind" withLogind)
"-Dlocaled=${lib.boolToString withLocaled}" (lib.mesonBool "localed" withLocaled)
"-Dhostnamed=${lib.boolToString withHostnamed}" (lib.mesonBool "hostnamed" withHostnamed)
"-Dmachined=${lib.boolToString withMachined}" (lib.mesonBool "machined" withMachined)
"-Dnetworkd=${lib.boolToString withNetworkd}" (lib.mesonBool "networkd" withNetworkd)
"-Doomd=${lib.boolToString withOomd}" (lib.mesonBool "oomd" withOomd)
"-Dpolkit=${lib.boolToString withPolkit}" (lib.mesonBool "polkit" withPolkit)
"-Dlibcryptsetup=${lib.boolToString withCryptsetup}" (lib.mesonBool "libcryptsetup" withCryptsetup)
"-Dportabled=${lib.boolToString withPortabled}" (lib.mesonBool "portabled" withPortabled)
"-Dhwdb=${lib.boolToString withHwdb}" (lib.mesonBool "hwdb" withHwdb)
"-Dremote=${lib.boolToString withRemote}" (lib.mesonBool "remote" withRemote)
"-Dtimedated=${lib.boolToString withTimedated}" (lib.mesonBool "timedated" withTimedated)
"-Dtimesyncd=${lib.boolToString withTimesyncd}" (lib.mesonBool "timesyncd" withTimesyncd)
"-Duserdb=${lib.boolToString withUserDb}" (lib.mesonBool "userdb" withUserDb)
"-Dcoredump=${lib.boolToString withCoredump}" (lib.mesonBool "coredump" withCoredump)
"-Dfirstboot=false" (lib.mesonBool "firstboot" false)
"-Dresolve=${lib.boolToString withResolved}" (lib.mesonBool "resolve" withResolved)
"-Dsplit-usr=false" (lib.mesonBool "split-usr" false)
"-Dlibcurl=${lib.boolToString wantCurl}" (lib.mesonBool "libcurl" wantCurl)
"-Dlibidn=false" (lib.mesonBool "libidn" false)
"-Dlibidn2=${lib.boolToString withLibidn2}" (lib.mesonBool "libidn2" withLibidn2)
"-Dfirstboot=${lib.boolToString withFirstboot}" (lib.mesonBool "firstboot" withFirstboot)
"-Dsysusers=${lib.boolToString withSysusers}" (lib.mesonBool "sysusers" withSysusers)
"-Drepart=${lib.boolToString withRepart}" (lib.mesonBool "repart" withRepart)
"-Dsysupdate=${lib.boolToString withSysupdate}" (lib.mesonBool "sysupdate" withSysupdate)
"-Dquotacheck=false" (lib.mesonBool "quotacheck" false)
"-Dldconfig=false" (lib.mesonBool "ldconfig" false)
"-Dsmack=true" (lib.mesonBool "smack" true)
"-Db_pie=true" (lib.mesonBool "b_pie" true)
"-Dinstall-sysconfdir=false" (lib.mesonBool "install-sysconfdir" false)
"-Dsbat-distro=nixos" (lib.mesonOption "sbat-distro" "nixos")
"-Dsbat-distro-summary=NixOS" (lib.mesonOption "sbat-distro-summary" "NixOS")
"-Dsbat-distro-url=https://nixos.org/" (lib.mesonOption "sbat-distro-url" "https://nixos.org/")
"-Dsbat-distro-pkgname=${pname}" (lib.mesonOption "sbat-distro-pkgname" "${pname}")
"-Dsbat-distro-version=${version}" (lib.mesonOption "sbat-distro-version" "${version}")
/* /*
As of now, systemd doesn't allow runtime configuration of these values. So 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 the settings in /etc/login.defs have no effect on it. Many people think this
@ -526,49 +527,50 @@ stdenv.mkDerivation (finalAttrs: {
- https://github.com/systemd/systemd/issues/9843 - https://github.com/systemd/systemd/issues/9843
- https://github.com/systemd/systemd/issues/10184 - https://github.com/systemd/systemd/issues/10184
*/ */
"-Dsystem-uid-max=999" (lib.mesonOption "system-uid-max" "999")
"-Dsystem-gid-max=999" (lib.mesonOption "system-gid-max" "999")
"-Dsysvinit-path=" (lib.mesonOption "sysvinit-path" "")
"-Dsysvrcnd-path=" (lib.mesonOption "sysvrcnd-path" "")
"-Dsulogin-path=${util-linux.login}/bin/sulogin" (lib.mesonOption "sulogin-path" "${util-linux.login}/bin/sulogin")
"-Dnologin-path=${util-linux.login}/bin/nologin" (lib.mesonOption "nologin-path" "${util-linux.login}/bin/nologin")
"-Dmount-path=${lib.getOutput "mount" util-linux}/bin/mount" (lib.mesonOption "mount-path" "${lib.getOutput "mount" util-linux}/bin/mount")
"-Dumount-path=${lib.getOutput "mount" util-linux}/bin/umount" (lib.mesonOption "umount-path" "${lib.getOutput "mount" util-linux}/bin/umount")
"-Dcreate-log-dirs=false" (lib.mesonBool "create-log-dirs" false)
# Use cgroupsv2. This is already the upstream default, but better be explicit. # Use cgroupsv2. This is already the upstream default, but better be explicit.
"-Ddefault-hierarchy=unified" (lib.mesonOption "default-hierarchy" "unified")
# Upstream defaulted to disable manpages since they optimize for the much # Upstream defaulted to disable manpages since they optimize for the much
# more frequent development builds # more frequent development builds
"-Dman=true" (lib.mesonBool "man" true)
"-Defi=${lib.boolToString withEfi}" (lib.mesonBool "efi" withEfi)
"-Dbootloader=${lib.boolToString withBootloader}" (lib.mesonBool "bootloader" withBootloader)
"-Dukify=${lib.boolToString withUkify}" (lib.mesonBool "ukify" withUkify)
] ++ lib.optionals (withShellCompletions == false) [ ] ++ lib.optionals (withShellCompletions == false) [
"-Dbashcompletiondir=no" (lib.mesonOption "bashcompletiondir" "no")
"-Dzshcompletiondir=no" (lib.mesonOption "zshcompletiondir" "no")
] ++ lib.optionals (!withNss) [ ] ++ lib.optionals (!withNss) [
"-Dnss-myhostname=false" (lib.mesonBool "nss-myhostname" false)
"-Dnss-mymachines=false" (lib.mesonBool "nss-mymachines" false)
"-Dnss-resolve=false" (lib.mesonBool "nss-resolve" false)
"-Dnss-systemd=false" (lib.mesonBool "nss-systemd" false)
] ++ lib.optionals withLibBPF [ ] ++ lib.optionals withLibBPF [
"-Dbpf-framework=true" (lib.mesonBool "bpf-framework" true)
] ++ lib.optionals withTpm2Tss [ ] ++ lib.optionals withTpm2Tss [
"-Dtpm2=true" (lib.mesonBool "tpm2" true)
] ++ lib.optionals (!withUtmp) [ ] ++ lib.optionals (!withUtmp) [
"-Dutmp=false" (lib.mesonBool "utmp" false)
] ++ lib.optionals stdenv.hostPlatform.isMusl [ ] ++ lib.optionals stdenv.hostPlatform.isMusl [
"-Dgshadow=false" (lib.mesonBool "gshadow" false)
"-Didn=false" (lib.mesonBool "idn" false)
] ++ lib.optionals withKmod [ ] ++ lib.optionals withKmod [
"-Dkmod=true" (lib.mesonBool "kmod" true)
"-Dkmod-path=${kmod}/bin/kmod" (lib.mesonOption "kmod-path" "${kmod}/bin/kmod")
]; ];
preConfigure = preConfigure =
let let
# A list of all the runtime binaries that the systemd executables, tests and libraries are referencing in their source code, scripts and unit files. # A list of all the runtime binaries that the systemd executables, tests and libraries are referencing in their source code, scripts and unit files.