2024-01-22 00:09:37 +01:00
|
|
|
# SPDX-FileCopyrightText: 2023-2024 Simon Bruder <simon@sbruder.de>
|
2024-01-06 01:19:35 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2023-12-20 16:53:42 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2024-01-22 00:09:37 +01:00
|
|
|
lib.mkMerge [
|
2024-01-22 01:06:43 +01:00
|
|
|
(lib.mkIf (!config.sbruder.machine.isVm) {
|
2024-01-22 00:09:37 +01:00
|
|
|
hardware.nitrokey.enable = true;
|
2024-01-22 01:06:43 +01:00
|
|
|
})
|
2024-01-22 00:09:37 +01:00
|
|
|
(lib.mkIf config.sbruder.gui.enable {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
# both depend on pypemicro, which is not needed, but nixpkgs requires it
|
|
|
|
# (even though it could have been optional: https://github.com/NixOS/nixpkgs/pull/183099#discussion_r933226708)
|
|
|
|
#nitrokey-app2
|
|
|
|
#pynitrokey
|
|
|
|
];
|
2024-01-22 00:28:58 +01:00
|
|
|
|
|
|
|
systemd.user.services.gpg-force-learn-cards = {
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.gnupg}/bin/gpg-connect-agent 'learn --force' '/bye'";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="42b2", ENV{SYSTEMD_USER_WANTS}="gpg-force-learn-cards.service"
|
|
|
|
'';
|
2024-01-22 00:09:37 +01:00
|
|
|
})
|
|
|
|
]
|