mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
feat: improve formatting
This commit is contained in:
parent
c098800c79
commit
47075799d6
5 changed files with 89 additions and 6 deletions
|
|
@ -561,6 +561,7 @@ A short overview over each input and what it does:
|
||||||
url = "github:astro/microvm.nix";
|
url = "github:astro/microvm.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||||
|
|
||||||
};
|
};
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -1375,6 +1376,7 @@ Lastly, in the =perSystem= attribute set, we see that it is actually passed some
|
||||||
nixpkgs-fmt.enable = true;
|
nixpkgs-fmt.enable = true;
|
||||||
statix.enable = true;
|
statix.enable = true;
|
||||||
trim-trailing-whitespace.enable = true;
|
trim-trailing-whitespace.enable = true;
|
||||||
|
treefmt.enable = true;
|
||||||
|
|
||||||
destroyed-symlinks = {
|
destroyed-symlinks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -1583,10 +1585,32 @@ Otherwise, I define the function =mkTemplates= here which builds a named attribu
|
||||||
Defines a formatter that can be called using =nix flake format=. While a nice utility, I have stronger tools to perform this job.
|
Defines a formatter that can be called using =nix flake format=. While a nice utility, I have stronger tools to perform this job.
|
||||||
|
|
||||||
#+begin_src nix-ts :tangle nix/formatter.nix
|
#+begin_src nix-ts :tangle nix/formatter.nix
|
||||||
_:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
|
];
|
||||||
|
|
||||||
perSystem = { pkgs, ... }: {
|
perSystem = { pkgs, ... }: {
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
# formatter = pkgs.nixpkgs-fmt;
|
||||||
|
# formatter is set by treefmt to:
|
||||||
|
# formatter = lib.mkIf config.treefmt.flakeFormatter (lib.mkDefault config.treefmt.build.wrapper);
|
||||||
|
treefmt = {
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
programs = {
|
||||||
|
nixfmt = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.nixpkgs-fmt;
|
||||||
|
};
|
||||||
|
deadnix.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
shellcheck.enable = true;
|
||||||
|
};
|
||||||
|
settings.formatter.shellcheck.options = [
|
||||||
|
"--shell"
|
||||||
|
"bash"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22386,7 +22410,7 @@ This adds support for Terraform configuration files. I need this at work.
|
||||||
(add-hook 'terraform-mode-hook #'outline-minor-mode)
|
(add-hook 'terraform-mode-hook #'outline-minor-mode)
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
*** nixpkgs-fmt
|
*** nix formatting
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: h:5ca7484b-b9d6-4023-88d1-a1e37d5df249
|
:CUSTOM_ID: h:5ca7484b-b9d6-4023-88d1-a1e37d5df249
|
||||||
:END:
|
:END:
|
||||||
|
|
|
||||||
37
flake.lock
generated
37
flake.lock
generated
|
|
@ -10577,6 +10577,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_82": {
|
"nixpkgs_82": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1761236834,
|
||||||
|
"narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_83": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1754800730,
|
"lastModified": 1754800730,
|
||||||
"narHash": "sha256-HfVZCXic9XLBgybP0318ym3cDnGwBs/+H5MgxFVYF4I=",
|
"narHash": "sha256-HfVZCXic9XLBgybP0318ym3cDnGwBs/+H5MgxFVYF4I=",
|
||||||
|
|
@ -12582,6 +12598,7 @@
|
||||||
"swarsel-modules": "swarsel-modules_6",
|
"swarsel-modules": "swarsel-modules_6",
|
||||||
"swarsel-nix": "swarsel-nix_3",
|
"swarsel-nix": "swarsel-nix_3",
|
||||||
"systems": "systems_64",
|
"systems": "systems_64",
|
||||||
|
"treefmt-nix": "treefmt-nix_3",
|
||||||
"vbc-nix": "vbc-nix_8",
|
"vbc-nix": "vbc-nix_8",
|
||||||
"zjstatus": "zjstatus_8"
|
"zjstatus": "zjstatus_8"
|
||||||
}
|
}
|
||||||
|
|
@ -16052,6 +16069,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"treefmt-nix_3": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_82"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1762938485,
|
||||||
|
"narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vbc-nix": {
|
"vbc-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -16628,7 +16663,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane_17",
|
"crane": "crane_17",
|
||||||
"flake-utils": "flake-utils_29",
|
"flake-utils": "flake-utils_29",
|
||||||
"nixpkgs": "nixpkgs_82",
|
"nixpkgs": "nixpkgs_83",
|
||||||
"rust-overlay": "rust-overlay_17"
|
"rust-overlay": "rust-overlay_17"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@
|
||||||
url = "github:astro/microvm.nix";
|
url = "github:astro/microvm.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||||
|
|
||||||
};
|
};
|
||||||
outputs =
|
outputs =
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
nixpkgs-fmt.enable = true;
|
nixpkgs-fmt.enable = true;
|
||||||
statix.enable = true;
|
statix.enable = true;
|
||||||
trim-trailing-whitespace.enable = true;
|
trim-trailing-whitespace.enable = true;
|
||||||
|
treefmt.enable = true;
|
||||||
|
|
||||||
destroyed-symlinks = {
|
destroyed-symlinks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,28 @@
|
||||||
_:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
|
];
|
||||||
|
|
||||||
perSystem = { pkgs, ... }: {
|
perSystem = { pkgs, ... }: {
|
||||||
formatter = pkgs.nixpkgs-fmt;
|
# formatter = pkgs.nixpkgs-fmt;
|
||||||
|
# formatter is set by treefmt to:
|
||||||
|
# formatter = lib.mkIf config.treefmt.flakeFormatter (lib.mkDefault config.treefmt.build.wrapper);
|
||||||
|
treefmt = {
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
programs = {
|
||||||
|
nixfmt = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.nixpkgs-fmt;
|
||||||
|
};
|
||||||
|
deadnix.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
shellcheck.enable = true;
|
||||||
|
};
|
||||||
|
settings.formatter.shellcheck.options = [
|
||||||
|
"--shell"
|
||||||
|
"bash"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue