Move wrapNonNixProgram to utils module
Define the wrapNonNixProgram in my Nix utils module.
This commit is contained in:
		
							parent
							
								
									02721a25a7
								
							
						
					
					
						commit
						aa9b81fe21
					
				
					 4 changed files with 24 additions and 10 deletions
				
			
		|  | @ -1,9 +1,7 @@ | |||
| { config, pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as '' | ||||
|     exec ${path} "$@" | ||||
|   ''; | ||||
|   briefcase = import <briefcase> {}; | ||||
| in { | ||||
|   home = { | ||||
|     packages = with pkgs; [ | ||||
|  | @ -45,7 +43,10 @@ in { | |||
| 
 | ||||
|   programs.git = { | ||||
|     enable = true; | ||||
|     package = wrapNonNixProgram { path = "/usr/bin/git"; as = "git"; }; | ||||
|     package = briefcase.utils.wrapNonNixProgram { | ||||
|       path = "/usr/bin/git"; | ||||
|       as = "git"; | ||||
|     }; | ||||
|     userName = "William Carroll"; | ||||
|     userEmail = "wpcarro@gmail.com"; | ||||
|     aliases = { | ||||
|  | @ -147,7 +148,10 @@ in { | |||
|     enable = true; | ||||
|     latitude = "51.49"; | ||||
|     longitude = "-0.18"; | ||||
|     package = wrapNonNixProgram { path = "/usr/bin/redshift"; as = "redshift"; }; | ||||
|     package = briefcase.utils.wrapNonNixProgram { | ||||
|       path = "/usr/bin/redshift"; | ||||
|       as = "redshift"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   # Hide the cursor during X sessions after 1 second. | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ let | |||
|   }; | ||||
| in { | ||||
|   nixos       = readTree ./nixos; | ||||
|   utils       = readTree ./utils; | ||||
|   emacs       = readTree ./emacs; | ||||
|   blog        = readTree ./blog; | ||||
|   lisp        = readTree ./lisp; | ||||
|  |  | |||
|  | @ -1,5 +0,0 @@ | |||
| # Using this as a library to define some common utility functions that I often | ||||
| # reach for. | ||||
| { | ||||
|   identity = x: x; | ||||
| } | ||||
							
								
								
									
										14
									
								
								utils/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								utils/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| { pkgs, ... }: | ||||
| 
 | ||||
| # Using this as a library to define some common utility functions that I often | ||||
| # reach for. | ||||
| { | ||||
|   # A unary function that returns its argument. | ||||
|   identity = x: x; | ||||
| 
 | ||||
|   # Create a derivation that creates an executable shell script named `as` that | ||||
|   # calls the program located at `path`, forwarding all of the arguments. | ||||
|   wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as '' | ||||
|     exec ${path} "$@" | ||||
|   ''; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue