Skip to content

Commit

Permalink
dwm: cleanup
Browse files Browse the repository at this point in the history
- nixpkgs-fmt
- use pname and version
- use multiline for prePatch to make tree-wide modifications easier
- remove global `with lib;`
- update homepage to dwm page
- copy description from git repo
- add longDescription
- remove unused config.dwm.patches
  • Loading branch information
06kellyjac committed Feb 9, 2021
1 parent f5d9069 commit 0e1bf2f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
50 changes: 31 additions & 19 deletions pkgs/applications/window-managers/dwm/default.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
{lib, stdenv, fetchurl, libX11, libXinerama, libXft, writeText, patches ? [], conf ? null}:
{ lib, stdenv, fetchurl, libX11, libXinerama, libXft, writeText, patches ? [ ], conf ? null}:

with lib;

let
name = "dwm-6.2";
in
stdenv.mkDerivation {
inherit name;
stdenv.mkDerivation rec {
pname = "dwm";
version = "6.2";

src = fetchurl {
url = "https://dl.suckless.org/dwm/${name}.tar.gz";
url = "https://dl.suckless.org/dwm/${pname}-${version}.tar.gz";
sha256 = "03hirnj8saxnsfqiszwl2ds7p0avg20izv9vdqyambks00p2x44p";
};

buildInputs = [ libX11 libXinerama libXft ];

prePatch = ''sed -i "s@/usr/local@$out@" config.mk'';
prePatch = ''
sed -i "s@/usr/local@$out@" config.mk
'';

# Allow users set their own list of patches
inherit patches;

# Allow users to set the config.def.h file containing the configuration
postPatch = let configFile = if isDerivation conf || builtins.isPath conf then conf else writeText "config.def.h" conf;
in optionalString (conf!=null) "cp ${configFile} config.def.h";

meta = {
homepage = "https://suckless.org/";
description = "Dynamic window manager for X";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [viric];
platforms = with lib.platforms; all;
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";

meta = with lib; {
homepage = "https://dwm.suckless.org/";
description = "An extremely fast, small, and dynamic window manager for X";
longDescription = ''
dwm is a dynamic window manager for X. It manages windows in tiled,
monocle and floating layouts. All of the layouts can be applied
dynamically, optimising the environment for the application in use and the
task performed.
Windows are grouped by tags. Each window can be tagged with one or
multiple tags. Selecting certain tags displays all windows with these
tags.
'';
license = licenses.mit;
maintainers = with maintainers; [ viric ];
platforms = platforms.all;
};
}
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21678,9 +21678,7 @@ in
inherit (gnome2) libgnomeui;
};

dwm = callPackage ../applications/window-managers/dwm {
patches = config.dwm.patches or [];
};
dwm = callPackage ../applications/window-managers/dwm { };

dwm-status = callPackage ../applications/window-managers/dwm/dwm-status.nix { };

Expand Down

0 comments on commit 0e1bf2f

Please sign in to comment.