mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
add: python formatting
This commit is contained in:
parent
40eb491b8a
commit
cad5005cab
22
flake.nix
22
flake.nix
@ -177,10 +177,15 @@
|
||||
// {
|
||||
# passes through extra flags to treefmt
|
||||
format.type = "app";
|
||||
format.program =
|
||||
format.program = let
|
||||
path = lib.makeBinPath [
|
||||
alejandra.defaultPackage.${system}
|
||||
pkgs.python3.pkgs.black
|
||||
];
|
||||
in
|
||||
l.toString
|
||||
(pkgs.writeScript "format" ''
|
||||
export PATH="${alejandra.defaultPackage.${system}}/bin"
|
||||
export PATH="${path}"
|
||||
${pkgs.treefmt}/bin/treefmt --clear-cache "$@"
|
||||
'');
|
||||
|
||||
@ -205,6 +210,11 @@
|
||||
dream2nix-shell = mkShell {
|
||||
devshell.name = "dream2nix-devshell";
|
||||
|
||||
packages = [
|
||||
alejandra.defaultPackage.${system}
|
||||
pkgs.python3.pkgs.black
|
||||
];
|
||||
|
||||
commands =
|
||||
[
|
||||
{package = pkgs.nix;}
|
||||
@ -221,10 +231,6 @@
|
||||
package = pkgs.treefmt;
|
||||
category = "formatting";
|
||||
}
|
||||
{
|
||||
package = alejandra.defaultPackage.${system};
|
||||
category = "formatting";
|
||||
}
|
||||
]
|
||||
# using linux is highly recommended as cntr is amazing for debugging builds
|
||||
++ lib.optional pkgs.stdenv.isLinux {
|
||||
@ -273,8 +279,8 @@
|
||||
};
|
||||
cleanup = {
|
||||
enable = true;
|
||||
name = "cleaned";
|
||||
entry = l.toString (pkgs.writeScript "cleaned" ''
|
||||
name = "cleanup";
|
||||
entry = l.toString (pkgs.writeScript "cleanup" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
for badFile in $(find ./examples | grep 'flake.lock\|dream2nix-packages'); do
|
||||
rm -rf $badFile
|
||||
|
@ -6,3 +6,7 @@ excludes = [
|
||||
"src/templates/translators/*",
|
||||
"src/modules/_template/*",
|
||||
]
|
||||
|
||||
[formatter.py]
|
||||
command = "black"
|
||||
includes = ["*.py"]
|
||||
|
Loading…
Reference in New Issue
Block a user