chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / yo / your_spotify / package.nix
blob77864788fa197d292b05b13d62fe68a700213b11
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchYarnDeps,
6   yarnConfigHook,
7   yarnBuildHook,
8   nodejs,
9   makeWrapper,
10   callPackage,
11   nixosTests,
14 stdenv.mkDerivation (finalAttrs: {
15   pname = "your_spotify_server";
16   version = "1.10.1";
18   src = fetchFromGitHub {
19     owner = "Yooooomi";
20     repo = "your_spotify";
21     rev = "refs/tags/${finalAttrs.version}";
22     hash = "sha256-e82j2blGxQLWAlBNuAnFvlD9vwMk4/mRI0Vf7vuaPA0=";
23   };
25   offlineCache = fetchYarnDeps {
26     yarnLock = finalAttrs.src + "/yarn.lock";
27     hash = "sha256-5SgknaRVzgO2Dzc8MhAaM8UERWMv+PrItzevoWHbWnA=";
28   };
30   nativeBuildInputs = [
31     makeWrapper
32     yarnConfigHook
33     yarnBuildHook
34     nodejs
35   ];
37   preBuild = ''
38     pushd ./apps/server/
39   '';
40   postBuild = ''
41     popd
42     rm -r node_modules
43     export NODE_ENV="production"
44     yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
45     patchShebangs node_modules/
46   '';
48   installPhase = ''
49     runHook preInstall
51     mkdir -p $out/share/your_spotify
52     cp -r node_modules $out/share/your_spotify/node_modules
53     cp -r ./apps/server/{lib,package.json} $out
54     mkdir -p $out/bin
55     makeWrapper ${lib.escapeShellArg (lib.getExe nodejs)} "$out/bin/your_spotify_migrate" \
56       --add-flags "$out/lib/migrations.js" --set NODE_PATH "$out/share/your_spotify/node_modules"
57     makeWrapper ${lib.escapeShellArg (lib.getExe nodejs)} "$out/bin/your_spotify_server" \
58       --add-flags "$out/lib/index.js" --set NODE_PATH "$out/share/your_spotify/node_modules"
60     runHook postInstall
61   '';
63   passthru = {
64     client = callPackage ./client.nix {
65       inherit (finalAttrs) src version offlineCache meta;
66     };
67     tests = {
68       inherit (nixosTests) your_spotify;
69     };
70   };
72   meta = {
73     homepage = "https://github.com/Yooooomi/your_spotify";
74     changelog = "https://github.com/Yooooomi/your_spotify/releases/tag/${finalAttrs.version}";
75     description = "Self-hosted application that tracks what you listen and offers you a dashboard to explore statistics about it";
76     license = lib.licenses.gpl3Only;
77     maintainers = with lib.maintainers; [ patrickdag ];
78     mainProgram = "your_spotify_server";
79   };