Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 70 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 sqlite, 7 installShellFiles, 8 libiconv, 9 innernet, 10 testers, 11}: 12 13rustPlatform.buildRustPackage rec { 14 pname = "innernet"; 15 version = "1.6.1"; 16 17 src = fetchFromGitHub { 18 owner = "tonarino"; 19 repo = "innernet"; 20 tag = "v${version}"; 21 hash = "sha256-dFMAzLvPO5xAfJqUXdiLf13uh5H5ay+CI9aop7Fhprk="; 22 }; 23 24 cargoHash = "sha256-gTFvxmnh+d1pNqG0sEHFpl0m9KKCQ78sai//iiJ0aGs="; 25 26 nativeBuildInputs = [ 27 rustPlatform.bindgenHook 28 installShellFiles 29 ]; 30 31 buildInputs = [ 32 sqlite 33 ] 34 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 35 libiconv 36 ]; 37 38 postInstall = '' 39 installManPage doc/innernet-server.8.gz 40 installManPage doc/innernet.8.gz 41 installShellCompletion doc/innernet.completions.{bash,fish,zsh} 42 installShellCompletion doc/innernet-server.completions.{bash,fish,zsh} 43 '' 44 + (lib.optionalString stdenv.hostPlatform.isLinux '' 45 find . -regex '.*\.\(target\|service\)' | xargs install -Dt $out/lib/systemd/system 46 find $out/lib/systemd/system -type f | xargs sed -i "s|/usr/bin/innernet|$out/bin/innernet|" 47 ''); 48 49 passthru.tests = { 50 serverVersion = testers.testVersion { 51 package = innernet; 52 command = "innernet-server --version"; 53 }; 54 version = testers.testVersion { 55 package = innernet; 56 command = "innernet --version"; 57 }; 58 }; 59 60 meta = { 61 description = "Private network system that uses WireGuard under the hood"; 62 homepage = "https://github.com/tonarino/innernet"; 63 changelog = "https://github.com/tonarino/innernet/releases/tag/v${version}"; 64 license = lib.licenses.mit; 65 maintainers = with lib.maintainers; [ 66 tomberek 67 _0x4A6F 68 ]; 69 }; 70}