Without the change build fails on -fno-common tollchains as:
$ nix build --impure --expr 'with import ~/nm {}; wmfs.override { stdenv = clang13Stdenv; }'
...
ld: src/log.o:(.bss+0x0): multiple definition of `W'; src/barwin.o:(.bss+0x0): first defined here
ld: src/wmfs.o:(.bss+0x0): multiple definition of `W'; src/barwin.o:(.bss+0x0): first defined here
ld: src/wmfs.o:(.bss+0x10): multiple definition of `event_handle'; src/client.o:(.bss+0x10): first defined here
Sway can be compiled with or without systemd(-logind) and dbus. This
commit exposes that support via the global systemdSupport and
dbusSupport arguments, which are understood by many other nixpkgs
expressions and can be set globally in ~/.config/nixpkgs/config.nix.
This commit also adds a third argument, trayEnabled, which allows to
disable sway's tray. The tray requires dbusSupport and
systemdSupport.
Reviewers of this commit asked for potential use cases. There are
many of them; a very non-exhaustive list includes:
* Use of nixpkgs on operating systems which systemd does not support,
such as MacOS/Darwin, FreeBSD, OpenBSD, or Alpine Linux.
* Use of nixpkgs on *-musl platforms, which systemd does not
officially support (out-of-tree patches to support musl exist for a
few systemd versions).
* Use of sway in situations where dbus is inappropriate, such as
sway's "kiosk mode".
* High-security environments, where the additional attack surface
exposed by dbus outweighs any features it may offer.
This is a very non-exhaustive list.
This commit exposes support for compilation without systemd,
controlled by the global systemdSupport argument. This argument is
understood by many other nixpkgs expressions and can be set globally
in ~/.config/nixpkgs/config.nix.