2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2023-11-16 04:20:00 +00:00
|
|
|
, nixosTests
|
2023-10-09 19:29:22 +00:00
|
|
|
, rustPlatform
|
2023-11-16 04:20:00 +00:00
|
|
|
, targetPlatform
|
|
|
|
, installShellFiles
|
2023-10-09 19:29:22 +00:00
|
|
|
, cmake
|
|
|
|
, libsodium
|
2023-11-16 04:20:00 +00:00
|
|
|
, pkg-config
|
2023-10-09 19:29:22 +00:00
|
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rosenpass";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "unstable-2023-09-28";
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2023-11-16 04:20:00 +00:00
|
|
|
rev = "b15f17133f8b5c3c5175b4cfd4fc10039a4e203f";
|
|
|
|
hash = "sha256-UXAkmt4VY0irLK2k4t6SW+SEodFE3CbX5cFbsPG0ZCo=";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
cargoHash = "sha256-N1DQHkgKgkDQ6DbgQJlpZkZ7AMTqX3P8R/cWr14jK2I=";
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake # for oqs build in the oqs-sys crate
|
2023-11-16 04:20:00 +00:00
|
|
|
pkg-config
|
2023-10-09 19:29:22 +00:00
|
|
|
rustPlatform.bindgenHook # for C-bindings in the crypto libs
|
2023-11-16 04:20:00 +00:00
|
|
|
installShellFiles
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [ libsodium ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
# nix defaults to building for aarch64 _without_ the armv8-a
|
|
|
|
# crypto extensions, but liboqs depends on these
|
2023-11-16 04:20:00 +00:00
|
|
|
preBuild = lib.optionalString targetPlatform.isAarch64 ''
|
|
|
|
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -march=armv8-a+crypto"
|
2023-10-09 19:29:22 +00:00
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postInstall = ''
|
|
|
|
installManPage doc/rosenpass.1
|
2023-10-09 19:29:22 +00:00
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.tests.rosenpass = nixosTests.rosenpass;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Build post-quantum-secure VPNs with WireGuard!";
|
|
|
|
homepage = "https://rosenpass.eu/";
|
|
|
|
license = with licenses; [ mit /* or */ asl20 ];
|
|
|
|
maintainers = with maintainers; [ wucke13 ];
|
2023-11-16 04:20:00 +00:00
|
|
|
platforms = [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ];
|
|
|
|
mainProgram = "rosenpass";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
}
|