Skip to content

Commit

Permalink
feat: aarch64-linux support for AutoFirma (#108)
Browse files Browse the repository at this point in the history
- Add aarch64-linux AutoFirma package and checks to the flake.
- Add support to AutoFirma to load NSS in aarch64-linux with a patch until ctt-gob-es/clienteafirma#435 gets merged upstream
  • Loading branch information
nilp0inter authored Jan 31, 2025
1 parent 0017e7e commit 9eae74b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 30 deletions.
60 changes: 30 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,39 @@
dnieremote = pkgs.callPackage ./nix/dnieremote/default.nix {openssl_1_1 = ignoreVulnerable_openssl_1_1;};
configuradorfnmt = pkgs.callPackage ./nix/configuradorfnmt/default.nix {};
};
checks.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
# NiXOS Modules
## Configurador FNMT-RCM
nixos-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/nixos/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self; };
##DNIe Remote
nixos-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-wifi.nix { inherit self; };
nixos-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-usb.nix { inherit self; };
nixos-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-no.nix { inherit self; };
nixos-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/wifiport.nix { inherit self; };
# Home Manager Modules
## HM installed as a NixOS Module
### Configurador FNMT-RCM
hm-as-nixos-module-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/hm-as-nixos-module/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self home-manager; };
### DNIe Remote
hm-as-nixos-module-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-wifi.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-usb.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-no.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/wifiport.nix { inherit self home-manager; };
## HM standalone installation
### Configurador FNMT-RCM
hm-standalone-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/hm-standalone/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self home-manager; };
### DNIe Remote
hm-standalone-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-wifi.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-usb.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-no.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/wifiport.nix { inherit self home-manager; };
};
};
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = [
inputs.flake-parts.flakeModules.easyOverlay
Expand Down Expand Up @@ -178,15 +208,6 @@
nixos-autofirma-firefoxIntegration-connection-method-websocket = pkgs.callPackage ./nix/tests/nixos/autofirma/firefoxIntegration/connection-method/websocket { inherit self; };
nixos-autofirma-firefoxIntegration-connection-method-xhr = pkgs.callPackage ./nix/tests/nixos/autofirma/firefoxIntegration/connection-method/xhr { inherit self; };
nixos-autofirma-firefoxIntegration-connection-method-auxiliary-servers = pkgs.callPackage ./nix/tests/nixos/autofirma/firefoxIntegration/connection-method/auxiliary-servers { inherit self; };

## Configurador FNMT-RCM
nixos-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/nixos/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self; };
##DNIe Remote
nixos-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-wifi.nix { inherit self; };
nixos-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-usb.nix { inherit self; };
nixos-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/jumpintro-no.nix { inherit self; };
nixos-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/nixos/dnieremote/config/wifiport.nix { inherit self; };

# Home Manager Modules
## HM installed as a NixOS Module
### AutoFirma
Expand All @@ -195,36 +216,15 @@
hm-as-nixos-module-autofirma-firefoxIntegration-connection-method-websocket = pkgs.callPackage ./nix/tests/hm-as-nixos-module/autofirma/firefoxIntegration/connection-method/websocket { inherit self home-manager; };
hm-as-nixos-module-autofirma-firefoxIntegration-connection-method-xhr = pkgs.callPackage ./nix/tests/hm-as-nixos-module/autofirma/firefoxIntegration/connection-method/xhr { inherit self home-manager; };
hm-as-nixos-module-autofirma-firefoxIntegration-connection-method-auxiliary-servers = pkgs.callPackage ./nix/tests/hm-as-nixos-module/autofirma/firefoxIntegration/connection-method/auxiliary-servers { inherit self home-manager; };

### Configurador FNMT-RCM
hm-as-nixos-module-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/hm-as-nixos-module/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self home-manager; };

### DNIe Remote
hm-as-nixos-module-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-wifi.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-usb.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/jumpintro-no.nix { inherit self home-manager; };
hm-as-nixos-module-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/hm-as-nixos-module/dnieremote/config/wifiport.nix { inherit self home-manager; };

