Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ lib, stdenv, requireFile, gogUnpackHook }:
 | 
						|
 | 
						|
let
 | 
						|
  generic = ver: source: let
 | 
						|
    pname = "descent${toString ver}";
 | 
						|
  in stdenv.mkDerivation rec {
 | 
						|
    name = "${pname}-assets-${version}";
 | 
						|
    version = "2.0.0.7";
 | 
						|
 | 
						|
    src = requireFile rec {
 | 
						|
      name = "setup_descent12_${version}.exe";
 | 
						|
      sha256 = "1r1drbfda6czg21f9qqiiwgnkpszxgmcn5bafp5ljddh34swkn3f";
 | 
						|
      message = ''
 | 
						|
        While the Descent ${toString ver} game engine is free, the game assets are not.
 | 
						|
 | 
						|
        Please purchase the game on gog.com and download the Windows installer.
 | 
						|
 | 
						|
        Once you have downloaded the file, please use the following command and re-run the
 | 
						|
        installation:
 | 
						|
 | 
						|
        nix-prefetch-url file://\$PWD/${name}
 | 
						|
      '';
 | 
						|
    };
 | 
						|
 | 
						|
    nativeBuildInputs = [ gogUnpackHook ];
 | 
						|
 | 
						|
    dontBuild = true;
 | 
						|
    dontFixup = true;
 | 
						|
 | 
						|
    installPhase = ''
 | 
						|
      runHook preInstall
 | 
						|
 | 
						|
      mkdir -p $out/share/{games/${pname},doc/${pname}/examples}
 | 
						|
      pushd "app/${source}"
 | 
						|
      mv dosbox*.conf $out/share/doc/${pname}/examples
 | 
						|
      mv *.txt *.pdf  $out/share/doc/${pname}
 | 
						|
      cp -r * $out/share/games/descent${toString ver}
 | 
						|
      popd
 | 
						|
 | 
						|
      runHook postInstall
 | 
						|
    '';
 | 
						|
 | 
						|
    meta = with lib; {
 | 
						|
      description = "Descent ${toString ver} assets from GOG";
 | 
						|
      homepage    = "https://www.dxx-rebirth.com/";
 | 
						|
      license     = licenses.unfree;
 | 
						|
      maintainers = with maintainers; [ peterhoeg ];
 | 
						|
      hydraPlatforms = [];
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
in {
 | 
						|
  descent1-assets = generic 1 "descent";
 | 
						|
  descent2-assets = generic 2 "descent 2";
 | 
						|
}
 |