| 
									
										
										
										
											2016-07-01 18:40:21 +03:00
										 |  |  | # Global configuration for spacefm. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { config, lib, pkgs, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let cfg = config.programs.spacefm; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | in | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ###### interface | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   options = { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     programs.spacefm = { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       enable = mkOption { | 
					
						
							|  |  |  |         type = types.bool; | 
					
						
							|  |  |  |         default = false; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							| 
									
										
										
										
											2016-07-05 13:23:49 +02:00
										 |  |  |           Whether to install SpaceFM and create <filename>/etc/spacefm/spacefm.conf</filename>. | 
					
						
							| 
									
										
										
										
											2016-07-01 18:40:21 +03:00
										 |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       settings = mkOption { | 
					
						
							|  |  |  |         type = types.attrs; | 
					
						
							|  |  |  |         default = { | 
					
						
							|  |  |  |           tmp_dir = "/tmp"; | 
					
						
							|  |  |  |           terminal_su = "${pkgs.sudo}/bin/sudo"; | 
					
						
							|  |  |  |           graphical_su = "${pkgs.gksu}/bin/gksu"; | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |         example = literalExample ''{
 | 
					
						
							|  |  |  |           tmp_dir = "/tmp"; | 
					
						
							|  |  |  |           terminal_su = "''${pkgs.sudo}/bin/sudo"; | 
					
						
							|  |  |  |           graphical_su = "''${pkgs.gksu}/bin/gksu"; | 
					
						
							|  |  |  |         }'';
 | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           The system-wide spacefm configuration. | 
					
						
							|  |  |  |           Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>. | 
					
						
							|  |  |  |           Refer to the <link xlink:href="https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#programfiles-etc">relevant entry</link> in the SpaceFM manual. | 
					
						
							|  |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ###### implementation | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = mkIf cfg.enable { | 
					
						
							|  |  |  |     environment.systemPackages = [ pkgs.spaceFM ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     environment.etc."spacefm/spacefm.conf".text = | 
					
						
							|  |  |  |       concatStrings (mapAttrsToList (n: v: "${n}=${toString v}\n") cfg.settings); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |