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

let
  cfg = config.this.overlays;

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

  inherit (builtins) filter;

  overlayDir = pkgs.linkFarm "nixpkgs-overlays"
    (filter
      (x: x.name != "marsironpi.nix")
      (mapOverlays (ov: { name = "${ov}.nix"; path = ./${ov}.nix; })));
in
{
  options.this.overlays = {
    emacs.enable = lib.mkEnableOption "custom-built Emacs overlay";
    mpv.enable = lib.mkEnableOption "MPV with custom scripts";
    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}"];
  };
}