nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchYarnDeps,
6 makeWrapper,
7 nodejs,
8 fixup-yarn-lock,
9 yarn,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "node-hp-scan-to";
14 version = "1.4.3";
15
16 src = fetchFromGitHub {
17 owner = "manuc66";
18 repo = "node-hp-scan-to";
19 rev = "v${finalAttrs.version}";
20 hash = "sha256-/XUqCL2F1iMYUoCbGgL9YKs+8wIFHvmh2O0LMbDU8yE=";
21 };
22
23 offlineCache = fetchYarnDeps {
24 yarnLock = "${finalAttrs.src}/yarn.lock";
25 hash = "sha256-pxeYumHuomOFyCi8XhYTYQNcsGOUvjOg36bFD0yhdLk=";
26 };
27
28 nativeBuildInputs = [
29 makeWrapper
30 nodejs
31 fixup-yarn-lock
32 yarn
33 ];
34
35 configurePhase = ''
36 runHook preConfigure
37
38 export HOME=$(mktemp -d)
39 yarn config --offline set yarn-offline-mirror $offlineCache
40 fixup-yarn-lock yarn.lock
41 yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
42 patchShebangs node_modules
43
44 runHook postConfigure
45 '';
46
47 buildPhase = ''
48 runHook preBuild
49
50 yarn --offline build
51
52 runHook postBuild
53 '';
54
55 installPhase = ''
56 runHook preInstall
57
58 yarn --offline --production install
59
60 mkdir -p "$out/lib/node_modules/node-hp-scan-to"
61 cp -r dist node_modules package.json "$out/lib/node_modules/node-hp-scan-to"
62
63 makeWrapper "${nodejs}/bin/node" "$out/bin/node-hp-scan-to" \
64 --add-flags "$out/lib/node_modules/node-hp-scan-to/dist/index.js"
65
66 runHook postInstall
67 '';
68
69 meta = {
70 changelog = "https://github.com/manuc66/node-hp-scan-to/releases/tag/${finalAttrs.src.rev}";
71 description = "Allow to send scan from device to computer for some HP All-in-One Printers";
72 homepage = "https://github.com/manuc66/node-hp-scan-to";
73 license = lib.licenses.mit;
74 mainProgram = "node-hp-scan-to";
75 maintainers = with lib.maintainers; [ jonas-w ];
76 };
77})