1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-15 17:50:53 +00:00

Merge pull request #23 from hercules-ci/overlays

flake.overlay -> flake.overlays (Nix 2.8)
This commit is contained in:
Robert Hensing 2022-05-25 22:21:11 +02:00 committed by GitHub
commit c7d1a3d101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 33 deletions

View file

@ -27,3 +27,5 @@
```
- `flake-modules-core` is now called `flake-parts`.
- `flake.overlay` has been removed in favor of `flake.overlays.default`.

View file

@ -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
];

View file

@ -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.
'';
};
};
};
}

37
modules/overlays.nix Normal file
View file

@ -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 <literal>imports</literal>.
'';
};
};
};
}