mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2026-04-15 05:39:11 +02:00
feat: simplify flake-parts imports
This commit is contained in:
parent
3d3e8d450d
commit
ff8dd91aef
24 changed files with 77 additions and 79 deletions
43
flake/formatter.nix
Normal file
43
flake/formatter.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
perSystem = { pkgs, ... }: {
|
||||
# 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;
|
||||
shfmt = {
|
||||
enable = true;
|
||||
indent_size = 4;
|
||||
simplify = true;
|
||||
# needed to replicate what my Emacs shfmt does
|
||||
# there is no builtin option for space-redirects
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "shfmt";
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
paths = [ pkgs.shfmt ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/shfmt \
|
||||
--add-flags '-sr'
|
||||
'';
|
||||
};
|
||||
};
|
||||
shellcheck.enable = true;
|
||||
};
|
||||
settings.formatter.shellcheck.options = [
|
||||
"--shell"
|
||||
"bash"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue