2021-12-19 01:06:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, 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";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "1.6.0";
|
2021-04-19 03:05:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tonarino";
|
2021-12-06 16:07:01 +00:00
|
|
|
repo = "innernet";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-eAiYXE8kSfuhBgrIo6rbtE2YH9JcLJwA/vXA5IWNYG8=";
|
2021-04-19 03:05:28 +00:00
|
|
|
};
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
cargoHash = "sha256-F+VvVF+5I53IF4Vur0SkUQXoqo8EE3XWirm88gu/GI4=";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.bindgenHook
|
2021-05-03 20:48:10 +00:00
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = [
|
|
|
|
sqlite
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Security
|
|
|
|
libiconv
|
|
|
|
];
|
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";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/tonarino/innernet/releases/tag/v${version}";
|
2021-04-19 03:05:28 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ tomberek _0x4A6F ];
|
|
|
|
};
|
|
|
|
}
|