-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdefault.nix
119 lines (113 loc) · 3.37 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
lib,
stdenv,
callPackage,
fetchFromGitHub,
python3,
jetbrains-mono,
asciinema-scenario,
asciinema-agg,
uv2nix,
pyproject-nix,
pyproject-build-systems,
}:
let
pdocRepo = fetchFromGitHub {
owner = "mitmproxy";
repo = "pdoc";
tag = "v15.0.1";
hash = "sha256-HDrDGnK557EWbBQtsvDzTst3oV0NjLRm4ilXaxd6/j8=";
};
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
pyprojectOverlay = workspace.mkPyprojectOverlay {
sourcePreference = "wheel";
};
pyprojectOverrides = final: prev: {
makejinja = prev.makejinja.overrideAttrs (old: {
meta = (old.meta or { }) // {
mainProgram = "makejinja";
maintainers = with lib.maintainers; [ mirkolenz ];
license = lib.licenses.mit;
homepage = "https://github.com/mirkolenz/makejinja";
description = "Generate entire directory structures using Jinja templates with support for external data and custom plugins.";
platforms = with lib.platforms; darwin ++ linux;
};
passthru = lib.recursiveUpdate (old.passthru or { }) {
tests.pytest = stdenv.mkDerivation {
name = "${final.makejinja.name}-pytest";
inherit (final.makejinja) src;
nativeBuildInputs = [
(final.mkVirtualEnv "makejinja-test-env" {
makejinja = [ "test" ];
})
];
dontConfigure = true;
buildPhase = ''
runHook preBuild
pytest --cov-report=html
runHook postBuild
'';
installPhase = ''
runHook preInstall
mv htmlcov $out
runHook postInstall
'';
};
docs = stdenv.mkDerivation {
name = "${final.makejinja.name}-docs";
inherit (final.makejinja) src;
nativeBuildInputs = [
(final.mkVirtualEnv "makejinja-docs-env" {
makejinja = [ "docs" ];
})
asciinema-scenario
asciinema-agg
];
dontConfigure = true;
buildPhase = ''
runHook preBuild
{
echo '```txt'
COLUMNS=120 makejinja --help
echo '```'
} > ./manpage.md
asciinema-scenario ./assets/demo.scenario > ./assets/demo.cast
agg \
--font-dir "${jetbrains-mono}/share/fonts/truetype" \
--font-family "JetBrains Mono" \
--theme monokai \
./assets/demo.cast ./assets/demo.gif
pdoc \
-d google \
-t ${pdocRepo}/examples/dark-mode \
--math \
--logo https://raw.githubusercontent.com/mirkolenz/makejinja/main/assets/logo.png \
-o "$out" \
./src/makejinja
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/assets"
cp -rf ./assets/{*.png,*.gif} "$out/assets/"
runHook postInstall
'';
};
};
});
};
baseSet = callPackage pyproject-nix.build.packages {
python = python3;
};
in
{
inherit workspace;
inherit (callPackage pyproject-nix.build.util { }) mkApplication;
pythonSet = baseSet.overrideScope (
lib.composeManyExtensions [
pyproject-build-systems.overlays.default
pyprojectOverlay
pyprojectOverrides
]
);
}