| 
									
										
										
										
											2018-05-18 18:24:53 +02:00
										 |  |  | { config, pkgs, lib, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let | 
					
						
							|  |  |  |   cfg = config.programs.xss-lock; | 
					
						
							|  |  |  | in | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   options.programs.xss-lock = { | 
					
						
							|  |  |  |     enable = mkEnableOption "xss-lock"; | 
					
						
							| 
									
										
										
										
											2019-05-11 18:56:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-18 18:24:53 +02:00
										 |  |  |     lockerCommand = mkOption { | 
					
						
							| 
									
										
										
										
											2019-01-04 15:41:51 +01:00
										 |  |  |       default = "${pkgs.i3lock}/bin/i3lock"; | 
					
						
							|  |  |  |       example = literalExample ''''${pkgs.i3lock-fancy}/bin/i3lock-fancy''; | 
					
						
							| 
									
										
										
										
											2019-08-08 22:48:27 +02:00
										 |  |  |       type = types.separatedString " "; | 
					
						
							| 
									
										
										
										
											2018-05-18 18:24:53 +02:00
										 |  |  |       description = "Locker to be used with xsslock"; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2019-05-11 18:56:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     extraOptions = mkOption { | 
					
						
							|  |  |  |       default = [ ]; | 
					
						
							| 
									
										
										
										
											2019-05-12 03:20:44 +02:00
										 |  |  |       example = [ "--ignore-sleep" ]; | 
					
						
							| 
									
										
										
										
											2019-05-11 18:56:48 +02:00
										 |  |  |       type = types.listOf types.str; | 
					
						
							|  |  |  |       description = ''
 | 
					
						
							|  |  |  |         Additional command-line arguments to pass to | 
					
						
							|  |  |  |         <command>xss-lock</command>. | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-05-18 18:24:53 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = mkIf cfg.enable { | 
					
						
							|  |  |  |     systemd.user.services.xss-lock = { | 
					
						
							|  |  |  |       description = "XSS Lock Daemon"; | 
					
						
							|  |  |  |       wantedBy = [ "graphical-session.target" ]; | 
					
						
							|  |  |  |       partOf = [ "graphical-session.target" ]; | 
					
						
							| 
									
										
										
										
											2019-05-11 18:56:48 +02:00
										 |  |  |       serviceConfig.ExecStart = with lib; | 
					
						
							|  |  |  |         strings.concatStringsSep " " ([ | 
					
						
							|  |  |  |             "${pkgs.xss-lock}/bin/xss-lock" | 
					
						
							| 
									
										
										
										
											2019-05-12 03:20:44 +02:00
										 |  |  |           ] ++ (map escapeShellArg cfg.extraOptions) ++ [ | 
					
						
							| 
									
										
										
										
											2019-05-11 18:56:48 +02:00
										 |  |  |             "--" | 
					
						
							|  |  |  |             cfg.lockerCommand | 
					
						
							|  |  |  |         ]); | 
					
						
							| 
									
										
										
										
											2018-05-18 18:24:53 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |