From ec760fc6655b2032a38507e937b388e6db67cb03 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 25 May 2022 19:53:07 +0200 Subject: [PATCH] flake.overlay -> flake.overlays (Nix 2.8) --- ChangeLog.md | 2 ++ all-modules.nix | 2 +- modules/overlay.nix | 32 -------------------------------- modules/overlays.nix | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 33 deletions(-) delete mode 100644 modules/overlay.nix create mode 100644 modules/overlays.nix diff --git a/ChangeLog.md b/ChangeLog.md index 548f7cb..5fa26b3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -27,3 +27,5 @@ ``` - `flake-modules-core` is now called `flake-parts`. + + - `flake.overlay` has been removed in favor of `flake.overlays.default`. diff --git a/all-modules.nix b/all-modules.nix index e1e4cf9..ac8a931 100644 --- a/all-modules.nix +++ b/all-modules.nix @@ -10,7 +10,7 @@ ./modules/nixosConfigurations.nix ./modules/nixosModules.nix ./modules/nixpkgs.nix - ./modules/overlay.nix + ./modules/overlays.nix ./modules/packages.nix ./modules/perSystem.nix ]; diff --git a/modules/overlay.nix b/modules/overlay.nix deleted file mode 100644 index d132ac9..0000000 --- a/modules/overlay.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, flake-parts-lib, ... }: -let - inherit (lib) - mkOption - types - ; - inherit (flake-parts-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. - ''; - }; - }; - }; -} diff --git a/modules/overlays.nix b/modules/overlays.nix new file mode 100644 index 0000000..9363c82 --- /dev/null +++ b/modules/overlays.nix @@ -0,0 +1,37 @@ +{ config, lib, flake-parts-lib, ... }: +let + inherit (lib) + mkOption + types + ; + inherit (flake-parts-lib) + mkSubmoduleOptions + ; +in +{ + options = { + flake = mkSubmoduleOptions { + overlays = mkOption { + # uniq -> ordered: https://github.com/NixOS/nixpkgs/issues/147052 + # also update description when done + type = types.lazyAttrsOf (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 = lib.mapAttrs (k: f: final: prev: f final prev); + default = { }; + example = lib.literalExpression or lib.literalExample '' + { + default = final: prev: {}; + } + ''; + description = '' + An attribute set of overlays. + + Note that the overlays themselves are not mergeable. While overlays + can be composed, the order of composition is significant, but the + module system does not guarantee sufficiently deterministic + definition ordering, across versions and when changing imports. + ''; + }; + }; + }; +}