mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 05:31:22 +00:00
dadc7eb329
Whenever we create scripts that are installed to $out, we must use runtimeShell in order to get the shell that can be executed on the machine we create the package for. This is relevant for cross-compiling. The only use case for stdenv.shell are scripts that are executed as part of the build system. Usages in checkPhase are borderline however to decrease the likelyhood of people copying the wrong examples, I decided to use runtimeShell as well.
41 lines
1 KiB
Nix
41 lines
1 KiB
Nix
{ stdenv, fetchFromGitHub, openssl, runtimeShell }:
|
|
|
|
let
|
|
version = "3.0.0";
|
|
in stdenv.mkDerivation rec {
|
|
name = "easyrsa-${version}";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "OpenVPN";
|
|
repo = "easy-rsa";
|
|
rev = "v${version}";
|
|
sha256 = "0wbdv3wmqwm5680rpb971l56xiw49adpicqshk3vhfmpvqzl4dbs";
|
|
};
|
|
|
|
patches = [ ./fix-paths.patch ];
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/share/easyrsa
|
|
cp -r easyrsa3/{openssl*.cnf,x509-types,vars.example} $out/share/easyrsa
|
|
install -D -m755 easyrsa3/easyrsa $out/bin/easyrsa
|
|
substituteInPlace $out/bin/easyrsa \
|
|
--subst-var out \
|
|
--subst-var-by openssl ${openssl.bin}/bin/openssl
|
|
|
|
# Helper utility
|
|
cat > $out/bin/easyrsa-init <<EOF
|
|
#!${runtimeShell} -e
|
|
cp -r $out/share/easyrsa/* .
|
|
EOF
|
|
chmod +x $out/bin/easyrsa-init
|
|
'';
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "Simple shell based CA utility";
|
|
homepage = https://openvpn.net/;
|
|
license = licenses.gpl2;
|
|
maintainers = [ maintainers.offline ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|