Skip to content

Instantly share code, notes, and snippets.

@hlandau
Last active November 7, 2023 14:00
Show Gist options
  • Save hlandau/189646452245f4929df396b01971d3ba to your computer and use it in GitHub Desktop.
Save hlandau/189646452245f4929df396b01971d3ba to your computer and use it in GitHub Desktop.
NixOS package for OpenSSL committers
{ config, pkgs, ... }:
let
stdenv = pkgs.stdenv;
URIEncode = pkgs.perlPackages.buildPerlPackage {
pname = "URI-Encode";
version = "1.1.1";
src = pkgs.fetchurl {
url = "mirror://cpan/authors/id/M/MI/MITHUN/URI-Encode-v1.1.1.tar.gz";
sha256 = "0fr410f2hiscm9dv85fwr2hyz1jjb445ady2z6617h0nf17cxfab";
};
meta = {
license = with pkgs.lib.licenses; [ artistic1 gpl1Plus ];
};
};
perl = pkgs.perl.withPackages(p: [
p.Moo p.LWPUserAgent
p.URI URIEncode
p.LWPProtocolHttps
p.Clone p.YAMLLibYAML # for QueryApp
]);
workPath = "/home/hugo/work/ossl";
dataPath = "${workPath}/data";
toolsPath = "${workPath}/tools";
omcToolsPath = "${workPath}/omc-tools";
scriptFor = name: pkgs.writeShellScript name ''
export PATH="${perl}/bin:@SELF_PATH@:$PATH"
export DATA="${dataPath}"
export GITADDREV="${toolsPath}/review-tools/gitaddrev"
PERL5LIB="${omcToolsPath}/OpenSSL-Query/lib:${omcToolsPath}/QueryApp/lib" exec \
"${perl}/bin/perl" "${toolsPath}/review-tools/${name}" "$@"
'';
in {
config.home.packages = [ (stdenv.mkDerivation rec {
name = "ossl-tools";
addrev = scriptFor "addrev";
ghmerge = scriptFor "ghmerge";
pickToBranch = scriptFor "pick-to-branch";
builder = pkgs.writeShellScript "builder.sh" ''
"${pkgs.coreutils}/bin/mkdir" -p "$out/bin"
"${pkgs.coreutils}/bin/cp" "$addrev" "$out/bin/addrev"
"${pkgs.coreutils}/bin/cp" "$ghmerge" "$out/bin/ghmerge"
"${pkgs.coreutils}/bin/cp" "$pickToBranch" "$out/bin/pick-to-branch"
for x in $out/bin/*; do
"${pkgs.gnused}/bin/sed" -i "s#@SELF_PATH@#$out#" "$x"
done
'';
}) ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment