Add treefmt
This commit is contained in:
parent
3a6699a656
commit
3785955a2c
4 changed files with 72 additions and 10 deletions
|
@ -1,18 +1,21 @@
|
|||
[[language]]
|
||||
auto-format = true
|
||||
name = "nix"
|
||||
formatter = { command = "nixfmt" }
|
||||
formatter = { command = "treefmt", args = ["--stdin", "$FILE"] }
|
||||
auto-format = true
|
||||
|
||||
[[language]]
|
||||
name = "toml"
|
||||
formatter = { command = "taplo", args = ["format", "-"] }
|
||||
formatter = { command = "treefmt", args = ["--stdin"] }
|
||||
auto-format = true
|
||||
|
||||
[[language]]
|
||||
name = "yaml"
|
||||
formatter = { command = 'prettier', args = ["--parser", "yaml"] }
|
||||
formatter = { command = "treefmt", args = ["--stdin"] }
|
||||
# formatter = { command = 'prettier', args = ["--parser", "yaml"] }
|
||||
auto-format = true
|
||||
|
||||
[[language]]
|
||||
name = "markdown"
|
||||
formatter = { command = 'prettier', args = ["--parser", "markdown"] }
|
||||
formatter = { command = "treefmt", args = ["--stdin"] }
|
||||
# formatter = { command = 'prettier', args = ["--parser", "markdown"] }
|
||||
auto-format = true
|
||||
|
|
37
flake.lock
generated
37
flake.lock
generated
|
@ -178,6 +178,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1747958103,
|
||||
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
|
@ -205,7 +221,8 @@
|
|||
"nixgl": "nixgl",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nur": "nur",
|
||||
"sops-nix": "sops-nix"
|
||||
"sops-nix": "sops-nix",
|
||||
"treefmt-nix": "treefmt-nix_2"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
|
@ -263,6 +280,24 @@
|
|||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750931469,
|
||||
"narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
16
flake.nix
16
flake.nix
|
@ -1,3 +1,4 @@
|
|||
# TODO: Add flake-utils, flake-parts, git-pre-hook
|
||||
{
|
||||
description = "My Home Manager configuration";
|
||||
inputs = {
|
||||
|
@ -19,16 +20,19 @@
|
|||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nur,
|
||||
nixgl,
|
||||
lix-module,
|
||||
sops-nix,
|
||||
treefmt-nix,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
@ -40,14 +44,13 @@
|
|||
nixgl.overlays.default
|
||||
];
|
||||
};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
in
|
||||
{
|
||||
homeConfigurations = {
|
||||
sudoer777 = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit nixgl;
|
||||
};
|
||||
extraSpecialArgs = { inherit nixgl; };
|
||||
modules = [
|
||||
./home.nix
|
||||
lix-module.nixosModules.default
|
||||
|
@ -68,14 +71,19 @@
|
|||
pkgs.just
|
||||
pkgs.forgejo-cli
|
||||
pkgs.nil
|
||||
pkgs.nixfmt-rfc-style
|
||||
# pkgs.nixfmt-rfc-style
|
||||
pkgs.taplo
|
||||
pkgs.marksman
|
||||
pkgs.helix
|
||||
pkgs.uutils-coreutils
|
||||
pkgs.prettier
|
||||
pkgs.yaml-language-server
|
||||
treefmtEval.config.build.wrapper
|
||||
];
|
||||
};
|
||||
formatter.${system} = treefmtEval.config.build.wrapper;
|
||||
checks.${system} = {
|
||||
formatting = treefmtEval.config.build.check self;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
16
treefmt.nix
Normal file
16
treefmt.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
nixfmt = {
|
||||
enable = true;
|
||||
strict = true;
|
||||
};
|
||||
taplo = {
|
||||
enable = true;
|
||||
};
|
||||
prettier = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue