summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/awesome-extra.nix
blob: 6f19f8f72317ddeee7f196f3e520e7227134453d (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
{config, lib, pkgs, ... }:

with import <stockholm/lib>;
let
  cfg = config.makefu.awesome;
  out = {
    options.makefu.awesome = api;
    config = lib.mkIf cfg.enable imp;
  };
  api = {
    enable = mkEnableOption "awesome custom config";
    modkey = mkOption {
      type = types.str;
      description = "Modkey to be used";
      default = "Mod4";
    };
    baseConfig = mkOption {
      type = types.path;
      description = ''
        rc.lua file to be used as default
        This module will use substituteAll to replace strings before writing to
        /etc/xdg/awesome/rc.lua
      '';
      default = pkgs.awesomecfg.full.override {
        locker = "${pkgs.i3lock}/bin/i3lock -i /var/lib/wallpaper/wallpaper";
      };
    };
  };
  imp = {
    # TODO: configure display manager as well
    nixpkgs.config.packageOverrides = pkgs: rec {
      awesome = pkgs.stdenv.lib.overrideDerivation pkgs.awesome (oldAttrs : {
          postFixup = let
            rclua = cfg.baseConfig.override { inherit (cfg) modkey; };
          in "cp ${rclua}  $out/etc/xdg/awesome/rc.lua";
      });
    };
  };
in out