Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Nixify treefmt.toml #1

Open
srid opened this issue Aug 17, 2022 · 1 comment
Open

Nixify treefmt.toml #1

srid opened this issue Aug 17, 2022 · 1 comment

Comments

@srid
Copy link
Member

srid commented Aug 17, 2022

We want to nixify treefmt.toml, and have it directly use the nix packages, in addition to having treefmt in nix shell run with the nixified configuration.

We can use numtide/treefmt#169 but the main blocker is the lack of PRJ_ROOT (see comments).

@srid
Copy link
Member Author

srid commented Aug 24, 2022

This is now possible using "github:srid/treefmt/withConfig-stable"

          treefmt.buildInputs = [
            (inputs'.treefmt.legacyPackages.default.withConfig {
              projectRootFile = "flake.nix";
              settings = {
                formatter = {
                  nix = {
                    command = lib.getExe pkgs.nixpkgs-fmt;
                    includes = [ "*.nix" ];
                  };
                  purescript = {
                    command = lib.getExe pkgs.nodePackages.purs-tidy;
                    options = [ "format-in-place" ];
                    # Note that given how purs-tidy is designed (takes glob, rather than explicit
                    # list of files), these patters inevitably slow down purs-tidy (thus treefmt)
                    # during the initial run.
                    includes = [
                      "src/**/*.purs"
                      "core/**/*.purs"
                      "lib/**/*.purs"
                      "src/**/*.purs"
                      "domain/**/*.purs"
                      "infrastructure/**/*.purs"
                      "ui-guide/**/*.purs"
                      "test/**/*.purs"
                    ];
                  };
                };
              };
            })
          ];

May as well retire this repo right away by moving it to upstream repo after numtide/treefmt#169 gets merged to master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant