2020-12-12 08:29:40 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, bzip2
|
2024-09-20 13:54:08 +00:00
|
|
|
, nixVersions
|
2020-12-12 08:29:40 +00:00
|
|
|
, makeWrapper
|
|
|
|
, nixosTests
|
2024-09-18 03:49:17 +00:00
|
|
|
, fetchpatch
|
2016-06-13 20:26:36 +00:00
|
|
|
}:
|
2014-12-14 01:18:14 +00:00
|
|
|
|
2016-06-13 20:26:36 +00:00
|
|
|
let
|
2024-09-18 03:49:17 +00:00
|
|
|
rev = "77ffa33d83d2c7c6551c5e420e938e92d72fec24";
|
|
|
|
sha256 = "sha256-MJRdVO2pt7wjOu5Hk0eVeNbk5bK5+Uo/Gh9XfO4OlMY=";
|
2024-09-20 13:54:08 +00:00
|
|
|
nix = nixVersions.nix_2_24;
|
2024-09-21 15:26:29 +00:00
|
|
|
inherit (nix.perl-bindings) perl;
|
2016-06-13 20:26:36 +00:00
|
|
|
in
|
2014-12-14 01:18:14 +00:00
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
stdenv.mkDerivation {
|
2021-07-27 18:35:51 +00:00
|
|
|
pname = "nix-serve";
|
2023-01-24 16:35:54 +00:00
|
|
|
version = "0.2-${lib.substring 0 7 rev}";
|
2014-12-14 01:18:14 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "edolstra";
|
|
|
|
repo = "nix-serve";
|
2016-06-13 20:26:36 +00:00
|
|
|
inherit rev sha256;
|
2014-12-14 01:18:14 +00:00
|
|
|
};
|
|
|
|
|
2024-09-18 03:49:17 +00:00
|
|
|
patches = [
|
|
|
|
# Part of https://github.com/edolstra/nix-serve/pull/61
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/edolstra/nix-serve/commit/9e434fff4486afeb3cc3f631f6dc56492b204704.patch";
|
|
|
|
sha256 = "sha256-TxQ6q6UApTKsYIMdr/RyrkKSA3k47stV63bTbxchNTU=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2019-04-21 19:27:55 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2014-12-14 01:18:14 +00:00
|
|
|
|
2016-06-13 20:26:36 +00:00
|
|
|
dontBuild = true;
|
2014-12-14 01:18:14 +00:00
|
|
|
|
2016-05-04 10:08:35 +00:00
|
|
|
installPhase = ''
|
2019-04-21 19:27:55 +00:00
|
|
|
install -Dm0755 nix-serve.psgi $out/libexec/nix-serve/nix-serve.psgi
|
|
|
|
|
|
|
|
makeWrapper ${perl.withPackages(p: [ p.DBDSQLite p.Plack p.Starman nix.perl-bindings ])}/bin/starman $out/bin/nix-serve \
|
2023-01-24 16:35:54 +00:00
|
|
|
--prefix PATH : "${lib.makeBinPath [ bzip2 nix ]}" \
|
2019-04-21 19:27:55 +00:00
|
|
|
--add-flags $out/libexec/nix-serve/nix-serve.psgi
|
2016-05-04 10:08:35 +00:00
|
|
|
'';
|
2014-12-14 01:18:14 +00:00
|
|
|
|
2024-09-17 13:03:12 +00:00
|
|
|
/** The nix package that nix-serve got its nix perl bindings from. */
|
|
|
|
passthru.nix = nix;
|
|
|
|
|
2021-12-03 16:19:42 +00:00
|
|
|
passthru.tests = {
|
|
|
|
nix-serve = nixosTests.nix-serve;
|
|
|
|
nix-serve-ssh = nixosTests.nix-serve-ssh;
|
|
|
|
};
|
2020-12-12 08:29:40 +00:00
|
|
|
|
2023-01-24 16:35:54 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/edolstra/nix-serve";
|
2014-12-14 01:18:14 +00:00
|
|
|
description = "Utility for sharing a Nix store as a binary cache";
|
2016-06-16 13:51:22 +00:00
|
|
|
maintainers = [ maintainers.eelco ];
|
2019-11-17 13:14:56 +00:00
|
|
|
license = licenses.lgpl21;
|
2024-09-22 14:07:53 +00:00
|
|
|
# See https://github.com/edolstra/nix-serve/issues/57
|
2024-11-17 10:41:54 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin;
|
2014-12-14 01:18:14 +00:00
|
|
|
platforms = nix.meta.platforms;
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "nix-serve";
|
2014-12-14 01:18:14 +00:00
|
|
|
};
|
|
|
|
}
|