citrix_receiver: allow custom certs and hooks for the installation

Sometimes it's required to modify some parts of the Citrix build on
their own which is why `{pre,post}Install` hooks can be quite helpful.

Additionally some corporate clients use their own certificates that
aren't stored as trusted ones in the `cacert` package with all of the
trusted certs by Mozilla.

Now it's possible to add custom certs like this:

``` nix
with import <nixpkgs> { config.allowUnfree = true; };

let path = ../../Downloads/custom-corporate-cert.pem; in
citrix_receiver.override {
  extraCerts = [ path ];
}
```
This commit is contained in:
Maximilian Bosch
2018-08-06 15:16:16 +02:00
parent cc1d82196c
commit 10b2208ec5
3 changed files with 62 additions and 11 deletions
@@ -156,7 +156,7 @@ let
'';
};
phases = [ "unpackPhase" "installPhase" ];
dontBuild = true;
sourceRoot = ".";
@@ -203,6 +203,8 @@ let
};
installPhase = ''
runHook preInstall
export ICAInstDir="$out/opt/citrix-icaclient"
sed -i \
@@ -262,13 +264,15 @@ let
# We introduce a dependency on the source file so that it need not be redownloaded everytime
echo $src >> "$out/share/nix_dependencies.pin"
runHook postInstall
'';
meta = with stdenv.lib; {
license = stdenv.lib.licenses.unfree;
inherit homepage;
description = "Citrix Receiver";
maintainers = with maintainers; [ obadz a1russell ];
maintainers = with maintainers; [ obadz a1russell ma27 ];
platforms = platforms.linux;
};
};
@@ -0,0 +1,19 @@
{ citrix_receiver, extraCerts ? [], symlinkJoin }:
let
mkCertCopy = certPath:
"cp ${certPath} $out/opt/citrix-icaclient/keystore/cacerts/";
in
if builtins.length extraCerts == 0 then citrix_receiver else symlinkJoin {
name = "citrix-with-extra-certs-${citrix_receiver.version}";
paths = [ citrix_receiver ];
postBuild = ''
${builtins.concatStringsSep "\n" (map mkCertCopy extraCerts)}
sed -i -E "s,-icaroot (.+citrix-icaclient),-icaroot $out/opt/citrix-icaclient," $out/bin/wfica
'';
}