# HM standalone installation
### AutoFirma
hm-standalone-autofirma-cli-sign-document = pkgs.callPackage ./nix/tests/hm-standalone/autofirma/cli/sign-document.nix { inherit self home-manager; };
hm-standalone-autofirma-firefoxIntegration-protocol-handler = pkgs.callPackage ./nix/tests/hm-standalone/autofirma/firefoxIntegration/protocol-handler { inherit self home-manager; };
hm-standalone-autofirma-firefoxIntegration-connection-method-websocket = pkgs.callPackage ./nix/tests/hm-standalone/autofirma/firefoxIntegration/connection-method/websocket { inherit self home-manager; };
hm-standalone-autofirma-firefoxIntegration-connection-method-xhr = pkgs.callPackage ./nix/tests/hm-standalone/autofirma/firefoxIntegration/connection-method/xhr { inherit self home-manager; };
hm-standalone-autofirma-firefoxIntegration-connection-method-auxiliary-servers = pkgs.callPackage ./nix/tests/hm-standalone/autofirma/firefoxIntegration/connection-method/auxiliary-servers { inherit self home-manager; };

### Configurador FNMT-RCM
hm-standalone-configuradorfnmt-firefoxIntegration-request = pkgs.callPackage ./nix/tests/hm-standalone/configuradorfnmt/firefoxIntegration/request-certificate.nix { inherit self home-manager; };

### DNIe Remote
hm-standalone-dnieremote-config-jumpintro-wifi = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-wifi.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-jumpintro-usb = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-usb.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-jumpintro-no = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/jumpintro-no.nix { inherit self home-manager; };
hm-standalone-dnieremote-config-wifiport = pkgs.callPackage ./nix/tests/hm-standalone/dnieremote/config/wifiport.nix { inherit self home-manager; };

# Overlay
overlay = pkgs.callPackage ./nix/tests/overlay { inherit self; };

};
in
checks // packages;
Expand Down
1 change: 1 addition & 0 deletions nix/autofirma/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
./patches/clienteafirma/pr-367.patch
./patches/clienteafirma/certutilpath.patch
./patches/clienteafirma/etc_config.patch
./patches/clienteafirma/aarch64_elf.patch # Until https://github.com/ctt-gob-es/clienteafirma/pull/435 gets merged
]
++ (lib.optional disableJavaVersionCheck [
./patches/clienteafirma/dont_check_java_version.patch
Expand Down
16 changes: 16 additions & 0 deletions nix/autofirma/patches/clienteafirma/aarch64_elf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/afirma-keystores-mozilla/src/main/java/es/gob/afirma/keystores/mozilla/bintutil/ElfParser.java b/afirma-keystores-mozilla/src/main/java/es/gob/afirma/keystores/mozilla/bintutil/ElfParser.java
index ae1f04d97..897b662d9 100644
--- a/afirma-keystores-mozilla/src/main/java/es/gob/afirma/keystores/mozilla/bintutil/ElfParser.java
+++ b/afirma-keystores-mozilla/src/main/java/es/gob/afirma/keystores/mozilla/bintutil/ElfParser.java
@@ -139,8 +139,10 @@ public final class ElfParser {
return false;
}
return "64".equals(Platform.getJavaArch()) && //$NON-NLS-1$
- Platform.MACHINE.AMD64.equals(Platform.getMachineType()) &&
+ (Platform.MACHINE.AMD64.equals(Platform.getMachineType()) &&
ElfMachineType.AMD64.equals(a) ||
+ Platform.MACHINE.ARM64.equals(Platform.getMachineType()) &&
+ ElfMachineType.ARM64.equals(a)) ||
"32".equals(Platform.getJavaArch()) && //$NON-NLS-1$
(Platform.MACHINE.X86.equals(Platform.getMachineType()) || Platform.MACHINE.AMD64.equals(Platform.getMachineType())) && // 32 puede estar en maquina de 32 o de 64 bits
ElfMachineType.X86.equals(a);

0 comments on commit 9eae74b

Please sign in to comment.