Skip to content

Commit 9d6f8f2

Browse files
committed
convertx: init at 0.17.0
1 parent 227c926 commit 9d6f8f2

2 files changed

Lines changed: 160 additions & 0 deletions

File tree

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
{
2+
stdenv,
3+
lib,
4+
fetchFromGitHub,
5+
6+
# Build deps
7+
bun,
8+
tailwindcss_4,
9+
typescript,
10+
makeBinaryWrapper,
11+
12+
# Runtime deps
13+
assimp,
14+
calibre,
15+
dasel,
16+
ffmpeg-headless,
17+
graphicsmagick,
18+
imagemagick,
19+
inkscape,
20+
libheif,
21+
libjxl,
22+
libreoffice,
23+
libva,
24+
pandoc,
25+
perl5Packages,
26+
potrace,
27+
python3,
28+
resvg,
29+
texliveBasic,
30+
vips,
31+
vtracer,
32+
}:
33+
let
34+
pin = lib.importJSON ./pin.json;
35+
inherit (pin) version;
36+
37+
pname = "convertx";
38+
39+
src = fetchFromGitHub {
40+
owner = "C4illin";
41+
repo = "ConvertX";
42+
tag = "v${version}";
43+
hash = pin.srcHash;
44+
};
45+
46+
node_modules = stdenv.mkDerivation (finalAttrs: {
47+
pname = "${pname}-node_modules";
48+
inherit version src;
49+
50+
dontConfigure = true;
51+
52+
nativeBuildInputs = [
53+
bun
54+
];
55+
56+
buildPhase = ''
57+
runHook preBuild
58+
59+
bun install --frozen-lockfile --no-progress
60+
61+
runHook postBuild
62+
'';
63+
64+
installPhase = ''
65+
mkdir -p $out/lib/node_modules
66+
67+
rm -rf ./node_modules/.cache
68+
rm -rf node_modules/.bin
69+
cp -R ./node_modules $out/lib
70+
cp package.json $out/lib
71+
'';
72+
73+
outputHash = pin."${stdenv.system}";
74+
outputHashMode = "recursive";
75+
});
76+
in
77+
stdenv.mkDerivation {
78+
inherit pname version src;
79+
80+
nativeBuildInputs = [
81+
makeBinaryWrapper
82+
tailwindcss_4
83+
typescript
84+
];
85+
86+
dontConfigure = true;
87+
88+
buildPhase = ''
89+
runHook preBuild
90+
91+
ln -s ${node_modules}/lib/node_modules ./node_modules
92+
tailwindcss -i ./src/main.css -o ./public/generated.css
93+
tsc
94+
95+
substituteInPlace ./dist/src/index.js \
96+
--replace-fail "assets: \"public\"" "assets: \"$out/share/convertx/dist/public\""
97+
98+
runHook postBuild
99+
'';
100+
101+
installPhase = ''
102+
mkdir -p $out/bin
103+
mkdir -p $out/share/convertx
104+
cp -R ./dist $out/share/convertx
105+
cp -R ./public $out/share/convertx/dist
106+
ln -s ${node_modules}/lib/node_modules $out
107+
108+
makeBinaryWrapper ${bun}/bin/bun $out/bin/convertx \
109+
--add-flags "run --prefer-offline --no-install $out/share/convertx/dist/src/index.js" \
110+
--set NODE_ENV production \
111+
--suffix PATH : ${
112+
lib.makeBinPath [
113+
assimp
114+
calibre
115+
dasel
116+
ffmpeg-headless
117+
graphicsmagick
118+
imagemagick
119+
inkscape
120+
libheif
121+
libjxl
122+
libreoffice
123+
libva
124+
pandoc
125+
perl5Packages.EmailOutlookMessage
126+
potrace
127+
(python3.withPackages (ps: [ ps.markitdown ]))
128+
resvg
129+
(texliveBasic.withPackages (ps: [
130+
ps.dvisvgm
131+
ps.latex
132+
ps.latexmk
133+
ps.unicode-math
134+
ps.xcolor
135+
ps.xetex
136+
]))
137+
vips
138+
vtracer
139+
]
140+
}
141+
'';
142+
143+
meta = {
144+
description = "Self-hosted online file converter";
145+
homepage = "https://github.com/C4illin/ConvertX/tree/main";
146+
license = lib.licenses.agpl3Only;
147+
platforms = lib.platforms.linux;
148+
changelog = "https://github.com/C4illin/ConvertX/blob/main/CHANGELOG.md";
149+
mainProgram = "convertx";
150+
maintainers = with lib.maintainers; [
151+
EpicEric
152+
];
153+
};
154+
}

pkgs/by-name/co/convertx/pin.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "0.17.0",
3+
"srcHash": "sha256-1W7M9BfAh89ntmJW7tNwydwPCkVy5CoddWb2aPPUFds=",
4+
"x86_64-linux": "sha256-7B4ZGGew6isFnz7EoaLyJgO6a66V9ZTKsKxXwVSsnfs=",
5+
"aarch64-linux": "sha256-IoQP9UBd64qecOwmI8oQREgiYCL2pXGjfVx1Ylvd/WA="
6+
}

0 commit comments

Comments
 (0)