16 src = fetchFromGitHub {
20 sha256 = "K1cAvmqWEfS6EY4MKAtjXb388XLYHtouxNM70PWgFig=";
24 ./use-mysql-over-domain-socket.patch
26 # upgrade dependencies to make it compatible with node 18
28 url = "https://github.com/midchildan/EPGStation/commit/5d6cad746b7d9b6d246adcdecf9c991b77c9d89e.patch";
29 sha256 = "sha256-9a8VUjczlyQHVO7w9MYorPIZunAuBuif1HNmtp1yMk8=";
32 url = "https://github.com/midchildan/EPGStation/commit/c948e833e485c2b7cb7fb33b953cca1e20de3a70.patch";
33 sha256 = "sha256-nM6KkVRURuQFZLXZ2etLU1a1+BoaJnfjngo07TFbe58=";
37 npmDepsHash = "sha256-dohencRGuvc+vSoclLVn5iles4GOuTq26BrEVeJ4GC4=";
38 npmBuildScript = "build-server";
39 npmRootPath = "/lib/node_modules/epgstation";
41 buildInputs = [ bash ];
42 nativeBuildInputs = [ installShellFiles makeWrapper python3 ];
44 clientDir = buildNpmPackage {
45 pname = "${pname}-client";
46 inherit version src installPhase meta;
48 npmDepsHash = "sha256-a/cDPABWI4lPxvSOI4D90O71A9lm8icPMak/g6DPYQY=";
51 sourceRoot = "${src.name}/client";
52 NODE_OPTIONS = "--openssl-legacy-provider";
57 cp -r ${clientDir} client
60 # installPhase is shared with clientDir
64 npm prune --omit dev --no-save \
66 "''${npmInstallFlagsArray[@]}" \
68 "''${npmFlagsArray[@]}"
70 mkdir -p $out$npmRootPath
71 cp -r . $out$npmRootPath
78 runtimeDeps = [ nodejs bash ];
81 mkdir -p $out/{bin,libexec,share/doc/epgstation}
83 pushd $out$npmRootPath
85 mv config/enc.js.template $out/libexec/enc.js
86 mv LICENSE Readme.md $out/share/doc/epgstation
87 mv doc/* $out/share/doc/epgstation
88 sed 's/@DESCRIPTION@/${meta.description}/g' ${./epgstation.1} > doc/epgstation.1
89 installManPage doc/epgstation.1
92 # just log to stdout and let journald do its job
95 # Replace the existing configuration and runtime state directories with
96 # symlinks. Without this, they would all be non-writable because they
97 # reside in the Nix store. Note that the source path won't be accessible
99 rm -r config data drop recorded thumbnail src/db/subscribers src/db/migrations
100 ln -sfT /etc/epgstation config
101 ln -sfT /var/lib/epgstation data
102 ln -sfT /var/lib/epgstation/drop drop
103 ln -sfT /var/lib/epgstation/recorded recorded
104 ln -sfT /var/lib/epgstation/thumbnail thumbnail
105 ln -sfT /var/lib/epgstation/db/subscribers src/db/subscribers
106 ln -sfT /var/lib/epgstation/db/migrations src/db/migrations
108 makeWrapper ${nodejs}/bin/npm $out/bin/epgstation \
109 --chdir $out$npmRootPath \
110 --prefix PATH : ${lib.makeBinPath runtimeDeps} \
111 --set APP_ROOT_PATH $out$npmRootPath
117 description = "DVR software compatible with Mirakurun.";
118 homepage = "https://github.com/l3tnun/EPGStation";
119 license = licenses.mit;
120 maintainers = with maintainers; [ midchildan ];
121 mainProgram = "epgstation";