~ruther/nix-fpga

ref: 360b4f46563b10bbb24d886af4f5f0c33e0f0bed nix-fpga/pkgs/questa/fhs.nix -rw-r--r-- 1.7 KiB
360b4f46 — Rutherther docs: add information about other programs in main package binary folder 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{pkgs, lib, myLib, licenseInterface ? "" }:

let
  bypassNetwork = licenseInterface == true || (licenseInterface != "");
  imperativeInterface = licenseInterface == true;
  declarativeInterface = bypassNetwork && !imperativeInterface;
in pkgs.buildFHSEnv {
  targetPkgs =
  pkgs: with pkgs; [
    stdenv.cc.cc.lib
    zlib
    glib
    libxcrypt-legacy
    libpng12
    freetype
    fontconfig.lib
    xorg.libSM
    xorg.libICE
    xorg.libXrender
    xorg.libXext
    xorg.libX11
    xorg.libXtst
    xorg.libXi
    xorg.libXft
    xorg.xcbutil
    xorg.libxcb.out
    xorg.xcbutilrenderutil.out
    xorg.libXau
    xorg.libXdmcp
    qt6.qtwayland
    libsForQt5.qt5.qtwayland
    gtk2
    libelf
    expat
    dbus.lib
    brotli.lib
    libpng
    bzip2.out
  ];

  name = "questasim";

  unshareNet = bypassNetwork;

  extraBwrapArgs = lib.lists.optionals bypassNetwork [
    "--cap-add CAP_NET_ADMIN"
  ];

  runScript = ''
    #!/usr/bin/env bash
    ${myLib.runScriptPrefix "questa" true}
    if [[ ! -z $INSTALL_DIR ]]; then
      export PATH=$INSTALL_DIR/bin:$PATH
    fi
    export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
    '' +

    (lib.optionalString imperativeInterface ''
      if [[ -z $LICENSE_INTERFACE ]]; then
        echo "nix-questa-error: LICENSE_INTERFACE is not set, but imperative license interface setup has been chosen. Continuing, but expect issues with license."
      else
        ip link add eth0 type dummy
        ip link set dev eth0 address $LICENSE_INTERFACE
      fi
    '') +

    (lib.optionalString declarativeInterface ''
      ip link add eth0 type dummy
      ip link set dev eth0 address ${licenseInterface}
    # # # '') +

    ''
      exec "$@"
    '';

  meta.mainProgram = "questasim";
}