1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.services.xserver.windowManager.awesome;
8 awesome = cfg.package;
9
10in
11
12{
13
14 ###### interface
15
16 options = {
17
18 services.xserver.windowManager.awesome = {
19
20 enable = mkEnableOption "Awesome window manager";
21
22 luaModules = mkOption {
23 default = [];
24 type = types.listOf types.package;
25 description = "List of lua packages available for being used in the Awesome configuration.";
26 example = literalExample "[ luaPackages.oocairo ]";
27 };
28
29 package = mkOption {
30 default = null;
31 type = types.nullOr types.package;
32 description = "Package to use for running the Awesome WM.";
33 apply = pkg: if pkg == null then pkgs.awesome else pkg;
34 };
35
36 };
37
38 };
39
40
41 ###### implementation
42
43 config = mkIf cfg.enable {
44
45 services.xserver.windowManager.session = singleton
46 { name = "awesome";
47 start =
48 ''
49 ${concatMapStrings (pkg: ''
50 export LUA_CPATH=$LUA_CPATH''${LUA_CPATH:+;}${pkg}/lib/lua/${awesome.lua.luaversion}/?.so
51 export LUA_PATH=$LUA_PATH''${LUA_PATH:+;}${pkg}/lib/lua/${awesome.lua.luaversion}/?.lua
52 '') cfg.luaModules}
53
54 ${awesome}/bin/awesome &
55 waitPID=$!
56 '';
57 };
58
59 environment.systemPackages = [ awesome ];
60
61 };
62
63}