nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 61 lines 1.4 kB view raw
1{ 2 lib, 3 buildNpmPackage, 4 fetchFromGitHub, 5 runCommandLocal, 6 netlistsvg, 7 yosys, 8}: 9 10buildNpmPackage rec { 11 pname = "netlistsvg"; 12 version = "1.0.2"; 13 14 src = fetchFromGitHub { 15 owner = "nturley"; 16 repo = "netlistsvg"; 17 tag = "v${version}"; 18 hash = "sha256-H37zhjfv7c/TV+pAk70eDiE6ZQ9JjZq1TFvac6OOKBk="; 19 }; 20 21 postPatch = '' 22 cp ${./package-lock.json} ./package-lock.json 23 ''; 24 25 npmDepsHash = "sha256-Vs0RLj6ySkM5oQsBGv4MmgiIBMhiDhINpwuCBJH9L8s="; 26 27 dontNpmBuild = true; 28 29 doCheck = true; 30 31 checkPhase = '' 32 runHook preCheck 33 34 node --trace-warnings test/test-all.js 35 36 runHook postCheck 37 ''; 38 39 # An integration test: Synthesize a circuit from hdl and generate a diagram 40 passthru.tests.netlistsvg-yosys-integration-test = 41 runCommandLocal "netlistsvg-yosys-integration-test" 42 { 43 nativeBuildInputs = [ 44 netlistsvg 45 yosys 46 ]; 47 } 48 '' 49 yosys -p "prep -top helloworld -flatten; aigmap; write_json circuit.json" ${./test.v} 50 netlistsvg circuit.json -o circuit.svg 51 test -s circuit.svg 52 touch $out 53 ''; 54 55 meta = { 56 description = "Draw SVG digital circuits schematics from yosys JSON netlists"; 57 homepage = "https://github.com/nturley/netlistsvg"; 58 license = lib.licenses.mit; 59 maintainers = with lib.maintainers; [ pbsds ]; 60 }; 61}