diff --git a/pkgs/vivado/vivado.nix b/pkgs/vivado/vivado.nix index 321a347..5d250ac 100644 --- a/pkgs/vivado/vivado.nix +++ b/pkgs/vivado/vivado.nix @@ -5,14 +5,19 @@ fetchurl, lib, runtimeShell, - macAddress ? lib.warn '' - In order for licensing to work, you need to manually provide your licensed machine's MAC address. - This can be done in two ways: - a) Set an env var `XILINX_NIC_ID=xx:xx:xx:xx:xx:xx` - b) Override the package `(vivado.override { macAddress = "xx:xx:xx:xx:xx:xx"; })` - If both are configured, the environment variable takes precedence. - Run `vlm` to see the current licensing status of your installation. - '' "aa:aa:aa:aa:aa:aa", + enableMacSpoofing ? false, + macAddress ? + if enableMacSpoofing then + lib.warn '' + In order for licensing to work, you need to manually provide your licensed machine's MAC address. + This can be done in two ways: + a) Set an env var `XILINX_NIC_ID=xx:xx:xx:xx:xx:xx` + b) Override the package `(vivado.override { macAddress = "xx:xx:xx:xx:xx:xx"; })` + If both are configured, the environment variable takes precedence. + Run `vlm` to see the current licensing status of your installation. + '' "aa:aa:aa:aa:aa:aa" + else + null, licensePath ? null, extraProfile ? "", extraPkgs ? pkgs: [ ], @@ -311,21 +316,22 @@ buildFHSEnv (finalAttrs: rec { ln -s ${unwrapped}/share/desktop-directories $out/share/desktop-directories ''; - runScript = ""; - unshareNet = true; - extraBwrapArgs = [ "--cap-add CAP_NET_ADMIN" ]; - + unshareNet = enableMacSpoofing; + extraBwrapArgs = lib.optional enableMacSpoofing "--cap-add CAP_NET_ADMIN"; profile = let XILINXD_LICENSE_FILE = lib.optionalString (!isNull licensePath) '' : ''${XILINXD_LICENSE_FILE:=${licensePath}} export XILINXD_LICENSE_FILE ''; + XILINX_NIC_ID = lib.optionalString enableMacSpoofing '' + : ''${XILINX_NIC_ID:=${macAddress}} + ip link add eth0 type dummy + ip link set dev eth0 address $XILINX_NIC_ID + ''; in '' - : ''${XILINX_NIC_ID:=${macAddress}} - ip link add eth0 type dummy - ip link set dev eth0 address $XILINX_NIC_ID + ${XILINX_NIC_ID} ${XILINXD_LICENSE_FILE} export LC_NUMERIC="en_US.UTF-8" export GDK_BACKEND=x11 @@ -335,10 +341,7 @@ buildFHSEnv (finalAttrs: rec { source ${unwrapped}/opt/Xilinx/${version}/Vivado/settings64.sh '' + extraProfile; - - # wanted by $unwrapped/opt/Xilinx/${version}/data/emulation/sctlm/lib/libhls_emsyn.so: - # "libLLVM-3.1.so" - # "libhls_hwsyn.so" + runScript = ""; inherit (unwrapped) meta; })