summaryrefslogtreecommitdiff
path: root/trivionomicon/modules/athena-bccr
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-08-24 15:48:29 -0600
committerAlejandro Soto <alejandro@34project.org>2025-08-24 15:48:29 -0600
commitecab16d635554150627403675642d5603ef64cc6 (patch)
treef94619061973fc0a5fd6097e27e80a5dde627fda /trivionomicon/modules/athena-bccr
parent0e11a692f223b268ca0d208b0ebf48c80caddfb6 (diff)
parent53a923158861a9c52b86f37d826c3f4637476dfa (diff)
Add 'trivionomicon/' from commit 'c651b8c4706cfc750303db12ae19e58164a6bebb'
git-subtree-dir: trivionomicon git-subtree-mainline: 02d3ab9583983e823909020c34b9d5a6894fb773 git-subtree-split: c651b8c4706cfc750303db12ae19e58164a6bebb
Diffstat (limited to 'trivionomicon/modules/athena-bccr')
-rw-r--r--trivionomicon/modules/athena-bccr/default.nix14
-rw-r--r--trivionomicon/modules/athena-bccr/hm.nix14
-rw-r--r--trivionomicon/modules/athena-bccr/options.nix30
-rw-r--r--trivionomicon/modules/athena-bccr/sys.nix35
4 files changed, 93 insertions, 0 deletions
diff --git a/trivionomicon/modules/athena-bccr/default.nix b/trivionomicon/modules/athena-bccr/default.nix
new file mode 100644
index 0000000..93c5660
--- /dev/null
+++ b/trivionomicon/modules/athena-bccr/default.nix
@@ -0,0 +1,14 @@
+{
+ config,
+ lib,
+ pkgs,
+ doctrine,
+ ...
+}:
+doctrine.lib.mkModule {
+ inherit config;
+ name = "athena-bccr";
+ hm = ./hm.nix;
+ sys = ./sys.nix;
+ options = ./options.nix;
+}
diff --git a/trivionomicon/modules/athena-bccr/hm.nix b/trivionomicon/modules/athena-bccr/hm.nix
new file mode 100644
index 0000000..0678e3c
--- /dev/null
+++ b/trivionomicon/modules/athena-bccr/hm.nix
@@ -0,0 +1,14 @@
+{
+ pkgs,
+ lib,
+ cfg,
+ doctrine,
+ ...
+}: let
+ athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
+in {
+ home.packages = [
+ athena.firmador
+ (athena.gaudi.override {inherit (cfg) gaudiHash;})
+ ];
+}
diff --git a/trivionomicon/modules/athena-bccr/options.nix b/trivionomicon/modules/athena-bccr/options.nix
new file mode 100644
index 0000000..eb61cf5
--- /dev/null
+++ b/trivionomicon/modules/athena-bccr/options.nix
@@ -0,0 +1,30 @@
+{lib, ...}:
+with lib.types; {
+ hm = {
+ gaudiHash = lib.mkOption {
+ type = nullOr str;
+ default = null;
+ description = "hash of the Gaudi client";
+ };
+
+ release = lib.mkOption {
+ type = str;
+ default = "latest";
+ description = "pinned athena-bccr release tag";
+ };
+ };
+
+ sys = {
+ group = lib.mkOption {
+ type = str;
+ default = "users";
+ description = "user group with full access to the smartcard reader";
+ };
+
+ release = lib.mkOption {
+ type = str;
+ default = "latest";
+ description = "pinned athena-bccr release tag";
+ };
+ };
+}
diff --git a/trivionomicon/modules/athena-bccr/sys.nix b/trivionomicon/modules/athena-bccr/sys.nix
new file mode 100644
index 0000000..631185d
--- /dev/null
+++ b/trivionomicon/modules/athena-bccr/sys.nix
@@ -0,0 +1,35 @@
+{
+ pkgs,
+ lib,
+ cfg,
+ doctrine,
+ ...
+}: let
+ athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
+in {
+ environment = {
+ etc = {
+ "Athena".source = "${athena.ase-pkcs11}/etc/Athena";
+
+ "pkcs11/modules/asep11".text = ''
+ module: ${athena.libasep11}
+ '';
+ };
+
+ systemPackages = [athena.ase-pkcs11];
+ };
+
+ #FIXME: Extremadamente peligroso si BCCR o MICITT caen, investigar polĂ­tica nacional de root CA
+ security.pki.certificateFiles = ["${athena.bccr-cacerts}/root-ca.pem"];
+
+ services = {
+ pcscd.enable = true;
+
+ udev.extraRules = ''
+ # Athena Smartcard Solutions, Inc. ASEDrive V3CR
+ ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="${cfg.group}", TAG+="uaccess"
+ '';
+ };
+
+ users.groups.${cfg.group} = {};
+}