2022-04-03 20:46:56 +02:00
|
|
|
# NixOS module to configure the Estonian e-ID software.
|
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.pcscd.enable = true;
|
|
|
|
|
2022-05-23 01:52:51 +02:00
|
|
|
# Tell p11-kit to load/proxy opensc-pkcs11.so, providing all available slots
|
|
|
|
# (PIN1 for authentication/decryption, PIN2 for signing).
|
|
|
|
environment.etc."pkcs11/modules/opensc-pkcs11".text = ''
|
|
|
|
module: ${pkgs.opensc}/lib/opensc-pkcs11.so
|
2022-05-07 21:02:48 +02:00
|
|
|
'';
|
|
|
|
|
2023-04-21 00:04:23 +02:00
|
|
|
# Configure Firefox (in case users set `programs.firefox.enable = true;`)
|
|
|
|
programs.firefox = {
|
|
|
|
# Allow a possibly installed "Web eID" extension to do native messaging with
|
|
|
|
# the "web-eid-app" native component.
|
|
|
|
# Users not using `programs.firefox.enable` can override their firefox
|
|
|
|
# derivation, by setting `extraNativeMessagingHosts = [ pkgs.web-eid-app ]`.
|
|
|
|
nativeMessagingHosts.euwebid = true;
|
|
|
|
# Configure Firefox to load smartcards via p11kit-proxy.
|
|
|
|
# Users not using `programs.firefox.enable` can override their firefox
|
|
|
|
# derivation, by setting
|
|
|
|
# `extraPolicies.SecurityDevices.p11-kit-proxy "${pkgs.p11-kit}/lib/p11-kit-proxy.so"`.
|
|
|
|
policies.SecurityDevices.p11-kit-proxy = "${pkgs.p11-kit}/lib/p11-kit-proxy.so";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Chromium users need a symlink to their (slightly different) .json file
|
|
|
|
# in the native messaging hosts' manifest file location.
|
|
|
|
environment.etc."chromium/native-messaging-hosts/eu.webeid.json".source = "${pkgs.web-eid-app}/share/web-eid/eu.webeid.json";
|
|
|
|
environment.etc."opt/chrome/native-messaging-hosts/eu.webeid.json".source = "${pkgs.web-eid-app}/share/web-eid/eu.webeid.json";
|
|
|
|
|
2022-04-03 20:46:56 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
2023-04-19 01:02:58 +02:00
|
|
|
libdigidocpp.bin # provides digidoc-tool(1)
|
2022-04-03 20:46:56 +02:00
|
|
|
qdigidoc
|
2023-04-21 00:04:23 +02:00
|
|
|
|
|
|
|
# Wrapper script to tell to Chrome/Chromium to use p11-kit-proxy to load
|
|
|
|
# security devices, so they can be used for TLS client auth.
|
|
|
|
# Each user needs to run this themselves, it does not work on a system level
|
|
|
|
# due to a bug in Chromium:
|
|
|
|
#
|
|
|
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=16387
|
|
|
|
#
|
|
|
|
# Firefox users can just set
|
|
|
|
# extraPolicies.SecurityDevices.p11-kit-proxy "${pkgs.p11-kit}/lib/p11-kit-proxy.so";
|
|
|
|
# when overriding the firefox derivation.
|
|
|
|
(pkgs.writeShellScriptBin "setup-browser-eid" ''
|
|
|
|
NSSDB="''${HOME}/.pki/nssdb"
|
|
|
|
mkdir -p ''${NSSDB}
|
|
|
|
|
|
|
|
${pkgs.nssTools}/bin/modutil -force -dbdir sql:$NSSDB -add p11-kit-proxy \
|
|
|
|
-libfile ${pkgs.p11-kit}/lib/p11-kit-proxy.so
|
|
|
|
'')
|
2022-04-03 20:46:56 +02:00
|
|
|
];
|
|
|
|
}
|