port docs #31
17
default.nix
Normal file
17
default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
# This file provides backward compatibility to nix < 2.4 clients
|
||||
{system ? builtins.currentSystem}: let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
|
||||
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;
|
||||
|
||||
flake-compat = fetchTarball {
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
||||
sha256 = narHash;
|
||||
};
|
||||
|
||||
flake = import flake-compat {
|
||||
inherit system;
|
||||
src = ./.;
|
||||
};
|
||||
in
|
||||
flake.defaultNix
|
16
docs/faq.md
16
docs/faq.md
@ -2,19 +2,19 @@
|
||||
|
||||
## How does treefmt function?
|
||||
|
||||
`Treefmt` traverses all your project's folders, maps files to specific code formatters, and formats the code
|
||||
`Treefmt` traverses all your project's folders, maps files to specific code formatters, and formats the code
|
||||
accordingly. Other tools also traverse the filesystem, but not necessarily starting from the root of the project.
|
||||
|
||||
Contrary to other formatters, `treefmt` doesn't preview the changes before writing them to a file. If you want to view
|
||||
the changes, you can always check the diff in your version control (we assume that your project is checked into a
|
||||
version control system).
|
||||
Contrary to other formatters, `treefmt` doesn't preview the changes before writing them to a file. If you want to view
|
||||
the changes, you can always check the diff in your version control (we assume that your project is checked into a
|
||||
version control system).
|
||||
|
||||
You can also rely on version control if errors were introduced into your code as a result of disruptions in the
|
||||
You can also rely on version control if errors were introduced into your code as a result of disruptions in the
|
||||
formatter's work.
|
||||
|
||||
## How is the cache organized?
|
||||
|
||||
At the moment, the cache is a [BoltDB] database file in which file paths are mapped to `mtimes`.
|
||||
At the moment, the cache is a [BoltDB] database file in which file paths are mapped to `mtimes`.
|
||||
|
||||
The file is located in:
|
||||
|
||||
@ -22,7 +22,7 @@ The file is located in:
|
||||
~/.cache/treefmt/eval-cache/<hash-of-the-treefmt.toml-path>.db
|
||||
```
|
||||
|
||||
At the end of each run, the database is updated with the last formatting time entries. In this way, we can
|
||||
At the end of each run, the database is updated with the last formatting time entries. In this way, we can
|
||||
compare the last change time of the file to the last formatting time, and figure out which files need re-formatting.
|
||||
|
||||
[BoltDB]: https://github.com/etcd-io/bbolt
|
||||
[BoltDB]: https://github.com/etcd-io/bbolt
|
||||
|
16
flake.lock
16
flake.lock
@ -21,6 +21,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"locked": {
|
||||
"lastModified": 1688025799,
|
||||
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
@ -163,6 +178,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-root": "flake-root",
|
||||
"gomod2nix": "gomod2nix",
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-root.url = "github:srid/flake-root";
|
||||
treefmt-nix = {
|
||||
@ -19,8 +18,8 @@
|
||||
url = "github:nix-community/gomod2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-filter.url = "github:numtide/nix-filter";
|
||||
flake-compat.url = "github:nix-community/flake-compat";
|
||||
};
|
||||
|
||||
outputs = inputs @ {flake-parts, ...}:
|
||||
|
17
shell.nix
Normal file
17
shell.nix
Normal file
@ -0,0 +1,17 @@
|
||||
# This file provides backward compatibility to nix < 2.4 clients
|
||||
{system ? builtins.currentSystem}: let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
|
||||
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;
|
||||
|
||||
flake-compat = fetchTarball {
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
||||
sha256 = narHash;
|
||||
};
|
||||
|
||||
flake = import flake-compat {
|
||||
inherit system;
|
||||
src = ./.;
|
||||
};
|
||||
in
|
||||
flake.shellNix
|
Reference in New Issue
Block a user