nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 100 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 bash, 6 python3, 7 yosys, 8 yices, 9 z3, 10 aiger, 11 btor2tools, 12 nix-update-script, 13}: 14 15let 16 pythonEnv = python3.withPackages (ps: with ps; [ click ]); 17in 18 19stdenv.mkDerivation (finalAttrs: { 20 pname = "sby"; 21 version = "0.58"; 22 23 src = fetchFromGitHub { 24 owner = "YosysHQ"; 25 repo = "sby"; 26 tag = "v${finalAttrs.version}"; 27 hash = "sha256-msQ+aqdp8i5KMLUABYU6vA5VBkI6G3zF06RrQzfJucY="; 28 }; 29 30 postPatch = '' 31 patchShebangs --build \ 32 docs/source/conf.py \ 33 docs/source/conf.diff \ 34 tests/autotune/*.sh \ 35 tests/keepgoing/*.sh \ 36 tests/junit/*.sh 37 38 # Fix up Yosys imports 39 substituteInPlace sbysrc/sby.py \ 40 --replace-fail "##yosys-sys-path##" \ 41 "sys.path += [p + \"/share/yosys/python3/\" for p in [\"$out\", \"${yosys}\"]]" 42 43 # Fix various executable references 44 substituteInPlace sbysrc/sby_core.py \ 45 --replace-fail '"/usr/bin/env", "bash"' '"${lib.getExe bash}"' \ 46 --replace-fail ', "aigbmc"' ', "${lib.getExe' aiger "aigbmc"}"' 47 48 substituteInPlace sbysrc/sby_core.py \ 49 --replace-fail '##yosys-program-prefix##' '"${yosys}/bin/"' 50 51 substituteInPlace sbysrc/sby.py \ 52 --replace-fail '/usr/bin/env python3' '${pythonEnv}/bin/python' 53 substituteInPlace sbysrc/sby_autotune.py \ 54 --replace-fail '["btorsim", "--vcd"]' '["${lib.getExe' btor2tools "btorsim"}", "--vcd"]' 55 ''; 56 57 dontBuild = true; 58 59 installPhase = '' 60 runHook preInstall 61 mkdir -p $out/bin $out/share/yosys/python3 62 63 cp sbysrc/sby_*.py $out/share/yosys/python3/ 64 cp sbysrc/sby.py $out/bin/sby 65 66 chmod +x $out/bin/sby 67 runHook postInstall 68 ''; 69 70 nativeCheckInputs = [ 71 python3 72 python3.pkgs.xmlschema 73 yosys 74 yices 75 z3 76 aiger 77 btor2tools 78 ]; 79 80 doCheck = true; 81 82 checkPhase = '' 83 runHook preCheck 84 make test 85 runHook postCheck 86 ''; 87 88 passthru.updateScript = nix-update-script { }; 89 90 meta = { 91 description = "SymbiYosys, a front-end for Yosys-based formal verification flows"; 92 homepage = "https://symbiyosys.readthedocs.io/"; 93 license = lib.licenses.isc; 94 maintainers = with lib.maintainers; [ 95 thoughtpolice 96 ]; 97 mainProgram = "sby"; 98 platforms = lib.platforms.all; 99 }; 100})