mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Add lower bound to lib version
This commit is contained in:
parent
80717d1161
commit
542e396949
2 changed files with 28 additions and 3 deletions
|
@ -6,7 +6,14 @@
|
|||
};
|
||||
|
||||
outputs = { nixpkgs-lib, ... }: {
|
||||
lib = import ./lib.nix { inherit (nixpkgs-lib) lib; };
|
||||
lib = import ./lib.nix {
|
||||
inherit (nixpkgs-lib) lib;
|
||||
# Extra info for version check message
|
||||
revInfo =
|
||||
if nixpkgs-lib?rev
|
||||
then " (nixpkgs-lib.rev: ${nixpkgs-lib.rev})"
|
||||
else "";
|
||||
};
|
||||
templates = {
|
||||
default = {
|
||||
path = ./template/default;
|
||||
|
|
22
lib.nix
22
lib.nix
|
@ -1,4 +1,8 @@
|
|||
{ lib }:
|
||||
{ lib
|
||||
# Optionally a string with extra version info to be included in the error message
|
||||
# in case is lib is out of date. Empty or starts with space.
|
||||
, revInfo ? ""
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
|
@ -207,5 +211,19 @@ let
|
|||
lib.setDefaultModuleLocation modulePath (import modulePath staticArgs);
|
||||
};
|
||||
|
||||
# A best effort, lenient estimate. Please use a recent nixpkgs lib if you
|
||||
# override it at all.
|
||||
minVersion = "22.05";
|
||||
|
||||
in
|
||||
flake-parts-lib
|
||||
|
||||
if builtins.compareVersions lib.version minVersion <= 0
|
||||
then
|
||||
abort ''
|
||||
The nixpkgs-lib dependency of flake-parts was overridden but is too old.
|
||||
The minimum supported version of nixpkgs-lib is ${minVersion},
|
||||
but the actual version is ${lib.version}${revInfo}.
|
||||
''
|
||||
else
|
||||
|
||||
flake-parts-lib
|
||||
|
|
Loading…
Reference in a new issue