quartus: split out unwrapped package

This allows customizing the install process for the unwrapped process,
as proposed in #123469, without introducing top-level support for
untested modifications.

The PR could then be straightforwardly implemented as an overlay, that
does:

quartus-prime-lite = super.quartus-prime-lite.override {
unwrapped = quartus-prime-lite.unwrapped.overrideAttrs (o: {
buildCommand = o.buildCommand + ''
rm -r $out/nios2eds/bin/gnu
find $out/modelsim_ase/altera/{verilog,vhdl}/* ! -name src ! -path '*twentynm*' -delete
'';
});
};

+102 -100
+6 -100
pkgs/applications/editors/quartus-prime/default.nix
··· 1 - { buildFHSUserEnv, makeDesktopItem, writeScript, stdenv, lib, requireFile, unstick, 2 - supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] }: 1 + { stdenv, lib, buildFHSUserEnv, callPackage, makeDesktopItem, writeScript, 2 + supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] , 3 + unwrapped ? callPackage ./quartus.nix { inherit supportedDevices; } }: 3 4 4 5 let 5 - deviceIds = { 6 - "Arria II" = "arria_lite"; 7 - "Cyclone V" = "cyclonev"; 8 - "Cyclone IV" = "cyclone"; 9 - "Cyclone 10 LP" = "cyclone10lp"; 10 - "MAX II/V" = "max"; 11 - "MAX 10 FPGA" = "max10"; 12 - }; 13 - 14 - supportedDeviceIds = 15 - assert lib.assertMsg (lib.all (name: lib.hasAttr name deviceIds) supportedDevices) 16 - "Supported devices are: ${lib.concatStringsSep ", " (lib.attrNames deviceIds)}"; 17 - lib.listToAttrs (map (name: { 18 - inherit name; 19 - value = deviceIds.${name}; 20 - }) supportedDevices); 21 - 22 - unsupportedDeviceIds = lib.filterAttrs (name: value: 23 - !(lib.hasAttr name supportedDeviceIds) 24 - ) deviceIds; 25 - 26 - quartus = stdenv.mkDerivation rec { 27 - version = "20.1.0.711"; 28 - pname = "quartus-prime-lite-unwrapped"; 29 - 30 - src = let 31 - require = {name, sha256}: requireFile { 32 - inherit name sha256; 33 - url = "${meta.homepage}/${lib.versions.majorMinor version}/?edition=lite&platform=linux"; 34 - }; 35 - 36 - hashes = { 37 - "arria_lite" = "09g2knq23h3vj0s5y7hsdnqbbkr3pnv53dzpqcw2lq9mb5zfs9r0"; 38 - "cyclonev" = "05hrpysasyfb7xhxg68spdffxyvxcx0iagibd5jz643b7n6aalpa"; 39 - "cyclone" = "1x3rnwsvzrb5kwdz35sbcabxmcvj8xxpnjlpcjwfc69ybiyr6sgz"; 40 - "cyclone10lp" = "1x6d4hm697mjgzaxixrw5va8anr6ihhx96x2524r6axpwqf6wcja"; 41 - "max" = "060b7v0xh86kkjyiix7akfkzhx2kl1b3q117kp7xibnz6yrzwmy3"; 42 - "max10" = "05840l9pmqa4i1b3ajfaxkqz1hppls556vbq16a42acz2qs2g578"; 43 - }; 44 - 45 - devicePackages = map (id: { 46 - name = "${id}-${version}.qdz"; 47 - sha256 = lib.getAttr id hashes; 48 - }) (lib.attrValues supportedDeviceIds); 49 - in map require ([{ 50 - name = "QuartusLiteSetup-${version}-linux.run"; 51 - sha256 = "07ssrv8p8kacal6xd80n4h7l5xz13aw1m1gfqqaxig0ivsj971z5"; 52 - } { 53 - name = "ModelSimSetup-${version}-linux.run"; 54 - sha256 = "0smxasrmr1c8k6hy378knskpjmz4cgpgb35v5jclns0kx68y3c42"; 55 - }] ++ devicePackages); 56 - 57 - nativeBuildInputs = [ unstick ]; 58 - 59 - buildCommand = let 60 - installers = lib.sublist 0 2 src; 61 - components = lib.sublist 2 ((lib.length src) - 2) src; 62 - copyInstaller = installer: '' 63 - # `$(cat $NIX_CC/nix-support/dynamic-linker) $src[0]` often segfaults, so cp + patchelf 64 - cp ${installer} $TEMP/${installer.name} 65 - chmod u+w,+x $TEMP/${installer.name} 66 - patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $TEMP/${installer.name} 67 - ''; 68 - copyComponent = component: "cp ${component} $TEMP/${component.name}"; 69 - # leaves enabled: quartus, modelsim_ase, devinfo 70 - disabledComponents = [ 71 - "quartus_help" 72 - "quartus_update" 73 - # not modelsim_ase 74 - "modelsim_ae" 75 - ] ++ (lib.attrValues unsupportedDeviceIds); 76 - in '' 77 - ${lib.concatMapStringsSep "\n" copyInstaller installers} 78 - ${lib.concatMapStringsSep "\n" copyComponent components} 79 - 80 - unstick $TEMP/${(builtins.head installers).name} \ 81 - --disable-components ${lib.concatStringsSep "," disabledComponents} \ 82 - --mode unattended --installdir $out --accept_eula 1 83 - 84 - rm -r $out/uninstall $out/logs 85 - ''; 86 - 87 - meta = { 88 - homepage = "https://fpgasoftware.intel.com"; 89 - description = "FPGA design and simulation software"; 90 - license = lib.licenses.unfree; 91 - platforms = lib.platforms.linux; 92 - hydraPlatforms = [ ]; # requireFile srcs cannot be fetched by hydra, ignore 93 - maintainers = with lib.maintainers; [ kwohlfahrt ]; 94 - }; 95 - }; 96 - 97 6 desktopItem = makeDesktopItem { 98 7 name = "quartus-prime-lite"; 99 8 exec = "quartus"; ··· 102 11 genericName = "Quartus Prime"; 103 12 categories = "Development;"; 104 13 }; 105 - 106 14 # I think modelsim_ase/linux/vlm checksums itself, so use FHSUserEnv instead of `patchelf` 107 15 in buildFHSUserEnv rec { 108 16 name = "quartus-prime-lite"; # wrapped ··· 136 44 xorg.libXrender 137 45 ]; 138 46 139 - passthru = { 140 - unwrapped = quartus; 141 - }; 47 + passthru = { inherit unwrapped; }; 142 48 143 49 extraInstallCommands = let 144 50 quartusExecutables = (map (c: "quartus/bin/quartus_${c}") [ ··· 156 62 in '' 157 63 mkdir -p $out/share/applications $out/share/icons/128x128 158 64 ln -s ${desktopItem}/share/applications/* $out/share/applications 159 - ln -s ${quartus}/licenses/images/dc_quartus_panel_logo.png $out/share/icons/128x128/quartus.png 65 + ln -s ${unwrapped}/licenses/images/dc_quartus_panel_logo.png $out/share/icons/128x128/quartus.png 160 66 161 67 mkdir -p $out/quartus/bin $out/quartus/sopc_builder/bin $out/modelsim_ase/bin 162 68 WRAPPER=$out/bin/${name} 163 69 EXECUTABLES="${lib.concatStringsSep " " (quartusExecutables ++ qsysExecutables ++ modelsimExecutables)}" 164 70 for executable in $EXECUTABLES; do 165 71 echo "#!${stdenv.shell}" >> $out/$executable 166 - echo "$WRAPPER ${quartus}/$executable \$@" >> $out/$executable 72 + echo "$WRAPPER ${unwrapped}/$executable \$@" >> $out/$executable 167 73 done 168 74 169 75 cd $out
+96
pkgs/applications/editors/quartus-prime/quartus.nix
··· 1 + { stdenv, lib, unstick, requireFile, 2 + supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] }: 3 + 4 + let 5 + deviceIds = { 6 + "Arria II" = "arria_lite"; 7 + "Cyclone V" = "cyclonev"; 8 + "Cyclone IV" = "cyclone"; 9 + "Cyclone 10 LP" = "cyclone10lp"; 10 + "MAX II/V" = "max"; 11 + "MAX 10 FPGA" = "max10"; 12 + }; 13 + 14 + supportedDeviceIds = 15 + assert lib.assertMsg (lib.all (name: lib.hasAttr name deviceIds) supportedDevices) 16 + "Supported devices are: ${lib.concatStringsSep ", " (lib.attrNames deviceIds)}"; 17 + lib.listToAttrs (map (name: { 18 + inherit name; 19 + value = deviceIds.${name}; 20 + }) supportedDevices); 21 + 22 + unsupportedDeviceIds = lib.filterAttrs (name: value: 23 + !(lib.hasAttr name supportedDeviceIds) 24 + ) deviceIds; 25 + 26 + componentHashes = { 27 + "arria_lite" = "09g2knq23h3vj0s5y7hsdnqbbkr3pnv53dzpqcw2lq9mb5zfs9r0"; 28 + "cyclonev" = "05hrpysasyfb7xhxg68spdffxyvxcx0iagibd5jz643b7n6aalpa"; 29 + "cyclone" = "1x3rnwsvzrb5kwdz35sbcabxmcvj8xxpnjlpcjwfc69ybiyr6sgz"; 30 + "cyclone10lp" = "1x6d4hm697mjgzaxixrw5va8anr6ihhx96x2524r6axpwqf6wcja"; 31 + "max" = "060b7v0xh86kkjyiix7akfkzhx2kl1b3q117kp7xibnz6yrzwmy3"; 32 + "max10" = "05840l9pmqa4i1b3ajfaxkqz1hppls556vbq16a42acz2qs2g578"; 33 + }; 34 + 35 + version = "20.1.0.711"; 36 + homepage = "https://fpgasoftware.intel.com"; 37 + 38 + require = {name, sha256}: requireFile { 39 + inherit name sha256; 40 + url = "${homepage}/${lib.versions.majorMinor version}/?edition=lite&platform=linux"; 41 + }; 42 + 43 + in stdenv.mkDerivation rec { 44 + inherit version; 45 + pname = "quartus-prime-lite-unwrapped"; 46 + 47 + src = map require ([{ 48 + name = "QuartusLiteSetup-${version}-linux.run"; 49 + sha256 = "07ssrv8p8kacal6xd80n4h7l5xz13aw1m1gfqqaxig0ivsj971z5"; 50 + } { 51 + name = "ModelSimSetup-${version}-linux.run"; 52 + sha256 = "0smxasrmr1c8k6hy378knskpjmz4cgpgb35v5jclns0kx68y3c42"; 53 + }] ++ (map (id: { 54 + name = "${id}-${version}.qdz"; 55 + sha256 = lib.getAttr id componentHashes; 56 + }) (lib.attrValues supportedDeviceIds))); 57 + 58 + nativeBuildInputs = [ unstick ]; 59 + 60 + buildCommand = let 61 + installers = lib.sublist 0 2 src; 62 + components = lib.sublist 2 ((lib.length src) - 2) src; 63 + copyInstaller = installer: '' 64 + # `$(cat $NIX_CC/nix-support/dynamic-linker) $src[0]` often segfaults, so cp + patchelf 65 + cp ${installer} $TEMP/${installer.name} 66 + chmod u+w,+x $TEMP/${installer.name} 67 + patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $TEMP/${installer.name} 68 + ''; 69 + copyComponent = component: "cp ${component} $TEMP/${component.name}"; 70 + # leaves enabled: quartus, modelsim_ase, devinfo 71 + disabledComponents = [ 72 + "quartus_help" 73 + "quartus_update" 74 + # not modelsim_ase 75 + "modelsim_ae" 76 + ] ++ (lib.attrValues unsupportedDeviceIds); 77 + in '' 78 + ${lib.concatMapStringsSep "\n" copyInstaller installers} 79 + ${lib.concatMapStringsSep "\n" copyComponent components} 80 + 81 + unstick $TEMP/${(builtins.head installers).name} \ 82 + --disable-components ${lib.concatStringsSep "," disabledComponents} \ 83 + --mode unattended --installdir $out --accept_eula 1 84 + 85 + rm -r $out/uninstall $out/logs 86 + ''; 87 + 88 + meta = { 89 + inherit homepage; 90 + description = "FPGA design and simulation software"; 91 + license = lib.licenses.unfree; 92 + platforms = lib.platforms.linux; 93 + hydraPlatforms = [ ]; # requireFile srcs cannot be fetched by hydra, ignore 94 + maintainers = with lib.maintainers; [ kwohlfahrt ]; 95 + }; 96 + }