From e66295f31a6e15c2af54c06e9aae3d951ccbceb3 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 18 Aug 2024 19:02:22 +0000 Subject: [PATCH] nixos-mod/frontend: enable hardware.gnupgSmartcard & assert combination with scdaemon on home config --- nix/nixos-modules/allCommon.nix | 1 + nix/nixos-modules/frontend/default.nix | 2 ++ nix/nixos-modules/frontend/home.nix | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/nix/nixos-modules/allCommon.nix b/nix/nixos-modules/allCommon.nix index 1e42cc3..69a29b4 100644 --- a/nix/nixos-modules/allCommon.nix +++ b/nix/nixos-modules/allCommon.nix @@ -3,6 +3,7 @@ { config , lib +, options , pkgs , ... }: diff --git a/nix/nixos-modules/frontend/default.nix b/nix/nixos-modules/frontend/default.nix index 0ea842f..96f5033 100644 --- a/nix/nixos-modules/frontend/default.nix +++ b/nix/nixos-modules/frontend/default.nix @@ -62,6 +62,8 @@ in powerOnBoot = true; }; + gpgSmartcards.enable = true; # scdaemon + graphics.required = true; opengl = { diff --git a/nix/nixos-modules/frontend/home.nix b/nix/nixos-modules/frontend/home.nix index d69df81..97e2cea 100644 --- a/nix/nixos-modules/frontend/home.nix +++ b/nix/nixos-modules/frontend/home.nix @@ -18,6 +18,24 @@ in { + # TODO exclude in own home-manager module + assertions = + let + hwSmartcards = nixosConfig.hardware.gpgSmartcards.enable; + scDaemon = with config.services.gpg-agent; enable && enableScDaemon; + in + [ + { + assertion = hwSmartcards -> scDaemon; + message = "hardware.gpgSmartcards is enabled on system side but gpg-agent’s scDaemon is disabled"; + } + { + assertion = scDaemon -> hwSmartcards; + message = "gpg-agent’s scDaemon is enabled but hardware.gpgSmartcards is disabled on system side"; + } + ]; + + home = { stateVersion = nixosConfig.system.stateVersion;