mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-12 07:40:30 -08:00
re-format flake.nix
This commit is contained in:
101
flake.nix
101
flake.nix
@@ -64,56 +64,59 @@
|
|||||||
];
|
];
|
||||||
# a function to generate a nix derivation for rosenpass against any
|
# a function to generate a nix derivation for rosenpass against any
|
||||||
# given set of nixpkgs
|
# given set of nixpkgs
|
||||||
rpDerivation = p: let
|
rpDerivation = p:
|
||||||
isStatic = p.stdenv.hostPlatform.isStatic;
|
let
|
||||||
in p.rustPlatform.buildRustPackage {
|
isStatic = p.stdenv.hostPlatform.isStatic;
|
||||||
# metadata and source
|
in
|
||||||
pname = cargoToml.package.name;
|
p.rustPlatform.buildRustPackage {
|
||||||
version = cargoToml.package.version;
|
# metadata and source
|
||||||
inherit src;
|
pname = cargoToml.package.name;
|
||||||
cargoLock = {
|
version = cargoToml.package.version;
|
||||||
lockFile = src + "/Cargo.lock";
|
inherit src;
|
||||||
|
cargoLock = {
|
||||||
|
lockFile = src + "/Cargo.lock";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake # for oqs build in the oqs-sys crate
|
||||||
|
makeWrapper # for the rp shellscript
|
||||||
|
pkg-config # let libsodium-sys-stable find libsodium
|
||||||
|
removeReferencesTo
|
||||||
|
rustPlatform.bindgenHook # for C-bindings in the crypto libs
|
||||||
|
];
|
||||||
|
buildInputs = with p; [ bash libsodium ];
|
||||||
|
|
||||||
|
# otherwise pkg-config tries to link non-existent dynamic libs
|
||||||
|
PKG_CONFIG_ALL_STATIC = true;
|
||||||
|
|
||||||
|
# nix defaults to building for aarch64 _without_ the armv8-a
|
||||||
|
# crypto extensions, but liboqs depens on these
|
||||||
|
preBuild =
|
||||||
|
if system == "aarch64-linux" then ''
|
||||||
|
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -march=armv8-a+crypto"
|
||||||
|
'' else "";
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
install -D rp $out/bin/rp
|
||||||
|
wrapProgram $out/bin/rp --prefix PATH : "${ rpBinPath p }"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# nix progated the *.dev outputs of buildInputs for static
|
||||||
|
# builds, but that is non-sense for an executables only package
|
||||||
|
postFixup =
|
||||||
|
if isStatic then ''
|
||||||
|
remove-references-to -t ${p.bash.dev} -t ${p.libsodium.dev} \
|
||||||
|
$out/nix-support/propagated-build-inputs
|
||||||
|
'' else "";
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
description = "Post-quantum crypto frontend for WireGuard";
|
||||||
|
license = with licenses; [ mit asl20 ];
|
||||||
|
maintainers = [ maintainers.wucke13 ];
|
||||||
|
homepage = "https://rosenpass.eu/";
|
||||||
|
platforms = platforms.all;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
cmake # for oqs build in the oqs-sys crate
|
|
||||||
makeWrapper # for the rp shellscript
|
|
||||||
pkg-config # let libsodium-sys-stable find libsodium
|
|
||||||
removeReferencesTo
|
|
||||||
rustPlatform.bindgenHook # for C-bindings in the crypto libs
|
|
||||||
];
|
|
||||||
buildInputs = with p; [ bash libsodium ];
|
|
||||||
|
|
||||||
# otherwise pkg-config tries to link non-existent dynamic libs
|
|
||||||
PKG_CONFIG_ALL_STATIC = true;
|
|
||||||
|
|
||||||
# nix defaults to building for aarch64 _without_ the armv8-a
|
|
||||||
# crypto extensions, but liboqs depens on these
|
|
||||||
preBuild =
|
|
||||||
if system == "aarch64-linux" then ''
|
|
||||||
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -march=armv8-a+crypto"
|
|
||||||
'' else "";
|
|
||||||
|
|
||||||
preInstall = ''
|
|
||||||
install -D rp $out/bin/rp
|
|
||||||
wrapProgram $out/bin/rp --prefix PATH : "${ rpBinPath p }"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# nix progated the *.dev outputs of buildInputs for static
|
|
||||||
# builds, but that is non-sense for an executables only package
|
|
||||||
postFixup = if isStatic then ''
|
|
||||||
remove-references-to -t ${p.bash.dev} -t ${p.libsodium.dev} \
|
|
||||||
$out/nix-support/propagated-build-inputs
|
|
||||||
'' else "";
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
description = "Post-quantum crypto frontend for WireGuard";
|
|
||||||
license = with licenses; [ mit asl20 ];
|
|
||||||
maintainers = [ maintainers.wucke13 ];
|
|
||||||
homepage = "https://rosenpass.eu/";
|
|
||||||
platforms = platforms.all;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# a function to generate a docker image based of rosenpass
|
# a function to generate a docker image based of rosenpass
|
||||||
rosenpassOCI = name: pkgs.dockerTools.buildImage rec {
|
rosenpassOCI = name: pkgs.dockerTools.buildImage rec {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|||||||
Reference in New Issue
Block a user