diff --git a/pkgs/applications/window-managers/dwl/default.nix b/pkgs/applications/window-managers/dwl/default.nix deleted file mode 100644 index 65ea637d6de1..000000000000 --- a/pkgs/applications/window-managers/dwl/default.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ lib -, stdenv -, fetchFromGitea -, installShellFiles -, libX11 -, libinput -, libxcb -, libxkbcommon -, pixman -, pkg-config -, wayland-scanner -, wayland -, wayland-protocols -, wlroots -, writeText -, xcbutilwm -, xwayland -, enableXWayland ? true -, conf ? null -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "dwl"; - version = "0.5"; - - src = fetchFromGitea { - domain = "codeberg.org"; - owner = "dwl"; - repo = "dwl"; - rev = "v${finalAttrs.version}"; - hash = "sha256-U/vqGE1dJKgEGTfPMw02z5KJbZLWY1vwDJWnJxT8urM="; - }; - - nativeBuildInputs = [ - installShellFiles - pkg-config - wayland-scanner - ]; - - buildInputs = [ - libinput - libxcb - libxkbcommon - pixman - wayland - wayland-protocols - wlroots - ] ++ lib.optionals enableXWayland [ - libX11 - xcbutilwm - xwayland - ]; - - outputs = [ "out" "man" ]; - - # Allow users to set an alternative config.def.h - postPatch = let - configFile = if lib.isDerivation conf || builtins.isPath conf - then conf - else writeText "config.def.h" conf; - in lib.optionalString (conf != null) "cp ${configFile} config.def.h"; - - makeFlags = [ - "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" - "WAYLAND_SCANNER=wayland-scanner" - "PREFIX=$(out)" - "MANDIR=$(man)/share/man" - ]; - - preBuild = '' - makeFlagsArray+=( - XWAYLAND=${lib.optionalString enableXWayland "-DXWAYLAND"} - XLIBS=${lib.optionalString enableXWayland "xcb\\ xcb-icccm"} - ) - ''; - - meta = { - homepage = "https://github.com/djpohly/dwl/"; - 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 - - Limited to 2000 SLOC to promote hackability - - Tied to as few external dependencies as possible - ''; - changelog = "https://github.com/djpohly/dwl/releases/tag/v${finalAttrs.version}"; - license = lib.licenses.gpl3Only; - maintainers = [ lib.maintainers.AndersonTorres ]; - inherit (wayland.meta) platforms; - mainProgram = "dwl"; - }; -}) -# TODO: custom patches from upstream website diff --git a/pkgs/by-name/dw/dwl/package.nix b/pkgs/by-name/dw/dwl/package.nix new file mode 100644 index 000000000000..152d5000c22d --- /dev/null +++ b/pkgs/by-name/dw/dwl/package.nix @@ -0,0 +1,132 @@ +{ + lib, + fetchFromGitea, + installShellFiles, + libX11, + libinput, + libxcb, + libxkbcommon, + pixman, + pkg-config, + stdenv, + testers, + wayland, + wayland-protocols, + wayland-scanner, + wlroots, + writeText, + xcbutilwm, + xwayland, + # Boolean flags + enableXWayland ? true, + withCustomConfigH ? (configH != null), + # Configurable options + configH ? + if conf != null then + lib.warn '' + conf parameter is deprecated; + use configH instead + '' conf + else + null, + # Deprecated options + # Remove them before next version of either Nixpkgs or dwl itself + conf ? null, +}: + +# If we set withCustomConfigH, let's not forget configH +assert withCustomConfigH -> (configH != null); +stdenv.mkDerivation (finalAttrs: { + pname = "dwl"; + version = "0.6"; + + src = fetchFromGitea { + domain = "codeberg.org"; + owner = "dwl"; + repo = "dwl"; + rev = "v${finalAttrs.version}"; + hash = "sha256-fygUzEi4bgopesvHByfpatkLFYI98qozJOUBNM2t9Mg="; + }; + + nativeBuildInputs = [ + installShellFiles + pkg-config + wayland-scanner + ]; + + buildInputs = + [ + libinput + libxcb + libxkbcommon + pixman + wayland + wayland-protocols + wlroots + ] + ++ lib.optionals enableXWayland [ + libX11 + xcbutilwm + xwayland + ]; + + 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"; + }; + }; + + meta = { + homepage = "https://codeberg.org/dwl/dwl"; + 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 = [ lib.maintainers.AndersonTorres ]; + inherit (wayland.meta) platforms; + mainProgram = "dwl"; + }; +}) +# TODO: custom patches from upstream website diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bff116702190..8c325b819dde 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29941,7 +29941,7 @@ with pkgs; dyff = callPackage ../development/tools/dyff { }; - dwl = callPackage ../applications/window-managers/dwl { + dwl = callPackage ../by-name/dw/dwl/package.nix { wlroots = wlroots_0_17; };