summaryrefslogtreecommitdiff
path: root/modules/overlays/default.nix
blob: 46901654c39736e574ceed70a316b694eb9ffddd (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
{ lib, config, pkgs, ... }:

let
  cfg = config.this.overlays;

  mapOverlays = f:
    lib.mapAttrsToList (ov: _: f ov)
      (lib.filterAttrs
        (ov: c: c.enable)
        cfg);

  overlayDir = pkgs.linkFarm "nixpkgs-overlays"
    (mapOverlays (ov: { name = "${ov}.nix"; path = ./${ov}.nix; }));
in
{
  options.this.overlays = {
    emacs.enable = lib.mkEnableOption "custom-built Emacs overlay";
    g45_h264.enable = lib.mkEnableOption "intel-vaapi-driver with h264 support on gm45";
  };

  config = {
    nixpkgs.overlays =
      mapOverlays (ov: import ./${ov}.nix);
    nix.nixPath = lib.mkAfter ["nixpkgs-overlays=${overlayDir}"];
  };
}