diff options
author | Lorenz Leutgeb <lorenz@leutgeb.xyz> | 2023-10-23 19:29:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-23 19:29:30 +0200 |
commit | cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f (patch) | |
tree | 72f33eb43250d5e71cb6b08d8b23a2379fc2b550 /pkgs/tools/networking/rosenpass | |
parent | 924c682627d1b9779bf9f1455e732c6eac3d3b29 (diff) | |
download | nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar.gz nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar.bz2 nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar.lz nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar.xz nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.tar.zst nixpkgs-cc6c2d32f297744e7ef7848fdf5b1886fa04ba4f.zip |
rosenpass: refactor, add module and test (#254813)
Diffstat (limited to 'pkgs/tools/networking/rosenpass')
-rw-r--r-- | pkgs/tools/networking/rosenpass/default.nix | 72 | ||||
-rw-r--r-- | pkgs/tools/networking/rosenpass/tools.nix | 30 |
2 files changed, 50 insertions, 52 deletions
diff --git a/pkgs/tools/networking/rosenpass/default.nix b/pkgs/tools/networking/rosenpass/default.nix index 07669cfeb01..9467904fe69 100644 --- a/pkgs/tools/networking/rosenpass/default.nix +++ b/pkgs/tools/networking/rosenpass/default.nix @@ -1,85 +1,53 @@ { lib -, targetPlatform , fetchFromGitHub +, nixosTests , rustPlatform +, targetPlatform +, installShellFiles , cmake -, makeWrapper -, pkg-config -, removeReferencesTo -, coreutils -, findutils -, gawk -, wireguard-tools -, bash , libsodium +, pkg-config }: - -let - rpBinPath = lib.makeBinPath [ - coreutils - findutils - gawk - wireguard-tools - ]; -in rustPlatform.buildRustPackage rec { pname = "rosenpass"; - version = "0.2.0"; + version = "unstable-2023-09-28"; + src = fetchFromGitHub { owner = pname; repo = pname; - rev = "v${version}"; - sha256 = "sha256-r7/3C5DzXP+9w4rp9XwbP+/NK1axIP6s3Iiio1xRMbk="; + rev = "b15f17133f8b5c3c5175b4cfd4fc10039a4e203f"; + hash = "sha256-UXAkmt4VY0irLK2k4t6SW+SEodFE3CbX5cFbsPG0ZCo="; }; - cargoHash = "sha256-g2w3lZXQ3Kg3ydKdFs8P2lOPfIkfTbAF0MhxsJoX/E4="; + cargoHash = "sha256-N1DQHkgKgkDQ6DbgQJlpZkZ7AMTqX3P8R/cWr14jK2I="; nativeBuildInputs = [ cmake # for oqs build in the oqs-sys crate - makeWrapper # for the rp shellscript - pkg-config # let libsodium-sys-stable find libsodium - removeReferencesTo + pkg-config rustPlatform.bindgenHook # for C-bindings in the crypto libs + installShellFiles ]; - buildInputs = [ - bash # for patchShebangs to find it - libsodium - ]; - - # otherwise pkg-config tries to link non-existent dynamic libs during the build of liboqs - PKG_CONFIG_ALL_STATIC = true; - - # liboqs requires quite a lot of stack memory, thus we adjust the default stack size picked for - # new threads (which is used by `cargo test`) to be _big enough_ - RUST_MIN_STACK = 8 * 1024 * 1024; # 8 MiB + buildInputs = [ libsodium ]; # nix defaults to building for aarch64 _without_ the armv8-a # crypto extensions, but liboqs depends on these - preBuild = lib.optionalString targetPlatform.isAarch - ''NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -march=armv8-a+crypto"''; - - preInstall = '' - install -D rp $out/bin/rp - wrapProgram $out/bin/rp --prefix PATH : "${ rpBinPath }" - for file in doc/*.1 - do - install -D $file $out/share/man/man1/''${file##*/} - done + preBuild = lib.optionalString targetPlatform.isAarch64 '' + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -march=armv8-a+crypto" ''; - # nix propagates the *.dev outputs of buildInputs for static builds, but that is non-sense for an - # executables only package - postFixup = '' - find -type f -exec remove-references-to -t ${bash.dev} \ - -t ${libsodium.dev} {} \; + postInstall = '' + installManPage doc/rosenpass.1 ''; + passthru.tests.rosenpass = nixosTests.rosenpass; + 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 ]; - platforms = platforms.all; + platforms = [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ]; + mainProgram = "rosenpass"; }; } diff --git a/pkgs/tools/networking/rosenpass/tools.nix b/pkgs/tools/networking/rosenpass/tools.nix new file mode 100644 index 00000000000..fb59436b381 --- /dev/null +++ b/pkgs/tools/networking/rosenpass/tools.nix @@ -0,0 +1,30 @@ +{ lib +, stdenv +, makeWrapper +, installShellFiles +, coreutils +, findutils +, gawk +, rosenpass +, wireguard-tools +}: +stdenv.mkDerivation { + inherit (rosenpass) version src; + pname = "rosenpass-tools"; + + nativeBuildInputs = [ makeWrapper installShellFiles ]; + + postInstall = '' + install -D $src/rp $out/bin/rp + installManPage $src/doc/rp.1 + wrapProgram $out/bin/rp \ + --prefix PATH : ${lib.makeBinPath [ + coreutils findutils gawk rosenpass wireguard-tools + ]} + ''; + + meta = rosenpass.meta // { + description = "This package contains the Rosenpass tool `rp`, which is a script that wraps the `rosenpass` binary."; + mainProgram = "rp"; + }; +} |