configs.nix 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. This file holds configuration data for repo dotfiles.
  3. Q: Why not just put the put the file there?
  4. A:
  5. (1) dotfile proliferation
  6. (2) have all the things in one place / format
  7. (3) potentially share / re-use configuration data - keeping it in sync
  8. */
  9. { inputs, cell }:
  10. let
  11. inherit (inputs.std.data) configs;
  12. inherit (inputs.std.lib.dev) mkNixago;
  13. inherit (inputs.nixpkgs) lib;
  14. inherit (inputs) nixpkgs;
  15. in
  16. {
  17. # Tool Homepage: https://editorconfig.org/
  18. editorconfig = (mkNixago configs.editorconfig) {
  19. # see defaults at https://github.com/divnix/std/blob/main/src/data/configs/editorconfig.nix
  20. data = { };
  21. };
  22. # Tool Homepage: https://numtide.github.io/treefmt/
  23. treefmt = (mkNixago configs.treefmt) {
  24. # see defaults at https://github.com/divnix/std/blob/main/src/data/configs/treefmt.nix
  25. data = {
  26. formatter = {
  27. nix = {
  28. command = lib.getExe nixpkgs.nixfmt-rfc-style;
  29. };
  30. stylua = {
  31. command = lib.getExe nixpkgs.stylua;
  32. includes = [ "*.lua" ];
  33. options = [
  34. "--indent-type"
  35. "Spaces"
  36. "--indent-width"
  37. "2"
  38. "--quote-style"
  39. "ForceDouble"
  40. ];
  41. };
  42. };
  43. };
  44. };
  45. # Tool Homepage: https://github.com/evilmartians/lefthook
  46. lefthook = (mkNixago configs.lefthook) {
  47. # see defaults at https://github.com/divnix/std/blob/main/src/data/configs/lefthook.nix
  48. data = lib.mkForce {
  49. pre-commit = {
  50. parallel = true;
  51. commands = {
  52. treefmt = {
  53. run = "${lib.getExe nixpkgs.treefmt} --fail-on-change {staged_files}";
  54. skip = [
  55. "merge"
  56. "rebase"
  57. ];
  58. };
  59. };
  60. };
  61. };
  62. };
  63. }