Files
dwl/package.nix
2026-03-31 01:08:20 +02:00

88 lines
2.1 KiB
Nix

{
lib,
src,
stdenv,
buildInputs,
nativeBuildInputs,
wayland,
testers,
nixosTests,
writeText,
enableXWayland ? false,
withCustomConfigH ? (configH != null),
configH ? "config.h",
patches,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "dwl";
version = "0.8-dev";
inherit
src
buildInputs
nativeBuildInputs
patches
;
outputs = [
"out"
"man"
];
postPatch =
let
configFile =
if lib.isDerivation configH || builtins.isPath configH then
configH
else
writeText "config.h" configH;
in
lib.optionalString withCustomConfigH "cp ${configFile} config.h";
makeFlags = [
"PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config"
"WAYLAND_SCANNER=wayland-scanner"
"PREFIX=$(out)"
"MANDIR=$(man)/share/man"
]
++ lib.optionals enableXWayland [
''XWAYLAND="-DXWAYLAND"''
''XLIBS="xcb xcb-icccm"''
];
strictDeps = true;
# required for whitespaces in makeFlags
__structuredAttrs = true;
passthru = {
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
# `dwl -v` emits its version string to stderr and returns 1
command = "dwl -v 2>&1; return 0";
};
basic = nixosTests.dwl;
};
};
meta = {
homepage = "https://codeberg.org/dwl/dwl";
changelog = "https://codeberg.org/dwl/dwl/src/branch/${finalAttrs.version}/CHANGELOG.md";
description = "Dynamic window manager for Wayland";
longDescription = ''
dwl is a compact, hackable compositor for Wayland based on wlroots. It is
intended to fill the same space in the Wayland world that dwm does in X11,
primarily in terms of philosophy, and secondarily in terms of
functionality. Like dwm, dwl is:
- Easy to understand, hack on, and extend with patches
- One C source file (or a very small number) configurable via config.h
- Tied to as few external dependencies as possible
'';
license = lib.licenses.gpl3Only;
maintainers = [ ];
inherit (wayland.meta) platforms;
mainProgram = "dwl";
};
})