audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / ni / nix-serve / package.nix
blob294258cc5b270408d72fafc590ef7ca251f2005b
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   bzip2,
6   nixVersions,
7   makeWrapper,
8   nixosTests,
9   fetchpatch,
12 let
13   rev = "77ffa33d83d2c7c6551c5e420e938e92d72fec24";
14   sha256 = "sha256-MJRdVO2pt7wjOu5Hk0eVeNbk5bK5+Uo/Gh9XfO4OlMY=";
15   nix = nixVersions.nix_2_24;
16   inherit (nix.perl-bindings) perl;
19 stdenv.mkDerivation {
20   pname = "nix-serve";
21   version = "0.2-${lib.substring 0 7 rev}";
23   src = fetchFromGitHub {
24     owner = "edolstra";
25     repo = "nix-serve";
26     inherit rev sha256;
27   };
29   patches = [
30     # Part of https://github.com/edolstra/nix-serve/pull/61
31     (fetchpatch {
32       url = "https://github.com/edolstra/nix-serve/commit/9e434fff4486afeb3cc3f631f6dc56492b204704.patch";
33       sha256 = "sha256-TxQ6q6UApTKsYIMdr/RyrkKSA3k47stV63bTbxchNTU=";
34     })
35   ];
37   nativeBuildInputs = [ makeWrapper ];
39   dontBuild = true;
41   installPhase = ''
42     install -Dm0755 nix-serve.psgi $out/libexec/nix-serve/nix-serve.psgi
44     makeWrapper ${
45       perl.withPackages (p: [
46         p.DBDSQLite
47         p.Plack
48         p.Starman
49         nix.perl-bindings
50       ])
51     }/bin/starman $out/bin/nix-serve \
52                 --prefix PATH : "${
53                   lib.makeBinPath [
54                     bzip2
55                     nix
56                   ]
57                 }" \
58                 --add-flags $out/libexec/nix-serve/nix-serve.psgi
59   '';
61   /**
62     The nix package that nix-serve got its nix perl bindings from.
63   */
64   passthru.nix = nix;
66   passthru.tests = {
67     nix-serve = nixosTests.nix-serve;
68     nix-serve-ssh = nixosTests.nix-serve-ssh;
69   };
71   meta = with lib; {
72     homepage = "https://github.com/edolstra/nix-serve";
73     description = "Utility for sharing a Nix store as a binary cache";
74     maintainers = [ maintainers.eelco ];
75     license = licenses.lgpl21;
76     # See https://github.com/edolstra/nix-serve/issues/57
77     broken = stdenv.hostPlatform.isDarwin;
78     platforms = nix.meta.platforms;
79     mainProgram = "nix-serve";
80   };