commit
d01702db6f
@ -1,7 +1,10 @@
|
||||
cut_body_after = "" # don't include text from the PR body in the merge commit message
|
||||
status = [
|
||||
"Evaluate flake.nix",
|
||||
"package %",
|
||||
"check %",
|
||||
"devShell %",
|
||||
"check systemd-vaultd [x86_64-linux]",
|
||||
"check treefmt [x86_64-linux]",
|
||||
"check unittests [x86_64-linux]",
|
||||
"check vault-agent [x86_64-linux]",
|
||||
"devShell default [x86_64-linux]",
|
||||
"package default [x86_64-linux]"
|
||||
]
|
||||
|
@ -0,0 +1,57 @@
|
||||
{ inputs, ... }: {
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
perSystem =
|
||||
{ pkgs
|
||||
, ...
|
||||
}: {
|
||||
treefmt = {
|
||||
# Used to find the project root
|
||||
projectRootFile = "flake.lock";
|
||||
|
||||
programs.gofumpt.enable = true;
|
||||
programs.prettier.enable = true;
|
||||
|
||||
settings.formatter = {
|
||||
nix = {
|
||||
command = "sh";
|
||||
options = [
|
||||
"-eucx"
|
||||
''
|
||||
# First deadnix
|
||||
${pkgs.lib.getExe pkgs.deadnix} --edit "$@"
|
||||
# Then nixpkgs-fmt
|
||||
${pkgs.lib.getExe pkgs.nixpkgs-fmt} "$@"
|
||||
''
|
||||
"--"
|
||||
];
|
||||
includes = [ "*.nix" ];
|
||||
};
|
||||
|
||||
python = {
|
||||
command = "sh";
|
||||
options = [
|
||||
"-eucx"
|
||||
''
|
||||
${pkgs.lib.getExe pkgs.ruff} --fix "$@"
|
||||
${pkgs.lib.getExe pkgs.python3.pkgs.black} "$@"
|
||||
''
|
||||
"--" # this argument is ignored by bash
|
||||
];
|
||||
includes = [ "*.py" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
checks =
|
||||
let
|
||||
nixosTests = pkgs.callPackages ./nixos-test.nix {
|
||||
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit (nixosTests) unittests vault-agent systemd-vaultd;
|
||||
};
|
||||
};
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
runCommand,
|
||||
gofumpt,
|
||||
alejandra,
|
||||
python3,
|
||||
treefmt,
|
||||
}:
|
||||
runCommand "treefmt" {
|
||||
nativeBuildInputs = [
|
||||
gofumpt
|
||||
treefmt
|
||||
alejandra
|
||||
python3.pkgs.flake8
|
||||
python3.pkgs.black
|
||||
];
|
||||
} ''
|
||||
# keep timestamps so that treefmt is able to detect mtime changes
|
||||
cp --no-preserve=mode --preserve=timestamps -r ${../..} source
|
||||
cd source
|
||||
HOME=$TMPDIR treefmt --no-cache --fail-on-change
|
||||
touch $out
|
||||
''
|
@ -0,0 +1,20 @@
|
||||
[tool.ruff]
|
||||
line-length = 88
|
||||
|
||||
select = ["E", "F", "I"]
|
||||
ignore = [ "E501" ]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.10"
|
||||
warn_redundant_casts = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_defs = true
|
||||
no_implicit_optional = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "setuptools.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "pytest.*"
|
||||
ignore_missing_imports = true
|
@ -1,20 +0,0 @@
|
||||
{pkgs ? import <nixpkgs> {}}:
|
||||
with pkgs;
|
||||
mkShellNoCC {
|
||||
buildInputs = [
|
||||
python3.pkgs.pytest
|
||||
python3.pkgs.flake8
|
||||
python3.pkgs.black
|
||||
python3.pkgs.mypy
|
||||
|
||||
gofumpt
|
||||
golangci-lint
|
||||
alejandra
|
||||
vault
|
||||
systemd
|
||||
hivemind
|
||||
go
|
||||
treefmt
|
||||
just
|
||||
];
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
[formatter.nix]
|
||||
command = "alejandra"
|
||||
includes = ["*.nix"]
|
||||
|
||||
[formatter.python]
|
||||
command = "sh"
|
||||
options = [
|
||||
"-eucx",
|
||||
"""
|
||||
flake8 "$@"
|
||||
black "$@"
|
||||
"""
|
||||
]
|
||||
includes = ["*.py"]
|
||||
excludes = []
|
||||
|
||||
[formatter.go]
|
||||
command = "gofumpt"
|
||||
options = ["-w"]
|
||||
includes = ["*.go"]
|
||||
excludes = []
|
Loading…
Reference in New Issue