gitsigns: use nullable options (#148)

* helpers: Correctly print bool values as true/false

* helpers: Add helpers to make nullable enums with default values

* gitsigns: Refactor to use nullable options
This commit is contained in:
traxys 2023-01-25 00:55:51 +01:00 committed by GitHub
parent 66b1b099cf
commit b9a5c9c2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 133 additions and 171 deletions

View file

@ -86,8 +86,10 @@ rec {
);
mkInt = default: mkNullable lib.types.int (toString default);
mkBool = default: mkNullable lib.types.bool (toString default);
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
mkStr = default: mkNullable lib.types.str ''"${default}"'';
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
mkEnumFirstDefault = enum: mkEnum enum (head enum);
};
mkPlugin = { config, lib, ... }: { name