/ shell.nix
shell.nix
 1  { pkgs ? import <nixpkgs> {} }:
 2  
 3  with pkgs;
 4  let yosys-slang =
 5        stdenv.mkDerivation (finalAttrs: {
 6          pname = "yosys-slang";
 7          version = "64b44616a3798f07453b14ea03e4ac8a16b77313";
 8  
 9          src = fetchFromGitHub {
10            owner  = "povik";
11            repo   = "yosys-slang";
12            rev    = "${finalAttrs.version}";
13            sha256 = "sha256-kfu59/M3+IM+5ZMd+Oy4IZf4JWuVtPDlkHprk0FB8t4=";
14            fetchSubmodules = true;
15          };
16  
17          buildInputs = [
18            yosys
19            cmake
20            python3
21          ];
22  
23          installPhase = ''
24             mkdir -p $out/lib
25             cp slang.so $out/lib/slang.so
26          '';
27        });
28  in
29  mkShell {
30    packages = [
31      gnumake boost zlib patchelf mill verilator haskellPackages.sv2v
32      yosys yosys-slang nextpnr python313Packages.apycula openfpgaloader
33    ];
34  
35    shellHook = ''
36      ## Shell name
37      export NIX_SHELL_NAME="[hny2026]"
38      export YOSYS_SLANG_SO="${yosys-slang}/lib/slang.so"
39  
40      find $HOME/.cache/llvm-firtool/ -type f -executable -exec patchelf --set-interpreter ${pkgs.glibc}/lib64/ld-linux-x86-64.so.2 {} \;
41      find $HOME/.cache/llvm-firtool/ -type f -executable -exec patchelf --add-needed ${zlib}/lib/libz.so.1 {} \;
42  
43      find $HOME/.cache/mill/ -type f -executable -exec patchelf --set-interpreter ${pkgs.glibc}/lib64/ld-linux-x86-64.so.2 {} \;
44      find $HOME/.cache/mill/ -type f -executable -exec patchelf --add-needed ${zlib}/lib/libz.so.1 {} \;
45    '';
46  }