feat(users/Profpatsch/arglib/netencode): add with-args
Wraps a command in some arguments via arglib. Also refactor the module to be a `let`. Change-Id: Ie9b64f7d40c57a4e57bd4d6c411bef5ef57a2b59 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7796 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									899828adeb
								
							
						
					
					
						commit
						8cdefc5b25
					
				
					 1 changed files with 65 additions and 50 deletions
				
			
		| 
						 | 
					@ -1,7 +1,17 @@
 | 
				
			||||||
{ depot, pkgs, lib, ... }:
 | 
					{ depot, pkgs, lib, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let
 | 
					let
 | 
				
			||||||
  netencode = {
 | 
					
 | 
				
			||||||
 | 
					  # Add the given nix arguments to the program as ARGLIB_NETENCODE envvar
 | 
				
			||||||
 | 
					  #
 | 
				
			||||||
 | 
					  # Calls `netencode.gen.dwim` on the provided nix args value.
 | 
				
			||||||
 | 
					  with-args = args: prog: depot.nix.writeExecline "${prog.name}-with-args" { } [
 | 
				
			||||||
 | 
					    "export"
 | 
				
			||||||
 | 
					    "ARGLIB_NETENCODE"
 | 
				
			||||||
 | 
					    (depot.users.Profpatsch.netencode.gen.dwim args)
 | 
				
			||||||
 | 
					    prog
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  rust = depot.nix.writers.rustSimpleLib
 | 
					  rust = depot.nix.writers.rustSimpleLib
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name = "arglib-netencode";
 | 
					      name = "arglib-netencode";
 | 
				
			||||||
| 
						 | 
					@ -58,7 +68,12 @@ let
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
depot.nix.readTree.drvTargets netencode
 | 
					depot.nix.readTree.drvTargets {
 | 
				
			||||||
 | 
					  inherit
 | 
				
			||||||
 | 
					    with-args
 | 
				
			||||||
 | 
					    rust
 | 
				
			||||||
 | 
					    haskell
 | 
				
			||||||
 | 
					    ;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue