summaryrefslogtreecommitdiff
path: root/pkgs/athena-bccr
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/athena-bccr')
-rw-r--r--pkgs/athena-bccr/default.nix46
-rw-r--r--pkgs/athena-bccr/firmador.nix85
-rw-r--r--pkgs/athena-bccr/gaudi-env.nix97
-rw-r--r--pkgs/athena-bccr/unwrapped.nix157
4 files changed, 193 insertions, 192 deletions
diff --git a/pkgs/athena-bccr/default.nix b/pkgs/athena-bccr/default.nix
index a5f79ca..f9276c1 100644
--- a/pkgs/athena-bccr/default.nix
+++ b/pkgs/athena-bccr/default.nix
@@ -1,30 +1,32 @@
-{
- callPackage,
- lib,
-}: let
+{ callPackage
+, lib
+}:
+let
latest = "deb64-rev26";
- releases = lib.mapAttrs (name: release: release // {name = name;}) (import ./releases.nix);
+ releases = lib.mapAttrs (name: release: release // { name = name; }) (import ./releases.nix);
- overrideUnwrapped = default: new: let
- args = default // new;
- unwrappedPkgs = lib.filterAttrs (name: _: ! lib.elem name ["override" "overrideDerivation"]) (callPackage ./unwrapped.nix args);
- in
- lib.fix (unwrapped: lib.mapAttrs (_: pkg: callPackage pkg unwrapped) unwrappedPkgs)
- // {
+ overrideUnwrapped = default: new:
+ let
+ args = default // new;
+ unwrappedPkgs = lib.filterAttrs (name: _: ! lib.elem name [ "override" "overrideDerivation" ]) (callPackage ./unwrapped.nix args);
+ in
+ lib.fix (unwrapped: lib.mapAttrs (_: pkg: callPackage pkg unwrapped) unwrappedPkgs) // {
override = overrideUnwrapped args;
};
- pkgsForRelease = release: let
- ase-pkcs11 = unwrapped.ase-idprotect.lib;
- libasep11 = "${ase-pkcs11}/lib/x64-athena/libASEP11.so";
- unwrapped = overrideUnwrapped {inherit release;} {};
- in {
- inherit ase-pkcs11 libasep11;
- inherit (unwrapped) ase-idprotect bccr-cacerts;
+ pkgsForRelease = release:
+ let
+ ase-pkcs11 = unwrapped.ase-idprotect.lib;
+ libasep11 = "${ase-pkcs11}/lib/x64-athena/libASEP11.so";
+ unwrapped = overrideUnwrapped { inherit release; } { };
+ in
+ {
+ inherit ase-pkcs11 libasep11;
+ inherit (unwrapped) ase-idprotect bccr-cacerts;
- gaudi = callPackage ./gaudi-env.nix {inherit unwrapped;};
- firmador = callPackage ./firmador.nix {inherit libasep11;};
- };
+ gaudi = callPackage ./gaudi-env.nix { inherit unwrapped; };
+ firmador = callPackage ./firmador.nix { inherit libasep11; };
+ };
in
- lib.mapAttrs (_: pkgsForRelease) (releases // {latest = releases.${latest};})
+lib.mapAttrs (_: pkgsForRelease) (releases // { latest = releases.${latest}; })
diff --git a/pkgs/athena-bccr/firmador.nix b/pkgs/athena-bccr/firmador.nix
index d280b56..eef413b 100644
--- a/pkgs/athena-bccr/firmador.nix
+++ b/pkgs/athena-bccr/firmador.nix
@@ -1,57 +1,58 @@
-{
- fetchgit,
- lib,
- makeWrapper,
- maven,
- openjdk,
- wrapGAppsHook,
- libasep11 ? null,
-}: let
+{ fetchgit
+, lib
+, makeWrapper
+, maven
+, openjdk
+, wrapGAppsHook
+
+, libasep11 ? null
+}:
+let
jdk = openjdk.override {
enableJavaFX = true;
};
version = "1.9.8";
in
- maven.buildMavenPackage {
- pname = "firmador";
- inherit version;
-
- src = fetchgit {
- url = "https://codeberg.org/firmador/firmador";
- rev = version;
- hash = "sha256-xdiVPjihRADPK4nG+WQHWsDzVYLCeN6ouQ6SDtjf1qQ=";
- };
+maven.buildMavenPackage {
+ pname = "firmador";
+ inherit version;
+
+ src = fetchgit {
+ url = "https://codeberg.org/firmador/firmador";
+ rev = version;
+ hash = "sha256-xdiVPjihRADPK4nG+WQHWsDzVYLCeN6ouQ6SDtjf1qQ=";
+ };
- patches = [
- ./0001-Remove-CheckUpdatePlugin-from-default-list.patch
- ];
+ patches = [
+ ./0001-Remove-CheckUpdatePlugin-from-default-list.patch
+ ];
- mvnHash = "sha256-h1zoStTgaE7toWWKq0Y0ahOORyltChwjmaMYjLgs1VE=";
+ mvnHash = "sha256-h1zoStTgaE7toWWKq0Y0ahOORyltChwjmaMYjLgs1VE=";
- nativeBuildInputs = [
- makeWrapper
- wrapGAppsHook
- ];
+ nativeBuildInputs = [
+ makeWrapper
+ wrapGAppsHook
+ ];
- postPatch = lib.optionalString (libasep11 != null) ''
- sed -i 's@/usr/lib/x64-athena/libASEP11.so@${libasep11}@g' src/main/java/cr/libre/firmador/CRSigner.java
- '';
+ postPatch = lib.optionalString (libasep11 != null) ''
+ sed -i 's@/usr/lib/x64-athena/libASEP11.so@${libasep11}@g' src/main/java/cr/libre/firmador/CRSigner.java
+ '';
- installPhase = ''
- runHook preInstall
+ installPhase = ''
+ runHook preInstall
- mkdir -p $out/bin $out/share/java
- install -Dm644 target/firmador.jar $out/share/java
+ mkdir -p $out/bin $out/share/java
+ install -Dm644 target/firmador.jar $out/share/java
- makeWrapper ${jdk}/bin/java $out/bin/firmador \
- --add-flags "-jar $out/share/java/firmador.jar"
+ makeWrapper ${jdk}/bin/java $out/bin/firmador \
+ --add-flags "-jar $out/share/java/firmador.jar"
- runHook postInstall
- '';
+ runHook postInstall
+ '';
- meta = {
- homepage = "https://firmador.libre.cr";
- license = lib.licenses.gpl3Plus;
- };
- }
+ meta = {
+ homepage = "https://firmador.libre.cr";
+ license = lib.licenses.gpl3Plus;
+ };
+}
diff --git a/pkgs/athena-bccr/gaudi-env.nix b/pkgs/athena-bccr/gaudi-env.nix
index 0ca1b82..1ced54e 100644
--- a/pkgs/athena-bccr/gaudi-env.nix
+++ b/pkgs/athena-bccr/gaudi-env.nix
@@ -1,62 +1,63 @@
-{
- buildFHSEnv,
- curl,
- lib,
- writeShellScriptBin,
- gaudiHash ? null,
- unwrapped,
-}: let
- unwrappedWithGaudi = unwrapped.override {inherit gaudiHash;};
+{ buildFHSEnv
+, curl
+, lib
+, writeShellScriptBin
+
+, gaudiHash ? null
+, unwrapped
+}:
+let
+ unwrappedWithGaudi = unwrapped.override { inherit gaudiHash; };
in
- buildFHSEnv {
- name = "gaudi";
+buildFHSEnv {
+ name = "gaudi";
- targetPkgs = pkgs: [
- unwrappedWithGaudi.ase-idprotect.lib
- unwrappedWithGaudi.gaudi
+ targetPkgs = pkgs: [
+ unwrappedWithGaudi.ase-idprotect.lib
+ unwrappedWithGaudi.gaudi
- (writeShellScriptBin "launch-gaudi" ''
- set -o errexit
- set -o pipefail
- set -o nounset
+ (writeShellScriptBin "launch-gaudi" ''
+ set -o errexit
+ set -o pipefail
+ set -o nounset
- PATH="${lib.makeBinPath [curl]}:$PATH"
+ PATH="${lib.makeBinPath [ curl ]}:$PATH"
- echo "$0: testing for incompatible releases..." >&2
+ echo "$0: testing for incompatible releases..." >&2
- jar_name=bccr-firma-fva-clienteMultiplataforma.jar
- url="https://www.firmadigital.go.cr/Bccr.Firma.Fva.Actualizador.ClienteFirmadorJava//recursosLiberica17/actualizador/$jar_name"
- ca_file="${unwrappedWithGaudi.bccr-cacerts}/root-ca.pem"
- url_hash=$(curl -sS --cacert "$ca_file" "$url" | sha256sum | cut -d' ' -f1)
- jar_path="${unwrappedWithGaudi.gaudi}/share/java/$jar_name"
- jar_hash=$(sha256sum "$jar_path" | cut -d' ' -f1)
+ jar_name=bccr-firma-fva-clienteMultiplataforma.jar
+ url="https://www.firmadigital.go.cr/Bccr.Firma.Fva.Actualizador.ClienteFirmadorJava//recursosLiberica17/actualizador/$jar_name"
+ ca_file="${unwrappedWithGaudi.bccr-cacerts}/root-ca.pem"
+ url_hash=$(curl -sS --cacert "$ca_file" "$url" | sha256sum | cut -d' ' -f1)
+ jar_path="${unwrappedWithGaudi.gaudi}/share/java/$jar_name"
+ jar_hash=$(sha256sum "$jar_path" | cut -d' ' -f1)
- if [ "$url_hash" != "$jar_hash" ]; then
- last_modified=$(curl -sS --head --cacert "$ca_file" "$url" | grep -i '^last-modified:' | head -1)
+ if [ "$url_hash" != "$jar_hash" ]; then
+ last_modified=$(curl -sS --head --cacert "$ca_file" "$url" | grep -i '^last-modified:' | head -1)
- echo "$0: sha256 mismatch for $jar_path due to server-side update" >&2
- echo "$0: expected: $url_hash" >&2
- echo "$0: actual: $jar_hash" >&2
- echo "$0: $last_modified" >&2
- echo "$0: run the following to download the new client JAR, then update your derivation:" >&2
- echo "$0: \$ ${unwrappedWithGaudi.update-gaudi}" >&2
+ echo "$0: sha256 mismatch for $jar_path due to server-side update" >&2
+ echo "$0: expected: $url_hash" >&2
+ echo "$0: actual: $jar_hash" >&2
+ echo "$0: $last_modified" >&2
+ echo "$0: run the following to download the new client JAR, then update your derivation:" >&2
+ echo "$0: \$ ${unwrappedWithGaudi.update-gaudi}" >&2
- exit 1
- fi
+ exit 1
+ fi
- cache_path_1="''${XDG_CACHE_HOME:-$HOME/.cache}/Agente-GAUDI"
- cache_path_2="''${XDG_CACHE_HOME:-$HOME/.cache}/Firmador-BCCR"
+ cache_path_1="''${XDG_CACHE_HOME:-$HOME/.cache}/Agente-GAUDI"
+ cache_path_2="''${XDG_CACHE_HOME:-$HOME/.cache}/Firmador-BCCR"
- for cache_path in "$cache_path_1" "$cache_path_2"; do
- mkdir -p "$cache_path"
- ln -sf -- ${unwrappedWithGaudi.gaudi}/share/java/bccr-firma-fva-clienteMultiplataforma.jar "$cache_path"
- done
+ for cache_path in "$cache_path_1" "$cache_path_2"; do
+ mkdir -p "$cache_path"
+ ln -sf -- ${unwrappedWithGaudi.gaudi}/share/java/bccr-firma-fva-clienteMultiplataforma.jar "$cache_path"
+ done
- cp -f --no-preserve=mode -t "$cache_path_1" -- "${unwrappedWithGaudi.gaudi}/share/java/config.properties"
+ cp -f --no-preserve=mode -t "$cache_path_1" -- "${unwrappedWithGaudi.gaudi}/share/java/config.properties"
- exec gaudi
- '')
- ];
+ exec gaudi
+ '')
+ ];
- runScript = "launch-gaudi";
- }
+ runScript = "launch-gaudi";
+}
diff --git a/pkgs/athena-bccr/unwrapped.nix b/pkgs/athena-bccr/unwrapped.nix
index d6f3f38..55ef107 100644
--- a/pkgs/athena-bccr/unwrapped.nix
+++ b/pkgs/athena-bccr/unwrapped.nix
@@ -1,10 +1,11 @@
-{
- lib,
- requireFile,
- release,
- gaudiHash ? null,
- ...
-}: let
+{ lib
+, requireFile
+
+, release
+, gaudiHash ? null
+, ...
+}:
+let
inherit (release) srcPaths;
src = requireFile {
@@ -14,47 +15,40 @@
inherit (release) hash;
};
- gaudiUpdateSrc = {update-gaudi}:
- requireFile {
- url = "${update-gaudi}";
- name = "gaudi-update-${release.name}.zip";
+ gaudiUpdateSrc = { update-gaudi }: requireFile {
+ url = "${update-gaudi}";
+ name = "gaudi-update-${release.name}.zip";
- hash = gaudiHash;
- };
+ hash = gaudiHash;
+ };
- moduleFromDeb = name: args @ {
- stdenv,
- dpkg,
- unzip,
- srcPath,
- ...
- }:
+ moduleFromDeb = name: args@{ stdenv, dpkg, unzip, srcPath, ... }:
stdenv.mkDerivation ({
- pname = "${name}-unwrapped";
- version = release.name;
-
- inherit src;
-
- nativeBuildInputs = [dpkg unzip] ++ (args.nativeBuildInputs or []);
-
- postUnpack = ''
- dpkg -x ${lib.escapeShellArg "${release.basename}/${srcPath}"} ${lib.escapeShellArg release.basename}
- '';
- }
- // lib.removeAttrs args ["stdenv" "dpkg" "unzip" "srcPath" "nativeBuildInputs"]);
-in {
- ase-idprotect = {
- autoPatchelfHook,
- dpkg,
- fontconfig,
- freetype,
- pcsclite,
- stdenv,
- unzip,
- xorg,
- zlib,
- ...
- }:
+ pname = "${name}-unwrapped";
+ version = release.name;
+
+ inherit src;
+
+ nativeBuildInputs = [ dpkg unzip ] ++ (args.nativeBuildInputs or [ ]);
+
+ postUnpack = ''
+ dpkg -x ${lib.escapeShellArg "${release.basename}/${srcPath}"} ${lib.escapeShellArg release.basename}
+ '';
+ } // lib.removeAttrs args [ "stdenv" "dpkg" "unzip" "srcPath" "nativeBuildInputs" ]);
+in
+{
+ ase-idprotect =
+ { autoPatchelfHook
+ , dpkg
+ , fontconfig
+ , freetype
+ , pcsclite
+ , stdenv
+ , unzip
+ , xorg
+ , zlib
+ , ...
+ }:
moduleFromDeb "ase-idprotect" {
inherit dpkg stdenv unzip;
srcPath = srcPaths.idprotect;
@@ -73,7 +67,7 @@ in {
autoPatchelfHook
];
- outputs = ["out" "lib"];
+ outputs = [ "out" "lib" ];
installPhase = ''
runHook preInstall
@@ -91,26 +85,28 @@ in {
'';
};
- gaudi = {
- autoPatchelfHook,
- dpkg,
- makeWrapper,
- openjdk,
- pkgs,
- stdenv,
- unzip,
- writeShellScriptBin,
- update-gaudi,
- ...
- }: let
- jdk = openjdk.override {
- enableJavaFX = true;
- openjfx_jdk = pkgs."openjfx${lib.head (lib.splitString "." openjdk.version)}".override {withWebKit = true;};
- };
-
- fakeSudo = writeShellScriptBin "sudo" "";
- gaudiUpdate = gaudiUpdateSrc {inherit update-gaudi;};
- in
+ gaudi =
+ { autoPatchelfHook
+ , dpkg
+ , makeWrapper
+ , openjdk
+ , pkgs
+ , stdenv
+ , unzip
+ , writeShellScriptBin
+
+ , update-gaudi
+ , ...
+ }:
+ let
+ jdk = openjdk.override {
+ enableJavaFX = true;
+ openjfx_jdk = pkgs."openjfx${lib.head (lib.splitString "." openjdk.version)}".override { withWebKit = true; };
+ };
+
+ fakeSudo = writeShellScriptBin "sudo" "";
+ gaudiUpdate = gaudiUpdateSrc { inherit update-gaudi; };
+ in
moduleFromDeb "gaudi" {
inherit dpkg stdenv unzip;
srcPath = srcPaths.gaudi;
@@ -163,12 +159,12 @@ in {
'';
};
- bccr-cacerts = {
- openssl,
- stdenv,
- unzip,
- ...
- }:
+ bccr-cacerts =
+ { openssl
+ , stdenv
+ , unzip
+ , ...
+ }:
stdenv.mkDerivation {
pname = "bccr-cacerts";
version = release.name;
@@ -186,13 +182,14 @@ in {
'';
};
- update-gaudi = {
- wget,
- writeShellScript,
- zip,
- bccr-cacerts,
- ...
- }:
+ update-gaudi =
+ { wget
+ , writeShellScript
+ , zip
+
+ , bccr-cacerts
+ , ...
+ }:
writeShellScript "update-gaudi" ''
set -o errexit
set -o pipefail
@@ -202,7 +199,7 @@ in {
trap 'cd / && rm -rf -- "$temp_dir"' EXIT
cd "$temp_dir"
- PATH="${lib.makeBinPath [wget zip]}:$PATH"
+ PATH="${lib.makeBinPath [ wget zip ]}:$PATH"
ca_cert="${bccr-cacerts}/root-ca.pem"
base_url="https://www.firmadigital.go.cr/Bccr.Firma.Fva.Actualizador.ClienteFirmadorJava//recursosLiberica17/actualizador"