Skip to content

Commit

Permalink
gitsigns: use nullable options (nix-community#148)
Browse files Browse the repository at this point in the history
* helpers: Correctly print bool values as true/false

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

* gitsigns: Refactor to use nullable options
  • Loading branch information
traxys authored Jan 24, 2023
1 parent 66b1b09 commit b9a5c9c
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 171 deletions.
4 changes: 3 additions & 1 deletion lib/helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit b9a5c9c

Please sign in to comment.