2021-04-29 21:56:38 +01:00
|
|
|
{ lib, stdenv, rustPlatform, fetchFromGitHub, llvmPackages, sqlite, installShellFiles, Security, libiconv }:
|
2021-04-19 03:33:03 +01:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "innernet";
|
2021-06-01 12:58:26 +01:00
|
|
|
version = "1.3.1";
|
2021-04-19 03:33:03 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tonarino";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-01 12:58:26 +01:00
|
|
|
sha256 = "sha256-Tnwq86gAbi24O8/26134gJCf9+wol1zma980t9iHEKY=";
|
2021-04-19 03:33:03 +01:00
|
|
|
};
|
2021-06-01 12:58:26 +01:00
|
|
|
cargoSha256 = "sha256-Wy+i1lmXpsy0Sy0GF5XUfXsLQHeV7cQo9nUxUEFnHOU=";
|
2021-04-19 03:33:03 +01:00
|
|
|
|
2021-04-26 19:04:25 +01:00
|
|
|
nativeBuildInputs = with llvmPackages; [
|
|
|
|
llvm
|
|
|
|
clang
|
|
|
|
installShellFiles
|
|
|
|
];
|
2021-04-29 21:56:38 +01:00
|
|
|
buildInputs = [ sqlite ] ++ lib.optionals stdenv.isDarwin [ Security libiconv ];
|
2021-04-26 19:04:25 +01:00
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
2021-04-26 19:04:25 +01:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installManPage doc/innernet-server.8.gz
|
|
|
|
installManPage doc/innernet.8.gz
|
2021-06-01 19:38:30 +01:00
|
|
|
installShellCompletion doc/innernet.completions.{bash,fish,zsh}
|
|
|
|
installShellCompletion doc/innernet-server.completions.{bash,fish,zsh}
|
2021-04-26 19:04:25 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
if [[ "$("$out/bin/${pname}"-server --version)" == "${pname}-server ${version}" ]]; then
|
|
|
|
echo '${pname}-server smoke check passed'
|
|
|
|
else
|
|
|
|
echo '${pname}-server smoke check failed'
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if [[ "$("$out/bin/${pname}" --version)" == "${pname} ${version}" ]]; then
|
|
|
|
echo '${pname} smoke check passed'
|
|
|
|
else
|
|
|
|
echo '${pname} smoke check failed'
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
'';
|
2021-04-19 03:33:03 +01: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 ];
|
|
|
|
};
|
|
|
|
}
|