2021-07-18 21:22:44 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, bzip2
|
|
|
|
, nix
|
|
|
|
, perl
|
|
|
|
, makeWrapper
|
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
rev = "e4675e38ab54942e351c7686e40fabec822120b9";
|
|
|
|
sha256 = "1wm24p6pkxl1d7hrvf4ph6mwzawvqi22c60z9xzndn5xfyr4v0yr";
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-08-05 21:33:18 +00:00
|
|
|
pname = "nix-serve";
|
|
|
|
version = "0.2-${substring 0 7 rev}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "edolstra";
|
|
|
|
repo = "nix-serve";
|
|
|
|
inherit rev sha256;
|
|
|
|
};
|
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-04-12 18:23:04 +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 \
|
|
|
|
--prefix PATH : "${makeBinPath [ bzip2 nix ]}" \
|
|
|
|
--add-flags $out/libexec/nix-serve/nix-serve.psgi
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.tests = {
|
|
|
|
nix-serve = nixosTests.nix-serve;
|
|
|
|
nix-serve-ssh = nixosTests.nix-serve-ssh;
|
|
|
|
};
|
2021-07-18 21:22:44 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/edolstra/nix-serve";
|
|
|
|
description = "A utility for sharing a Nix store as a binary cache";
|
|
|
|
maintainers = [ maintainers.eelco ];
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
platforms = nix.meta.platforms;
|
|
|
|
};
|
|
|
|
}
|