2023-08-27 07:48:57 +02:00
|
|
|
# flakelight -- Framework for simplifying flake setup
|
2023-08-25 06:14:55 +02:00
|
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2023-11-23 05:55:01 +01:00
|
|
|
{ config, lib, ... }:
|
2023-08-25 06:14:55 +02:00
|
|
|
let
|
2023-11-23 05:55:01 +01:00
|
|
|
inherit (lib) mkEnableOption mkIf;
|
2023-08-25 06:14:55 +02:00
|
|
|
in
|
|
|
|
{
|
2023-08-27 07:48:57 +02:00
|
|
|
options.flakelight.builtinFormatters =
|
2023-11-24 01:40:06 +01:00
|
|
|
mkEnableOption "default formatters" //
|
|
|
|
{ default = config.formatter == null; };
|
2023-08-25 06:14:55 +02:00
|
|
|
|
2023-11-23 05:55:01 +01:00
|
|
|
config = mkIf config.flakelight.builtinFormatters {
|
2023-08-25 06:14:55 +02:00
|
|
|
devShell.packages = pkgs: [
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
pkgs.nodePackages.prettier
|
|
|
|
];
|
|
|
|
|
|
|
|
formatters = {
|
|
|
|
"*.nix" = "nixpkgs-fmt";
|
2023-09-17 05:59:54 +02:00
|
|
|
"*.md" = "prettier --write";
|
|
|
|
"*.json" = "prettier --write";
|
2023-12-06 03:59:31 +01:00
|
|
|
"*.yaml" = "prettier --write";
|
2023-09-17 05:59:54 +02:00
|
|
|
"*.yml" = "prettier --write";
|
2023-08-25 06:14:55 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|