forked from fabian/nix
		
	modularize yubikey
This commit is contained in:
		
							parent
							
								
									d5afd4b1a7
								
							
						
					
					
						commit
						1221aaf0fc
					
				
					 4 changed files with 47 additions and 37 deletions
				
			
		|  | @ -6,5 +6,6 @@ | ||||||
| }: { | }: { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./baseline.nix |     ./baseline.nix | ||||||
|  |     ./yubikey.nix | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										44
									
								
								sys/modules/yubikey.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								sys/modules/yubikey.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | with lib; let | ||||||
|  |   cfg = config.local.sys.yubikey; | ||||||
|  | in { | ||||||
|  |   options.local.sys.yubikey = { | ||||||
|  |     enable = mkEnableOption "yubikey settings"; | ||||||
|  |   }; | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     services = { | ||||||
|  |       pcscd.enable = true; | ||||||
|  |       udev.packages = [pkgs.yubikey-personalization]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     environment.etc."pkcs11/modules/ykcs11".text = '' | ||||||
|  |       module: ${pkgs.yubico-piv-tool}/lib/libykcs11.so | ||||||
|  |     ''; | ||||||
|  | 
 | ||||||
|  |     programs.gnupg.agent = { | ||||||
|  |       enable = true; | ||||||
|  |       enableSSHSupport = true; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     security.pam = { | ||||||
|  |       services = { | ||||||
|  |         login.u2fAuth = true; | ||||||
|  |         sudo.u2fAuth = true; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       u2f = { | ||||||
|  |         enable = true; | ||||||
|  |         control = "sufficient"; | ||||||
|  |         settings = { | ||||||
|  |           debug = false; | ||||||
|  |           cue = true; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | @ -10,11 +10,12 @@ | ||||||
|   imports = [ |   imports = [ | ||||||
|     # Include the results of the hardware scan. |     # Include the results of the hardware scan. | ||||||
|     ./hardware-configuration.nix |     ./hardware-configuration.nix | ||||||
|     ./yubikey.nix |  | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   local.sys = { |   local.sys = { | ||||||
|     baseline.enable = true; |     baseline.enable = true; | ||||||
|  | 
 | ||||||
|  |     yubikey.enable = true; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   # Use the systemd-boot EFI boot loader. |   # Use the systemd-boot EFI boot loader. | ||||||
|  |  | ||||||
|  | @ -1,36 +0,0 @@ | ||||||
| { |  | ||||||
|   config, |  | ||||||
|   pkgs, |  | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: { |  | ||||||
|   services = { |  | ||||||
|     pcscd.enable = true; |  | ||||||
|     udev.packages = [pkgs.yubikey-personalization]; |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   environment.etc."pkcs11/modules/ykcs11".text = '' |  | ||||||
|     module: ${pkgs.yubico-piv-tool}/lib/libykcs11.so |  | ||||||
|   ''; |  | ||||||
| 
 |  | ||||||
|   programs.gnupg.agent = { |  | ||||||
|     enable = true; |  | ||||||
|     enableSSHSupport = true; |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   security.pam = { |  | ||||||
|     services = { |  | ||||||
|       login.u2fAuth = true; |  | ||||||
|       sudo.u2fAuth = true; |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     u2f = { |  | ||||||
|       enable = true; |  | ||||||
|       control = "sufficient"; |  | ||||||
|       settings = { |  | ||||||
|         debug = false; |  | ||||||
|         cue = true; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue