mirror of
https://github.com/divnix/digga.git
synced 2024-08-18 03:20:24 +03:00
🧠 redesign
Use treefmt
This commit is contained in:
parent
6c72c7ac8b
commit
68dd6bd83b
@ -67,6 +67,7 @@ devshell.mkShell {
|
||||
name = "digga";
|
||||
packages = with pkgs; [
|
||||
fd
|
||||
treefmt
|
||||
alejandra
|
||||
# Use the latest stable version of nix
|
||||
unstablePkgs.nix
|
||||
@ -105,8 +106,8 @@ devshell.mkShell {
|
||||
})
|
||||
(utils {
|
||||
name = "fmt";
|
||||
help = "Check Nix formatting";
|
||||
command = "alejandra \${@} $PRJ_ROOT";
|
||||
help = "Check formatting";
|
||||
command = "treefmt \${@} $PRJ_ROOT";
|
||||
})
|
||||
(utils {
|
||||
name = "evalnix";
|
||||
|
@ -13,8 +13,7 @@ in
|
||||
|
||||
# Selection of sysadmin tools that can come in handy
|
||||
systemPackages = with pkgs; [
|
||||
# TODO: must come from unstable channel
|
||||
# alejandra
|
||||
alejandra
|
||||
binutils
|
||||
coreutils
|
||||
curl
|
||||
|
@ -35,7 +35,7 @@ in
|
||||
help = nvfetcher-bin.meta.description;
|
||||
command = "cd $PRJ_ROOT/pkgs; ${nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@";
|
||||
}
|
||||
(linter alejandra)
|
||||
(linter treefmt)
|
||||
(linter editorconfig-checker)
|
||||
|
||||
(docs mdbook)
|
||||
|
@ -9,13 +9,12 @@ fi
|
||||
|
||||
diff="git diff-index --name-only --cached $against --diff-filter d"
|
||||
|
||||
nix_files=($($diff -- '*.nix'))
|
||||
all_files=($($diff))
|
||||
|
||||
# Format staged nix files.
|
||||
if ((${#nix_files[@]} != 0)); then
|
||||
alejandra "${nix_files[@]}" &&
|
||||
git add "${nix_files[@]}"
|
||||
# Format staged files.
|
||||
if ((${#all_files[@]} != 0)); then
|
||||
treefmt "${all_files[@]}" &&
|
||||
git add "${all_files[@]}"
|
||||
fi
|
||||
|
||||
# check editorconfig
|
||||
|
3
examples/devos/treefmt.toml
Normal file
3
examples/devos/treefmt.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[formatter.nix]
|
||||
command = "alejandra"
|
||||
includes = ["*.nix"]
|
@ -144,7 +144,8 @@
|
||||
'';
|
||||
|
||||
# digga-local use
|
||||
formatter = nixlib.lib.genAttrs supportedSystems (s: nixpkgs.legacyPackages.${s}.alejandra);
|
||||
## This doesn't appear to be used?
|
||||
formatter = nixlib.lib.genAttrs supportedSystems (s: nixpkgs.legacyPackages.${s}.treefmt);
|
||||
# system-space and pass sytem and input to each file
|
||||
jobs = polyfillOutput ./jobs;
|
||||
checks = polyfillOutput ./checks;
|
||||
|
3
treefmt.toml
Normal file
3
treefmt.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[formatter.nix]
|
||||
command = "alejandra"
|
||||
includes = ["*.nix"]
|
Loading…
Reference in New Issue
Block a user