nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildNpmPackage,
5 fetchFromGitHub,
6 chromium,
7 python3,
8}:
9buildNpmPackage {
10 pname = "single-file-cli";
11 version = "1.1.49";
12
13 src = fetchFromGitHub {
14 owner = "gildas-lormeau";
15 repo = "single-file-cli";
16 rev = "af0f6f119edd8bf82bce3860fa55cfad869ac874";
17 hash = "sha256-5pozqrIIanoLF4eugLxPRsUaoUYJurliovFFBYO/mC4=";
18 };
19 npmDepsHash = "sha256-wiBpWw9nb/pWVGIc4Vl/IxxR5ic0LzLMMr3WxRNvYdM=";
20
21 nativeCheckInputs = [ chromium ];
22 doCheck = stdenv.hostPlatform.isLinux;
23
24 postBuild = ''
25 patchShebangs ./single-file
26 '';
27
28 checkPhase = ''
29 runHook preCheck
30
31 ${python3}/bin/python -m http.server --bind 127.0.0.1 &
32 pid=$!
33
34 ./single-file \
35 --browser-headless \
36 --browser-executable-path chromium-browser\
37 http://127.0.0.1:8000
38
39 grep -F 'Page saved with SingleFile' 'Directory listing for'*.html
40
41 kill $pid
42 wait
43
44 runHook postCheck
45 '';
46
47 meta = {
48 description = "CLI tool for saving a faithful copy of a complete web page in a single HTML file";
49 homepage = "https://github.com/gildas-lormeau/single-file-cli";
50 license = lib.licenses.agpl3Only;
51 maintainers = with lib.maintainers; [ n8henrie ];
52 mainProgram = "single-file";
53 };
54}