From b0dac58dc1b14b4d433f2e95cb48828290a3971e Mon Sep 17 00:00:00 2001 From: Kai Wohlfahrt Date: Sat, 14 Dec 2019 11:22:39 +0000 Subject: [PATCH 1/3] maintainers: add kwohlfahrt --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index bdeed800890f..2b29cef78d1f 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -3844,6 +3844,12 @@ githubId = 449813; name = "Roman Kuznetsov"; }; + kwohlfahrt = { + email = "kai.wohlfahrt@gmail.com"; + github = "kwohlfahrt"; + githubId = 2422454; + name = "Kai Wohlfahrt"; + }; kylesferrazza = { name = "Kyle Sferrazza"; email = "kyle.sferrazza@gmail.com"; From 733113ed97e07d4f6461f4201e3302523b4d6157 Mon Sep 17 00:00:00 2001 From: Kai Wohlfahrt Date: Fri, 13 Dec 2019 13:40:05 +0000 Subject: [PATCH 2/3] unstick: init at 0.1.0 --- pkgs/os-specific/linux/unstick/default.nix | 26 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/os-specific/linux/unstick/default.nix diff --git a/pkgs/os-specific/linux/unstick/default.nix b/pkgs/os-specific/linux/unstick/default.nix new file mode 100644 index 000000000000..cca6e6210cb6 --- /dev/null +++ b/pkgs/os-specific/linux/unstick/default.nix @@ -0,0 +1,26 @@ +{ stdenv, lib, fetchFromGitHub, meson, ninja, pkgconfig, libseccomp }: + +stdenv.mkDerivation rec { + name = "unstick"; + version = "0.1.0"; + + src = fetchFromGitHub { + owner = "kwohlfahrt"; + repo = name; + rev = "effee9aa242ca12dc94cc6e96bc073f4cc9e8657"; + sha256 = "08la3jmmzlf4pm48bf9zx4cqj9gbqalpqy0s57bh5vfsdk74nnhv"; + }; + + sourceRoot = "source/src"; + + nativeBuildInputs = [ meson ninja pkgconfig ]; + buildInputs = [ libseccomp ]; + + meta = { + homepage = "https://github.com/kwohlfahrt/unstick"; + description = "Silently eats chmod commands forbidden by Nix"; + license = lib.licenses.gpl3; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ kwohlfahrt ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 245abf731dda..562ffc315f77 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25808,4 +25808,6 @@ in sentencepiece = callPackage ../development/libraries/sentencepiece {}; kcli = callPackage ../development/tools/kcli {}; + + unstick = callPackage ../os-specific/linux/unstick {}; } From 38e6c845dcaf8b0b2c4526ce7fe25f954a840883 Mon Sep 17 00:00:00 2001 From: Kai Wohlfahrt Date: Wed, 11 Dec 2019 21:25:48 +0000 Subject: [PATCH 3/3] quartus: init at 19.1.0.670 This requires a FHSUserEnv because the licensing executable checksums itself (I think). The override of libpng is a bit ugly, can this be cleaned up? --- .../editors/quartus-prime/default.nix | 119 ++++++++++++++++++ .../editors/quartus-prime/vsim.patch | 11 ++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 132 insertions(+) create mode 100644 pkgs/applications/editors/quartus-prime/default.nix create mode 100644 pkgs/applications/editors/quartus-prime/vsim.patch diff --git a/pkgs/applications/editors/quartus-prime/default.nix b/pkgs/applications/editors/quartus-prime/default.nix new file mode 100644 index 000000000000..6a6ea80ca458 --- /dev/null +++ b/pkgs/applications/editors/quartus-prime/default.nix @@ -0,0 +1,119 @@ +{ buildFHSUserEnv, makeDesktopItem, stdenv, lib, requireFile, unstick, cycloneVSupport ? true }: + +let + quartus = stdenv.mkDerivation rec { + version = "19.1.0.670"; + pname = "quartus-prime-lite"; + + src = let + require = {name, sha256}: requireFile { + inherit name sha256; + url = "${meta.homepage}/${lib.versions.majorMinor version}/?edition=lite&platform=linux"; + }; + in map require ([{ + name = "QuartusLiteSetup-${version}-linux.run"; + sha256 = "15vxvqxqdk29ahlw3lkm1nzxyhzy4626wb9s5f2h6sjgq64r8m7f"; + } { + name = "ModelSimSetup-${version}-linux.run"; + sha256 = "0j1vfr91jclv88nam2plx68arxmz4g50sqb840i60wqd5b0l3y6r"; + }] ++ lib.optional cycloneVSupport { + name = "cyclonev-${version}.qdz"; + sha256 = "0bqxpvjgph0y6slk0jq75mcqzglmqkm0jsx10y9xz5llm6zxzqab"; + }); + + nativeBuildInputs = [ unstick ]; + + buildCommand = let + installers = lib.sublist 0 2 src; + components = lib.sublist 2 ((lib.length src) - 2) src; + 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}"; + # leaves enabled: quartus, modelsim_ase, devinfo + disabledComponents = [ + "quartus_help" + "quartus_update" + "modelsim_ae" + # Devices + "arria_lite" + "cyclone" + "cyclone10lp" + "max" + "max10" + ] ++ lib.optional (!cycloneVSupport) "cyclonev"; + in '' + ${lib.concatMapStringsSep "\n" copyInstaller installers} + ${lib.concatMapStringsSep "\n" copyComponent components} + + unstick $TEMP/${(builtins.head installers).name} \ + --disable-components ${lib.concatStringsSep "," disabledComponents} \ + --mode unattended --installdir $out --accept_eula 1 + + # This patch is from https://wiki.archlinux.org/index.php/Altera_Design_Software + patch --force --strip 0 --directory $out < ${./vsim.patch} + + rm -r $out/uninstall $out/logs + ''; + + meta = { + homepage = "https://fpgasoftware.intel.com"; + description = "FPGA design and simulation software"; + license = lib.licenses.unfree; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ kwohlfahrt ]; + }; + }; + + desktopItem = makeDesktopItem { + name = quartus.name; + exec = "quartus"; + icon = "quartus"; + desktopName = "Quartus"; + genericName = "Quartus FPGA IDE"; + categories = "Development;"; + }; + +# I think modelsim_ase/linux/vlm checksums itself, so use FHSUserEnv instead of `patchelf` +in buildFHSUserEnv { + name = "quartus-prime-lite"; + + targetPkgs = pkgs: with pkgs; [ + # quartus requirements + glib + xorg.libICE + xorg.libSM + zlib + # qsys requirements + xorg.libXtst + xorg.libXi + ]; + multiPkgs = pkgs: with pkgs; let + # This seems ugly - can we override `libpng = libpng12` for all `pkgs`? + freetype = pkgs.freetype.override { libpng = libpng12; }; + fontconfig = pkgs.fontconfig.override { inherit freetype; }; + libXft = pkgs.xorg.libXft.override { inherit freetype fontconfig; }; + in [ + # modelsim requirements + libxml2 + ncurses5 + unixODBC + libXft + # common requirements + freetype + fontconfig + xorg.libX11 + xorg.libXext + xorg.libXrender + ]; + + extraInstallCommands = '' + mkdir -p $out/share/applications + cp ${desktopItem}/share/applications/* $out/share/applications + ''; + + runScript = "${quartus}/quartus/bin/quartus"; +} diff --git a/pkgs/applications/editors/quartus-prime/vsim.patch b/pkgs/applications/editors/quartus-prime/vsim.patch new file mode 100644 index 000000000000..36dc41b7ef14 --- /dev/null +++ b/pkgs/applications/editors/quartus-prime/vsim.patch @@ -0,0 +1,11 @@ +--- modelsim_ase/vco 1970-01-01 01:00:01.000000000 +0100 ++++ modelsim_ase/vco 1970-01-01 01:00:01.000000000 +0100 +@@ -207,7 +207,7 @@ + 2.[5-9]*) vco="linux" ;; + 2.[1-9][0-9]*) vco="linux" ;; + 3.[0-9]*) vco="linux" ;; +- *) vco="linux_rh60" ;; ++ *) vco="linux" ;; + esac + if [ ! -x "$dir/$vco/vsim" ]; then + if [ -x "$dir/linuxle/vsim" ]; then diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 562ffc315f77..b3595bd494a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25810,4 +25810,6 @@ in kcli = callPackage ../development/tools/kcli {}; unstick = callPackage ../os-specific/linux/unstick {}; + + quartus-prime-lite = callPackage ../applications/editors/quartus-prime {}; }