aboutsummaryrefslogtreecommitdiff
path: root/.config/nixpkgs/packages/awesome/package.nix
blob: 6bf06eef36981aa328d3999062329beb709d175b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{ lib, stdenv, fetchgit, lua, cairo, librsvg, cmake, imagemagick, pkg-config
, gdk-pixbuf, xorg, libstartup_notification, libxdg_basedir, libpthreadstubs
, xcb-util-cursor, makeWrapper, pango, gobject-introspection, which, dbus
, nettools, git, doxygen, xmlto, docbook_xml_dtd_45, docbook_xsl
, findXMLCatalogs, libxkbcommon, xcbutilxrm, hicolor-icon-theme, asciidoctor
, gtk3, makeFontsConf, ghostscript }:

let luaEnv = lua.withPackages (ps: [ ps.lgi ps.ldoc ]);

in stdenv.mkDerivation rec {
  pname = "awesome";
  version = "d2dc428e567e378a3f534c4d748543413fc30172";

  src = fetchgit {
    rev = version;
    url = "https://github.com/awesomeWM/awesome.git";
    sha256 = "sha256-gViEIuDn9ygzVof8e5e7cqDVPNeKDzlXK8V8oYzUUgA=";
  };

  nativeBuildInputs = [
    asciidoctor
    cmake
    docbook_xml_dtd_45
    docbook_xsl
    doxygen
    findXMLCatalogs
    imagemagick
    makeWrapper
    pkg-config
    xmlto
  ];

  outputs = [ "out" "doc" ];

  FONTCONFIG_FILE = makeFontsConf {
    fontDirectories = [ "${ghostscript}/share/ghostscript/fonts" ];
  };

  propagatedUserEnvPkgs = [ hicolor-icon-theme ];

  buildInputs = [
    cairo
    dbus
    gdk-pixbuf
    git
    gobject-introspection
    gtk3
    libpthreadstubs
    librsvg
    libstartup_notification
    libxdg_basedir
    libxkbcommon
    lua
    luaEnv
    nettools
    pango
    xcb-util-cursor
    xcbutilxrm
    xorg.libXau
    xorg.libXdmcp
    xorg.libxcb
    xorg.libxshmfence
    xorg.xcbutil
    xorg.xcbutilimage
    xorg.xcbutilkeysyms
    xorg.xcbutilrenderutil
    xorg.xcbutilwm
  ];

  cmakeFlags = [ "-DOVERRIDE_VERSION=${version}" ]
    ++ lib.optional lua.pkgs.isLuaJIT
    "-DLUA_LIBRARY=${lua}/lib/libluajit-5.1.so";

  GI_TYPELIB_PATH = "${pango.out}/lib/girepository-1.0";
  LUA_CPATH = "${luaEnv}/lib/lua/${lua.luaversion}/?.so";
  LUA_PATH = "${luaEnv}/share/lua/${lua.luaversion}/?.lua;;";

  postInstall = ''
    mv "$out/bin/awesome" "$out/bin/.awesome-wrapped"
    makeWrapper "$out/bin/.awesome-wrapped" "$out/bin/awesome" \
      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
      --add-flags '--search ${luaEnv}/lib/lua/${lua.luaversion}' \
      --add-flags '--search ${luaEnv}/share/lua/${lua.luaversion}' \
      --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH"

    wrapProgram $out/bin/awesome-client \
      --prefix PATH : "${which}/bin"
  '';

  passthru = { inherit lua; };

  meta = with lib; {
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
    homepage = "https://awesomewm.org/";
    description = "Highly configurable, dynamic window manager for X";
  };
}