2022-09-09 14:08:57 +00:00
|
|
|
{ stdenv, lib, unstick, fetchurl
|
2024-04-21 15:54:59 +00:00
|
|
|
, withQuesta ? true
|
2021-07-14 22:03:04 +00:00
|
|
|
, supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
deviceIds = {
|
|
|
|
"Arria II" = "arria_lite";
|
|
|
|
"Cyclone V" = "cyclonev";
|
|
|
|
"Cyclone IV" = "cyclone";
|
|
|
|
"Cyclone 10 LP" = "cyclone10lp";
|
|
|
|
"MAX II/V" = "max";
|
|
|
|
"MAX 10 FPGA" = "max10";
|
|
|
|
};
|
|
|
|
|
|
|
|
supportedDeviceIds =
|
|
|
|
assert lib.assertMsg (lib.all (name: lib.hasAttr name deviceIds) supportedDevices)
|
|
|
|
"Supported devices are: ${lib.concatStringsSep ", " (lib.attrNames deviceIds)}";
|
|
|
|
lib.listToAttrs (map (name: {
|
|
|
|
inherit name;
|
|
|
|
value = deviceIds.${name};
|
|
|
|
}) supportedDevices);
|
|
|
|
|
|
|
|
unsupportedDeviceIds = lib.filterAttrs (name: value:
|
|
|
|
!(lib.hasAttr name supportedDeviceIds)
|
|
|
|
) deviceIds;
|
|
|
|
|
|
|
|
componentHashes = {
|
2024-01-13 08:15:51 +00:00
|
|
|
"arria_lite" = "0fg9mmncbb8vmmbc3hxgmrgvgfphn3k4glv7w2yjq66vz6nd8zql";
|
|
|
|
"cyclone" = "1min1hjaw8ll0c1gvl6ihp7hczw36ag8l2yzgl6avcapcw53hgyp";
|
|
|
|
"cyclone10lp" = "1kjjm11hjg0h6i7kilxvhmkay3v416bhwp0frg2bnwggpk29drxj";
|
|
|
|
"cyclonev" = "10v928qhyfqw3lszhhcdishh1875k1bki9i0czx9252jprgd1g7g";
|
|
|
|
"max" = "04sszzz3qnjziirisshhdqs7ks8mcvy15lc1mpp9sgm09pwlhgbb";
|
|
|
|
"max10" = "0dqlq477zdx4pf5hlbkl1ycxiav19vx4sk6277cpxm8y1xz70972";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "23.1std.0.991";
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
download = {name, sha256}: fetchurl {
|
2021-07-14 22:03:04 +00:00
|
|
|
inherit name sha256;
|
2024-01-13 08:15:51 +00:00
|
|
|
# e.g. "23.1std.0.991" -> "23.1std/921"
|
|
|
|
url = "https://downloads.intel.com/akdlm/software/acdsinst/${lib.versions.majorMinor version}std/${lib.elemAt (lib.splitVersion version) 4}/ib_installers/${name}";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
installers = map download ([{
|
2021-07-14 22:03:04 +00:00
|
|
|
name = "QuartusLiteSetup-${version}-linux.run";
|
2024-01-13 08:15:51 +00:00
|
|
|
sha256 = "1mg4db56rg407kdsvpzys96z59bls8djyddfzxi6bdikcklxz98h";
|
2024-04-21 15:54:59 +00:00
|
|
|
}] ++ lib.optional withQuesta {
|
2024-01-02 11:29:13 +00:00
|
|
|
name = "QuestaSetup-${version}-linux.run";
|
2024-01-13 08:15:51 +00:00
|
|
|
sha256 = "0f9lyphk4vf4ijif3kb4iqf18jl357z9h8g16kwnzaqwfngh2ixk";
|
2024-04-21 15:54:59 +00:00
|
|
|
});
|
|
|
|
components = map (id: download {
|
2021-07-14 22:03:04 +00:00
|
|
|
name = "${id}-${version}.qdz";
|
|
|
|
sha256 = lib.getAttr id componentHashes;
|
2024-04-21 15:54:59 +00:00
|
|
|
}) (lib.attrValues supportedDeviceIds);
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit version;
|
|
|
|
pname = "quartus-prime-lite-unwrapped";
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ unstick ];
|
|
|
|
|
|
|
|
buildCommand = let
|
|
|
|
copyInstaller = installer: ''
|
|
|
|
# `$(cat $NIX_CC/nix-support/dynamic-linker) $src[0]` often segfaults, so cp + patchelf
|
|
|
|
cp ${installer} $TEMP/${installer.name}
|
|
|
|
chmod u+w,+x $TEMP/${installer.name}
|
|
|
|
patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $TEMP/${installer.name}
|
|
|
|
'';
|
|
|
|
copyComponent = component: "cp ${component} $TEMP/${component.name}";
|
2024-04-21 15:54:59 +00:00
|
|
|
# leaves enabled: quartus, devinfo
|
2021-07-14 22:03:04 +00:00
|
|
|
disabledComponents = [
|
|
|
|
"quartus_help"
|
|
|
|
"quartus_update"
|
2024-01-02 11:29:13 +00:00
|
|
|
"questa_fe"
|
2024-04-21 15:54:59 +00:00
|
|
|
] ++ (lib.optional (!withQuesta) "questa_fse")
|
|
|
|
++ (lib.attrValues unsupportedDeviceIds);
|
2021-07-14 22:03:04 +00:00
|
|
|
in ''
|
2024-04-21 15:54:59 +00:00
|
|
|
echo "setting up installer..."
|
2021-07-14 22:03:04 +00:00
|
|
|
${lib.concatMapStringsSep "\n" copyInstaller installers}
|
|
|
|
${lib.concatMapStringsSep "\n" copyComponent components}
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
echo "executing installer..."
|
|
|
|
# "Could not load seccomp program: Invalid argument" might occur if unstick
|
|
|
|
# itself is compiled for x86_64 instead of the non-x86 host. In that case,
|
|
|
|
# override the input.
|
2021-07-14 22:03:04 +00:00
|
|
|
unstick $TEMP/${(builtins.head installers).name} \
|
|
|
|
--disable-components ${lib.concatStringsSep "," disabledComponents} \
|
|
|
|
--mode unattended --installdir $out --accept_eula 1
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
echo "cleaning up..."
|
2021-07-14 22:03:04 +00:00
|
|
|
rm -r $out/uninstall $out/logs
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
# replace /proc pentium check with a true statement. this allows usage under emulation.
|
|
|
|
substituteInPlace $out/quartus/adm/qenv.sh \
|
|
|
|
--replace-fail 'grep sse /proc/cpuinfo > /dev/null 2>&1' ':'
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-09-09 14:08:57 +00:00
|
|
|
homepage = "https://fpgasoftware.intel.com";
|
2021-07-14 22:03:04 +00:00
|
|
|
description = "FPGA design and simulation software";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2021-07-14 22:03:04 +00:00
|
|
|
license = licenses.unfree;
|
2022-09-09 14:08:57 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ kwohlfahrt ];
|
|
|
|
};
|
|
|
|
}
|