lol
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 installShellFiles,
6 python3Packages,
7 versionCheckHook,
8}:
9
10python3Packages.buildPythonApplication rec {
11 pname = "mbake";
12 version = "1.4.1.pre";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "EbodShojaei";
17 repo = "bake";
18 tag = "v${version}";
19 hash = "sha256-HbBibwrd73GA0Z3xiYJAu1te7BADqsSkk0d99bMrwPw=";
20 };
21
22 build-system = [
23 installShellFiles
24 python3Packages.hatchling
25 ];
26
27 dependencies = with python3Packages; [
28 rich
29 typer
30 ];
31
32 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33 installShellCompletion --cmd mbake \
34 --bash <($out/bin/mbake completions bash) \
35 --fish <($out/bin/mbake completions fish) \
36 --zsh <($out/bin/mbake completions zsh)
37 '';
38
39 nativeCheckInputs = [
40 python3Packages.pytestCheckHook
41 versionCheckHook
42 ];
43 versionCheckProgramArg = "--version";
44
45 pythonImportsCheck = [ "mbake" ];
46
47 meta = {
48 description = "Makefile formatter and linter";
49 homepage = "https://github.com/EbodShojaei/bake";
50 changelog = "https://github.com/EbodShojaei/bake/blob/${src.tag}/CHANGELOG.md";
51 license = lib.licenses.mit;
52 mainProgram = "mbake";
53 maintainers = [ lib.maintainers.amadejkastelic ];
54 };
55}