at 17.09-beta 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 cfg = config.services.xserver.windowManager.awesome; 8 awesome = cfg.package; 9 inherit (pkgs.luaPackages) getLuaPath getLuaCPath; 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 export LUA_CPATH="${lib.concatStringsSep ";" (map getLuaCPath cfg.luaModules)}" 50 export LUA_PATH="${lib.concatStringsSep ";" (map getLuaPath cfg.luaModules)}" 51 52 ${awesome}/bin/awesome & 53 waitPID=$! 54 ''; 55 }; 56 57 environment.systemPackages = [ awesome ]; 58 59 }; 60}