mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 17:28:39 +02:00
lib/helpers: mkIfNonNull', ifNonNull' and ifNonNull (#230)
This commit is contained in:
parent
a16d862de4
commit
f0649334a4
1 changed files with 10 additions and 1 deletions
|
@ -83,7 +83,16 @@ with lib; rec {
|
|||
description = desc;
|
||||
};
|
||||
|
||||
mkIfNonNull = c: mkIf (!isNull c) c;
|
||||
mkIfNonNull' = x: y: (mkIf (!isNull x) y);
|
||||
|
||||
mkIfNonNull = x: (mkIfNonNull' x x);
|
||||
|
||||
ifNonNull' = x: y:
|
||||
if (isNull x)
|
||||
then null
|
||||
else y;
|
||||
|
||||
ifNonNull = x: ifNonNull' x x;
|
||||
|
||||
mkCompositeOption = desc: options:
|
||||
mkNullOrOption (types.submodule {inherit options;}) desc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue