mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-22 23:43:11 +01:00
cca0b23070
Setting the `formatter` option now allows for setting the formatter directly instead of using the provided formatting functionality with `formatters`.
28 lines
664 B
Nix
28 lines
664 B
Nix
# flakelight -- Framework for simplifying flake setup
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{ config, lib, ... }:
|
|
let
|
|
inherit (lib) mkEnableOption mkIf;
|
|
in
|
|
{
|
|
options.flakelight.builtinFormatters =
|
|
mkEnableOption "default formatters" //
|
|
{ default = config.formatter == null; };
|
|
|
|
config = mkIf config.flakelight.builtinFormatters {
|
|
devShell.packages = pkgs: [
|
|
pkgs.nixpkgs-fmt
|
|
pkgs.nodePackages.prettier
|
|
];
|
|
|
|
formatters = {
|
|
"*.nix" = "nixpkgs-fmt";
|
|
"*.md" = "prettier --write";
|
|
"*.json" = "prettier --write";
|
|
"*.yml" = "prettier --write";
|
|
};
|
|
};
|
|
}
|