Add nix-support/private to unfree derivation outputs
This commit is contained in:
		
							parent
							
								
									83dee4df28
								
							
						
					
					
						commit
						4ae7ad31a3
					
				
							
								
								
									
										26
									
								
								overlay.nix
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								overlay.nix
									
									
									
									
									
								
							| @ -7,6 +7,32 @@ let | ||||
|   callPackage = final.callPackage; | ||||
| 
 | ||||
|   bscPkgs = { | ||||
| 
 | ||||
|     # override stdenv to add a sentinel to know if a derivation comes | ||||
|     # from unfree sources. | ||||
|     stdenv = prev.stdenv // { | ||||
|       mkDerivation = | ||||
|         args: | ||||
|         let | ||||
|           originalDrv = prev.stdenv.mkDerivation args; | ||||
|           checkLicense = l: if builtins.isAttrs l then !(l.free or true) else false; | ||||
| 
 | ||||
|           licenses = if builtins.isList args.meta.license then args.meta.license else [ args.meta.license ]; | ||||
| 
 | ||||
|           hasUnfreeLicense = | ||||
|             if args ? meta && args.meta ? license then builtins.any checkLicense licenses else false; | ||||
|         in | ||||
|         if hasUnfreeLicense then | ||||
|           originalDrv.overrideAttrs (old: { | ||||
|             postInstall = (old.postInstall or "") + '' | ||||
|               mkdir -p $out/nix-support | ||||
|               touch $out/nix-support/private | ||||
|             ''; | ||||
|           }) | ||||
|         else | ||||
|           originalDrv; | ||||
|     }; | ||||
| 
 | ||||
|     bench6 = callPackage ./pkgs/bench6/default.nix { }; | ||||
|     bigotes = callPackage ./pkgs/bigotes/default.nix { }; | ||||
|     clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { }; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user