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
		
			
				
	
	
		
			75 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ lib, stdenv, fetchurl
 | 
						|
, xorgproto, motif, libX11, libXt, libXpm, bison
 | 
						|
, flex, automake, autoconf, libtool, runtimeShell
 | 
						|
}:
 | 
						|
 | 
						|
stdenv.mkDerivation rec {
 | 
						|
  pname = "alliance";
 | 
						|
  version = "5.1.1";
 | 
						|
 | 
						|
  src = fetchurl {
 | 
						|
    url = "http://www-asim.lip6.fr/pub/alliance/distribution/5.0/${pname}-${version}.tar.bz2";
 | 
						|
    sha256 = "046c9qwl1vbww0ljm4xyxf5jpz9nq62b2q0wdz9xjimgh4c207w1";
 | 
						|
  };
 | 
						|
 | 
						|
 | 
						|
  nativeBuildInputs = [ libtool automake autoconf flex ];
 | 
						|
  buildInputs = [ xorgproto motif libX11 libXt libXpm bison ];
 | 
						|
 | 
						|
  sourceRoot = "alliance/src/";
 | 
						|
 | 
						|
  configureFlags = [
 | 
						|
    "--prefix=$(out)"
 | 
						|
  ];
 | 
						|
 | 
						|
  preConfigure = ''
 | 
						|
    mkdir -p $out/etc
 | 
						|
 | 
						|
    #texlive for docs seems extreme
 | 
						|
    mkdir -p $out/share/alliance
 | 
						|
    mv ./documentation $out/share/alliance
 | 
						|
    substituteInPlace autostuff \
 | 
						|
      --replace "$newdirs documentation" "$newdirs" \
 | 
						|
      --replace documentation Solaris
 | 
						|
 | 
						|
    substituteInPlace sea/src/DEF_grammar_lex.l \
 | 
						|
      --replace "ifndef FLEX_BETA" "if (YY_FLEX_MAJOR_VERSION <= 2) && (YY_FLEX_MINOR_VERSION < 6)"
 | 
						|
    ./autostuff
 | 
						|
  '';
 | 
						|
 | 
						|
  allianceInstaller = ''
 | 
						|
    #!${runtimeShell}
 | 
						|
    cp -v -r -n --no-preserve=mode  $out/etc/* /etc/ > /etc/alliance-install.log
 | 
						|
  '';
 | 
						|
 | 
						|
  allianceUnInstaller = ''
 | 
						|
    #!${runtimeShell}
 | 
						|
    awk '{print \$3}' /etc/alliance-install.log | xargs rm
 | 
						|
    awk '{print \$3}' /etc/alliance-install.log | xargs rmdir
 | 
						|
    rm /etc/alliance-install.log
 | 
						|
  '';
 | 
						|
 | 
						|
  postInstall = ''
 | 
						|
    sed -i "s|ALLIANCE_TOP|$out|" distrib/*.desktop
 | 
						|
    mkdir -p $out/share/applications
 | 
						|
    cp -p distrib/*.desktop $out/share/applications/
 | 
						|
    mkdir -p $out/icons/hicolor/48x48/apps/
 | 
						|
    cp -p distrib/*.png $out/icons/hicolor/48x48/apps/
 | 
						|
 | 
						|
    echo "${allianceInstaller}" > $out/bin/alliance-install
 | 
						|
    chmod +x $out/bin/alliance-install
 | 
						|
 | 
						|
    echo "${allianceUnInstaller}" > $out/bin/alliance-uninstall
 | 
						|
    chmod +x $out/bin/alliance-uninstall
 | 
						|
  '';
 | 
						|
 | 
						|
  meta = with lib; {
 | 
						|
    description = "Complete set of free CAD tools and portable libraries for VLSI design";
 | 
						|
    homepage = "http://www-asim.lip6.fr/recherche/alliance/";
 | 
						|
    license = with licenses; gpl2Plus;
 | 
						|
    maintainers = with maintainers; [ ];
 | 
						|
    platforms = with platforms; linux;
 | 
						|
    broken = true;
 | 
						|
  };
 | 
						|
}
 |