summaryrefslogtreecommitdiff
path: root/modules/overlays/default.nix
blob: 5b92c6d3b7f410ea221794378b5de02a9fdd7335 (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
{ 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";
    marsironpi.enable = lib.mkEnableOption "custom repository of packages" // { default = true; };
  };

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