 29027fd1e1
			
		
	
	
		29027fd1e1
		
	
	
	
	
		
			
			Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
		
			
				
	
	
		
			45 lines
		
	
	
		
			892 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			892 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| { config, lib, pkgs, ... }:
 | ||
| 
 | ||
| with lib;
 | ||
| 
 | ||
| {
 | ||
| 
 | ||
|   ###### interface
 | ||
| 
 | ||
|   options = {
 | ||
| 
 | ||
|     services.oidentd.enable = mkOption {
 | ||
|       default = false;
 | ||
|       type = types.bool;
 | ||
|       description = ''
 | ||
|         Whether to enable ‘oidentd’, an implementation of the Ident
 | ||
|         protocol (RFC 1413).  It allows remote systems to identify the
 | ||
|         name of the user associated with a TCP connection.
 | ||
|       '';
 | ||
|     };
 | ||
| 
 | ||
|   };
 | ||
| 
 | ||
|   
 | ||
|   ###### implementation
 | ||
| 
 | ||
|   config = mkIf config.services.oidentd.enable {
 | ||
| 
 | ||
|     jobs.oidentd =
 | ||
|       { startOn = "started network-interfaces";
 | ||
|         daemonType = "fork";
 | ||
|         exec = "${pkgs.oidentd}/sbin/oidentd -u oidentd -g nogroup";
 | ||
|       };
 | ||
| 
 | ||
|     users.extraUsers.oidentd = {
 | ||
|       description = "Ident Protocol daemon user";
 | ||
|       group = "oidentd";
 | ||
|       uid = config.ids.uids.oidentd;
 | ||
|     };
 | ||
| 
 | ||
|     users.extraGroups.oidentd.gid = config.ids.gids.oidentd;
 | ||
| 
 | ||
|   };
 | ||
| 
 | ||
| }
 |