nixpkgs/pkgs/by-name/fi/firrtl/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

62 lines
1.6 KiB
Nix

{ lib, stdenv, jre, setJavaClassPath, coursier, makeWrapper }:
stdenv.mkDerivation rec {
pname = "firrtl";
version = "1.5.3";
scalaVersion = "2.13"; # pin, for determinism
deps = stdenv.mkDerivation {
pname = "${pname}-deps";
inherit version;
nativeBuildInputs = [ coursier ];
buildCommand = ''
export COURSIER_CACHE=$(pwd)
cs fetch edu.berkeley.cs:${pname}_${scalaVersion}:${version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java
'';
outputHashMode = "recursive";
outputHash = "sha256-xy3zdJZk6Q2HbEn5tRQ9Z0AjyXEteXepoWDaATjiUUw=";
};
nativeBuildInputs = [ makeWrapper setJavaClassPath ];
buildInputs = [ deps ];
dontUnpack = true;
installPhase = ''
runHook preInstall
makeWrapper ${jre}/bin/java $out/bin/${pname} \
--add-flags "-cp $CLASSPATH firrtl.stage.FirrtlMain"
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/firrtl --firrtl-source "${''
circuit test:
module test:
input a: UInt<8>
input b: UInt<8>
output o: UInt
o <= add(a, not(b))
''}" -o test.v
cat test.v
grep -qFe "module test" -e "endmodule" test.v
'';
meta = with lib; {
description = "Flexible Intermediate Representation for RTL";
mainProgram = "firrtl";
longDescription = ''
Firrtl is an intermediate representation (IR) for digital circuits
designed as a platform for writing circuit-level transformations.
'';
homepage = "https://www.chisel-lang.org/firrtl/";
license = licenses.asl20;
maintainers = [ ];
};
}