2021-12-19 01:06:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, llvmPackages
|
|
|
|
, sqlite
|
|
|
|
, installShellFiles
|
|
|
|
, Security
|
|
|
|
, libiconv
|
|
|
|
, innernet
|
2022-04-27 09:35:20 +00:00
|
|
|
, testers
|
2021-12-19 01:06:50 +00:00
|
|
|
}:
|
2021-04-19 03:05:28 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "innernet";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "1.5.5";
|
2021-04-19 03:05:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tonarino";
|
2021-12-06 16:07:01 +00:00
|
|
|
repo = "innernet";
|
2021-04-19 03:05:28 +00:00
|
|
|
rev = "v${version}";
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-jUL7/jHjfgpLg6728JQETbBcC2Q3G8d31oiwhkS+FD0=";
|
2021-04-19 03:05:28 +00:00
|
|
|
};
|
2022-09-30 11:47:45 +00:00
|
|
|
cargoSha256 = "sha256-qQ6yRI0rNxV/TRZHCR69h6kx6L2Wp75ziw+B2P8LZmE=";
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = with llvmPackages; [
|
|
|
|
llvm
|
|
|
|
clang
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
buildInputs = [ sqlite ] ++ lib.optionals stdenv.isDarwin [ Security libiconv ];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
2021-04-19 03:05:28 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
postInstall = ''
|
|
|
|
installManPage doc/innernet-server.8.gz
|
|
|
|
installManPage doc/innernet.8.gz
|
2021-06-04 09:07:49 +00:00
|
|
|
installShellCompletion doc/innernet.completions.{bash,fish,zsh}
|
|
|
|
installShellCompletion doc/innernet-server.completions.{bash,fish,zsh}
|
2022-07-14 12:49:19 +00:00
|
|
|
'' + (lib.optionalString stdenv.isLinux ''
|
|
|
|
find . -regex '.*\.\(target\|service\)' | xargs install -Dt $out/lib/systemd/system
|
|
|
|
find $out/lib/systemd/system -type f | xargs sed -i "s|/usr/bin/innernet|$out/bin/innernet|"
|
|
|
|
'');
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
passthru.tests = {
|
2022-04-27 09:35:20 +00:00
|
|
|
serverVersion = testers.testVersion { package = innernet; command = "innernet-server --version"; };
|
|
|
|
version = testers.testVersion { package = innernet; command = "innernet --version"; };
|
2021-12-19 01:06:50 +00:00
|
|
|
};
|
2021-04-19 03:05:28 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A private network system that uses WireGuard under the hood";
|
|
|
|
homepage = "https://github.com/tonarino/innernet";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ tomberek _0x4A6F ];
|
|
|
|
};
|
|
|
|
}
|