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";
|
name = "digga";
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
fd
|
fd
|
||||||
|
treefmt
|
||||||
alejandra
|
alejandra
|
||||||
# Use the latest stable version of nix
|
# Use the latest stable version of nix
|
||||||
unstablePkgs.nix
|
unstablePkgs.nix
|
||||||
@ -105,8 +106,8 @@ devshell.mkShell {
|
|||||||
})
|
})
|
||||||
(utils {
|
(utils {
|
||||||
name = "fmt";
|
name = "fmt";
|
||||||
help = "Check Nix formatting";
|
help = "Check formatting";
|
||||||
command = "alejandra \${@} $PRJ_ROOT";
|
command = "treefmt \${@} $PRJ_ROOT";
|
||||||
})
|
})
|
||||||
(utils {
|
(utils {
|
||||||
name = "evalnix";
|
name = "evalnix";
|
||||||
|
@ -13,8 +13,7 @@ in
|
|||||||
|
|
||||||
# Selection of sysadmin tools that can come in handy
|
# Selection of sysadmin tools that can come in handy
|
||||||
systemPackages = with pkgs; [
|
systemPackages = with pkgs; [
|
||||||
# TODO: must come from unstable channel
|
alejandra
|
||||||
# alejandra
|
|
||||||
binutils
|
binutils
|
||||||
coreutils
|
coreutils
|
||||||
curl
|
curl
|
||||||
|
@ -35,7 +35,7 @@ in
|
|||||||
help = nvfetcher-bin.meta.description;
|
help = nvfetcher-bin.meta.description;
|
||||||
command = "cd $PRJ_ROOT/pkgs; ${nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@";
|
command = "cd $PRJ_ROOT/pkgs; ${nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@";
|
||||||
}
|
}
|
||||||
(linter alejandra)
|
(linter treefmt)
|
||||||
(linter editorconfig-checker)
|
(linter editorconfig-checker)
|
||||||
|
|
||||||
(docs mdbook)
|
(docs mdbook)
|
||||||
|
@ -9,13 +9,12 @@ fi
|
|||||||
|
|
||||||
diff="git diff-index --name-only --cached $against --diff-filter d"
|
diff="git diff-index --name-only --cached $against --diff-filter d"
|
||||||
|
|
||||||
nix_files=($($diff -- '*.nix'))
|
|
||||||
all_files=($($diff))
|
all_files=($($diff))
|
||||||
|
|
||||||
# Format staged nix files.
|
# Format staged files.
|
||||||
if ((${#nix_files[@]} != 0)); then
|
if ((${#all_files[@]} != 0)); then
|
||||||
alejandra "${nix_files[@]}" &&
|
treefmt "${all_files[@]}" &&
|
||||||
git add "${nix_files[@]}"
|
git add "${all_files[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check editorconfig
|
# 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
|
# 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
|
# system-space and pass sytem and input to each file
|
||||||
jobs = polyfillOutput ./jobs;
|
jobs = polyfillOutput ./jobs;
|
||||||
checks = polyfillOutput ./checks;
|
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