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
|
# passes through extra flags to treefmt
|
||||||
format.type = "app";
|
format.type = "app";
|
||||||
format.program =
|
format.program = let
|
||||||
|
path = lib.makeBinPath [
|
||||||
|
alejandra.defaultPackage.${system}
|
||||||
|
pkgs.python3.pkgs.black
|
||||||
|
];
|
||||||
|
in
|
||||||
l.toString
|
l.toString
|
||||||
(pkgs.writeScript "format" ''
|
(pkgs.writeScript "format" ''
|
||||||
export PATH="${alejandra.defaultPackage.${system}}/bin"
|
export PATH="${path}"
|
||||||
${pkgs.treefmt}/bin/treefmt --clear-cache "$@"
|
${pkgs.treefmt}/bin/treefmt --clear-cache "$@"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
@ -205,6 +210,11 @@
|
|||||||
dream2nix-shell = mkShell {
|
dream2nix-shell = mkShell {
|
||||||
devshell.name = "dream2nix-devshell";
|
devshell.name = "dream2nix-devshell";
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
alejandra.defaultPackage.${system}
|
||||||
|
pkgs.python3.pkgs.black
|
||||||
|
];
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
[
|
[
|
||||||
{package = pkgs.nix;}
|
{package = pkgs.nix;}
|
||||||
@ -221,10 +231,6 @@
|
|||||||
package = pkgs.treefmt;
|
package = pkgs.treefmt;
|
||||||
category = "formatting";
|
category = "formatting";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
package = alejandra.defaultPackage.${system};
|
|
||||||
category = "formatting";
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
# using linux is highly recommended as cntr is amazing for debugging builds
|
# using linux is highly recommended as cntr is amazing for debugging builds
|
||||||
++ lib.optional pkgs.stdenv.isLinux {
|
++ lib.optional pkgs.stdenv.isLinux {
|
||||||
@ -273,8 +279,8 @@
|
|||||||
};
|
};
|
||||||
cleanup = {
|
cleanup = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "cleaned";
|
name = "cleanup";
|
||||||
entry = l.toString (pkgs.writeScript "cleaned" ''
|
entry = l.toString (pkgs.writeScript "cleanup" ''
|
||||||
#!${pkgs.bash}/bin/bash
|
#!${pkgs.bash}/bin/bash
|
||||||
for badFile in $(find ./examples | grep 'flake.lock\|dream2nix-packages'); do
|
for badFile in $(find ./examples | grep 'flake.lock\|dream2nix-packages'); do
|
||||||
rm -rf $badFile
|
rm -rf $badFile
|
||||||
|
@ -6,3 +6,7 @@ excludes = [
|
|||||||
"src/templates/translators/*",
|
"src/templates/translators/*",
|
||||||
"src/modules/_template/*",
|
"src/modules/_template/*",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[formatter.py]
|
||||||
|
command = "black"
|
||||||
|
includes = ["*.py"]
|
||||||
|
Loading…
Reference in New Issue
Block a user