From 77771f1d6d0f53afee937b8e017b46f0427de914 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 22 Nov 2021 22:44:28 +0100 Subject: [PATCH] Add overlay --- all-modules.nix | 1 + modules/overlay.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 modules/overlay.nix diff --git a/all-modules.nix b/all-modules.nix index c9049f6..f6e508c 100644 --- a/all-modules.nix +++ b/all-modules.nix @@ -7,6 +7,7 @@ ./modules/flake.nix ./modules/legacyPackages.nix ./modules/nixosModules.nix + ./modules/overlay.nix ./modules/packages.nix ./modules/perSystem.nix ]; diff --git a/modules/overlay.nix b/modules/overlay.nix new file mode 100644 index 0000000..88405ae --- /dev/null +++ b/modules/overlay.nix @@ -0,0 +1,32 @@ +{ config, lib, flake-modules-core-lib, ... }: +let + inherit (lib) + mkOption + types + ; + inherit (flake-modules-core-lib) + mkSubmoduleOptions + ; +in +{ + options = { + flake = mkSubmoduleOptions { + overlay = mkOption { + # uniq should be ordered: https://github.com/NixOS/nixpkgs/issues/147052 + # also update description when done + type = types.uniq (types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified))); + # This eta expansion exists for the sole purpose of making nix flake check happy. + apply = f: final: prev: f final prev; + default = _: _: { }; + defaultText = lib.literalExpression or lib.literalExample ''final: prev: {}''; + description = '' + An overlay. + + Note that this option's type is not mergeable. While overlays can be + composed, the order of composition is significant, but the module + system does not guarantee deterministic definition ordering. + ''; + }; + }; + }; +}