@@ 8,79 8,25 @@
pkgs = import nixpkgs {
inherit system;
};
- runScriptPrefix = package: ''
+ runScriptPrefix = package: required: ''
# Search for an imperative declaration of the installation directory of ${package}
+ error=0
if [[ -f ~/.config/${package}/nix.sh ]]; then
source ~/.config/${package}/nix.sh
else
echo "nix-${package}-error: Did not find ~/.config/${package}/nix.sh" >&2
- exit 1
+ error=1
fi
if [[ ! -d "$INSTALL_DIR" ]]; then
echo "nix-${package}-error: INSTALL_DIR $INSTALL_DIR isn't a directory" >&2
- exit 2
+ error=2
'' + ''
fi
- '';
- liberoMultiPkgs = pkgs: with pkgs; [
- xlights
- glib
- glibc.dev
- fontconfig
- freetype
- gcc.cc.libgcc
- gcc.cc.libgcc.lib
- xorg.libICE
- xorg.libX11
- xorg.libXau
- libpng
- xorg.libSM
- xorg.libXcursor
- xorg.libXdmcp
- xorg.libXext
- xorg.libXfixes
- xorg.libXinerama
- xorg.libXi
- motif
- xorg.libXmu
- xorg.libXp
- xorg.libXrandr
- xorg.libXrender
- xorg.libXt
- xorg.libXtst
- zlib
- glib
- ksh
- # xorg-x11-fonts-75dpi
- # xorg-x11-fonts-100dpi
- # xorg-x11-fonts-Type1
- libuuid.lib
- libsForQt5.full
- libglvnd
- libxslt
- libxml2
- sqlite
- libkrb5
- systemd
- xorg.libxcb
- xorg.xcbutilimage
- xorg.xcbutilkeysyms
- libxkbcommon
- glibc_multi
-
- ncurses5
- ncurses
- ];
-
- motif3-compat = pkgs.stdenv.mkDerivation {
- name = "motif3-compat";
- phases = ["installPhase"];
- installPhase = ''
- mkdir -p $out/lib
- ln -s ${pkgs.motif}/lib/libXm.so.4 $out/lib/libXm.so.3
- '';
- };
+ if [[ $error -ne 0 ]]; then
+ exit $error
+ fi
+ '';
# pkgs for Xilinx tools
xilinxTargetPkgs = pkgs: with pkgs; [
@@ 123,26 69,84 @@
xorg.libICE
];
+ quartusTargetPkgs = 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.libxcb.out
+ xorg.xcbutilrenderutil.out
+ xorg.libXau
+ xorg.libXdmcp
+ gtk2
+ libelf
+ expat
+ dbus.lib
+ brotli.lib
+ libpng
+ bzip2.out
+ ];
+
in {
packages.${system} = {
-
- libero-shell = pkgs.buildFHSEnv {
- multiPkgs = liberoMultiPkgs;
- targetPkgs = liberoMultiPkgs;
-
- name = "libero-shell";
- runScript = pkgs.writeScript "libero-shell" ''
+ quartus-shell = pkgs.buildFHSEnv {
+ targetPkgs = quartusTargetPkgs;
+ name = "quartus-shell";
+ runScript = pkgs.writeScript "quartus-shell" ''
+ ${runScriptPrefix "quartus" false}
+ if [[ ! -z $INSTALL_DIR ]]; then
+ export PATH=$INSTALL_DIR/quartus/bin:$INSTALL_DIR/questa_fse/bin:$PATH
+ fi
export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
exec bash
'';
};
+ quartus = pkgs.buildFHSEnv {
+ targetPkgs = quartusTargetPkgs;
+ name = "quartus";
+ runScript = pkgs.writeScript "quartus" ''
+ ${runScriptPrefix "quartus" true}
+ export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
+ exec $INSTALL_DIR/quartus/bin/quartus
+ '';
+ };
+
+ quartus-udev-rules = pkgs.writeTextFile {
+ name = "quartus-usbblaster";
+ destination = "/etc/udev/rules.d/51-usbblaster.rules";
+ text = ''
+ # Intel FPGA Download Cable
+ SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6001", MODE="0666"
+ SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6002", MODE="0666"
+ SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6003", MODE="0666"
+
+ # Intel FPGA Download Cable II
+ SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6010", MODE="0666"
+ SUBSYSTEM=="usb", ATTR{idVendor}=="09fb", ATTR{idProduct}=="6810", MODE="0666"
+ '';
+ };
+
vivado-shell = pkgs.buildFHSEnv {
targetPkgs = xilinxTargetPkgs;
name = "vivado-shell";
runScript = pkgs.writeScript "vivado-shell" ''
- source $INSTALL_DIR/Vivado/2023.1/settings64.sh
+ ${runScriptPrefix "ise" false}
+ if [[ ! -z $INSTALL_DIR ]]; then
+ source $INSTALL_DIR/Vivado/2023.1/settings64.sh
+ fi
export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
exec bash
'';
@@ 152,7 156,7 @@
name = "vivado-runner";
runScript = pkgs.writeScript "vivado-runner" ''
- ${runScriptPrefix "vivado"}
+ ${runScriptPrefix "vivado" true}
export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
exec $INSTALL_DIR/Vivado/2023.1/bin/vivado "$@"
'';
@@ 165,8 169,10 @@
name = "ise-shell";
runScript = pkgs.writeScript "ise-shell" ''
- ${runScriptPrefix "ise"}
- source $INSTALL_DIR/14.7/ISE_DS/settings64.sh $INSTALL_DIR/14.7/ISE_DS
+ ${runScriptPrefix "ise" false}
+ if [[ ! -z $INSTALL_DIR ]]; then
+ source $INSTALL_DIR/14.7/ISE_DS/settings64.sh $INSTALL_DIR/14.7/ISE_DS
+ fi
exec bash
'';
};
@@ 176,7 182,7 @@
name = "xilinx-runner";
runScript = ''
- ${runScriptPrefix "ise"}
+ ${runScriptPrefix "ise" true}
source $INSTALL_DIR/14.7/ISE_DS/settings64.sh $INSTALL_DIR/14.7/ISE_DS
$INSTALL_DIR/14.7/ISE_DS/ISE/bin/lin64/ise
'';