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

A `flake-parts` module to work with treefmt. No longer maintained; you should instead use https://github.com/numtide/treefmt-nix#flake-parts

License

Notifications You must be signed in to change notification settings

Platonic-Systems/treefmt-flake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

treefmt-flake

A flake-parts module to work with treefmt.

Status

This flake module would be be more useful after #1 - because, then the flakeModule will encapsulate more than just a check.

Usage

See this PR for a complete example.

  outputs = { self, flake-parts, nixpkgs, treefmt-flake, ... }:
    flake-parts.lib.mkFlake { inherit self; } {
      imports = [
        treefmt-flake.flakeModule
      ];
      perSystem = { lib, config, pkgs, system, ... }:
        {
          # Provided by treefmt-flake.flakeModule
          treefmt.formatters = {
            inherit (pkgs)
              nixpkgs-fmt;
            inherit (pkgs.nodePackages)
              purs-tidy;
          };

          devShells = {
            default = pkgs.mkShell {
              buildInputs = (with pkgs; [
                ...
              ] ++ config.treefmt.buildInputs);
            };
          };
        };
    };

This adds a .#checks.<system>.treefmt flake output that checks that the project tree is already autoformatted.

It also adds a .#apps.<system>.format output that can can be used to format your project using nix run .#format.

About

A `flake-parts` module to work with treefmt. No longer maintained; you should instead use https://github.com/numtide/treefmt-nix#flake-parts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages