zaphyra's git: nixfiles

zaphyra and void's nixfiles

commit bc1a77c769020e5563e7e804bf31d435f501722f
parent 35868581c59e695ff7f816ef389c4ecdf2f4b7cd
Author: Katja (zaphyra) <git@ctu.cx>
Date: Sun, 15 Jun 2025 12:45:58 +0200

config/nixos/modules/programs: add `yubikey` (and enable on host `huntii`)
2 files changed, 56 insertions(+), 1 deletion(-)
A
config/nixos/modules/programs/yubikey.nix
|
51
+++++++++++++++++++++++++++++++++++++++++++++++++++
M
hosts/huntii/default.nix
|
6
+++++-
diff --git a/config/nixos/modules/programs/yubikey.nix b/config/nixos/modules/programs/yubikey.nix
@@ -0,0 +1,50 @@
+{
+  inputs,
+  povSelf,
+  config,
+  lib,
+  pkgs,
+  homeManagerModules,
+  ...
+}:
+let
+  inherit (lib) types;
+  cfg = lib.getAttrFromPath povSelf config;
+
+in
+{
+
+  options.enable = {
+    type = types.bool;
+    default = false;
+  };
+
+  config = lib.mkIf cfg.enable (lib.mkMerge [
+    (
+      #if we have home-manager enabled... but packages in the user environment
+      lib.mkIf config.modules.homeManager.enable {
+        home-manager.sharedModules = [
+          {
+            home.packages = with pkgs; [
+              yubikey-manager
+              yubioath-flutter
+            ];
+          }
+        ];
+      }
+    )
+    (
+      # if not... put it in the system environment
+      lib.mkIf (!config.modules.homeManager.enable) {
+        environment.systemPackages = with pkgs; [
+          yubikey-manager
+          yubioath-flutter
+        ];
+      }
+    )
+    {
+      programs.yubikey-touch-detector.enable = true;
+    }
+  ]);
+
+}+
\ No newline at end of file
diff --git a/hosts/huntii/default.nix b/hosts/huntii/default.nix
@@ -75,7 +75,10 @@
           systemd-oomd.enable = true;
         };
 
-        programs.AusweisApp.enable = true;
+        programs = {
+          AusweisApp.enable = true;
+          yubikey.enable = true;
+        };
 
         users.zaphyra.enable = true;
       };

@@ -104,6 +107,7 @@
         gnome.gnome-online-accounts.enable = true;
       };
 
+
       system.stateVersion = "25.05";
       home-manager.users.zaphyra.home.stateVersion = "25.05";
     };