diff options
Diffstat (limited to 'modules/overlays')
-rw-r--r-- | modules/overlays/default.nix | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/modules/overlays/default.nix b/modules/overlays/default.nix index 745673a..fa1ee01 100644 --- a/modules/overlays/default.nix +++ b/modules/overlays/default.nix @@ -1,17 +1,26 @@ -{ lib, config, ... }: +{ lib, config, pkgs, ... }: -let cfg = config.this.overlays; - overlay = ov: - lib.optional cfg."${ov}".enable - (import ./${ov}.nix); +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"; - this.overlays.g45_h264.enable = lib.mkEnableOption "intel-vaapi-driver with h264 support on gm45"; + 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 = - (overlay "emacs") ++ - (overlay "g45_h264"); + config = { + nixpkgs.overlays = + mapOverlays (ov: import ./${ov}.nix); + nix.nixPath = lib.mkAfter ["nixpkgs-overlays=${overlayDir}"]; + }; } |