diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index b27cf6166f6a7..c71f1665ed57b 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -14164,6 +14164,12 @@ githubId = 16027994; name = "Nathan Viets"; }; + nyadiia = { + email = "nyadiia@pm.me"; + github = "nyadiia"; + githubId = "43252360"; + name = "Nadia"; + }; nyanbinary = { email = "nyanbinary@keemail.me"; matrix = "@niko:conduit.rs"; diff --git a/pkgs/by-name/mi/microchip-xc-dsc/package.nix b/pkgs/by-name/mi/microchip-xc-dsc/package.nix new file mode 100644 index 0000000000000..9c99f54af87a9 --- /dev/null +++ b/pkgs/by-name/mi/microchip-xc-dsc/package.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc-dsc-unwrapped"; + version = "3.00"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc-dsc-v${version}-full-install-linux64-installer.run"; + hash = "sha256-129EUXfFQP2p3bdoRLIlZQqg+Dy5ZJLBjHcLbxsw4bw="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all dsPIC DSCs"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/mi/microchip-xc16/package.nix b/pkgs/by-name/mi/microchip-xc16/package.nix new file mode 100644 index 0000000000000..ba9bdd936d8eb --- /dev/null +++ b/pkgs/by-name/mi/microchip-xc16/package.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc16-unwrapped"; + version = "2.10"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc16-v${version}-full-install-linux64-installer.run"; + hash = "sha256-1k1ec5Hshi1N0Wk2G2aAtyX4lgQ1EhcJtF6xpK/hXcg="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all 16-bit PIC microcontrollers (MCUs)"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/mi/microchip-xc32/package.nix b/pkgs/by-name/mi/microchip-xc32/package.nix new file mode 100644 index 0000000000000..4458ac65cdb40 --- /dev/null +++ b/pkgs/by-name/mi/microchip-xc32/package.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc32-unwrapped"; + version = "4.35"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc32-v${version}-full-install-linux-x64-installer.run"; + hash = "sha256-TYRPGJZMn9LEoLgvITGB++xBKHzf+2s/GLSNZu/+f9Y="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all 32-bit PIC and SAM MCUs and MPUs featuring Arm® and MIPS® cores"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/mi/microchip-xc8/package.nix b/pkgs/by-name/mi/microchip-xc8/package.nix new file mode 100644 index 0000000000000..22caf0982e8b8 --- /dev/null +++ b/pkgs/by-name/mi/microchip-xc8/package.nix @@ -0,0 +1,63 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in +stdenvNoCC.mkDerivation rec { + pname = "microchip-xc8-unwrapped"; + version = "2.46"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v${version}-full-install-linux-x64-installer.run"; + hash = "sha256-FlWPjPEKpq+Nla3ucC4+VwWIEM+0Tsdf1LveAYV2CSs="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --debuglevel 4 \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC8 C compiler toolchain for all 8-bit PIC® and AVR® microcontrollers (MCUs)."; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/mp/mplab-x-unwrapped/package.nix b/pkgs/by-name/mp/mplab-x-unwrapped/package.nix new file mode 100644 index 0000000000000..2afb5069e4f0a --- /dev/null +++ b/pkgs/by-name/mp/mplab-x-unwrapped/package.nix @@ -0,0 +1,84 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in +stdenvNoCC.mkDerivation rec { + pname = "mplab-x-unwrapped"; + version = "6.15"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/MPLABX-v${version}-linux-installer.tar"; + hash = "sha256-ZiiijuCC4cOfJ5MdMDZ+LyUAzqIJDLTN93nKoZtpTGE="; + # The Microchip server requires this Referer to allow the download. + curlOptsList = [ + "--referer" + "https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide" + ]; + }; + + outputs = [ "out" ]; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + tar xf $src MPLABX-v${version}-linux-installer.sh + sh MPLABX-v${version}-linux-installer.sh \ + --tar xf ./MPLABX-v${version}-linux-installer.run + + runHook postUnpack + ''; + buildPhase = '' + runHook preBuild + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --ro-bind /nix /nix \ + --ro-bind MPLABX-v${version}-linux-installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer --mode unattended + + # rm -r chroot/opt/microchip/mplabx/v${version}/sys + + runHook postBuild + ''; + installPhase = '' + runHook preInstall + + mkdir -p $out/etc $out/usr/share $out/lib/udev/ + cp -r chroot/etc/.mplab_ide $out/etc/ + cp -r chroot/etc/udev $out/etc/ + cp -r chroot/etc/udev/rules.d $out/lib/udev/ + cp -r chroot/usr/share/applications chroot/usr/share/icons $out/usr/share/ + cp -r chroot/opt $out/ + # cp -r chroot/usr/lib/udev + + runHook postInstall + ''; + dontFixup = true; + + passthru = { inherit fhsEnv; }; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide"; + description = + "An expandable, highly configurable software program that incorporates powerful tools to help you discover, configure, develop, debug and qualify embedded designs for most of Microchip's microcontrollers and digital signal controllers."; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/by-name/mp/mplab-x/package.nix b/pkgs/by-name/mp/mplab-x/package.nix new file mode 100644 index 0000000000000..a2387a175d8b9 --- /dev/null +++ b/pkgs/by-name/mp/mplab-x/package.nix @@ -0,0 +1,132 @@ +{ lib +, alsa-lib +, at-spi2-atk +, buildFHSEnv +, cairo +, corefonts +, cups +, dbus +, execline +, fuse-overlayfs +, expat +, glib +, glibc +, gtk2 +, gtk3 +, gtk-engine-murrine +, libdrm +, libxkbcommon +, libusb1 +, libxslt +, mesa +, mplab-x-unwrapped +, nspr +, nss +, pango +, rsync +, systemdLibs +, writeShellApplication +, xorg +# , microchip-xc8 +, microchip-xc16 +# , microchip-xc32 +# , microchip-xc-dsc +}: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-fhs-env"; + targetPkgs = pkgs: [ + alsa-lib + at-spi2-atk + cairo + corefonts + cups + dbus + expat + glib + glibc + gtk2 + gtk3 + gtk-engine-murrine + libdrm + libxkbcommon + libxslt + libusb1 + mesa + nspr + nss + pango + systemdLibs + xorg.libX11 + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXi + xorg.libXrandr + xorg.libXrender + xorg.libXtst + xorg.libxcb + ]; + }; + + stage2 = writeShellApplication { + name = "mplab_ide-wrapper"; + runtimeInputs = [ execline fuse-overlayfs rsync ]; + # mkdir "$rt/overlay/opt/microchip/xc8" + # ln -s ${microchip-xc8} "$rt/overlay/opt/microchip/xc8/v${microchip-xc8.version}" + # mkdir "$rt/overlay/opt/microchip/xc32" + # ln -s ${microchip-xc32} "$rt/overlay/opt/microchip/xc32/v${microchip-xc32.version}" + # mkdir "$rt/overlay/opt/microchip/xc-dsc" + # ln -s ${microchip-xc-dsc} "$rt/overlay/opt/microchip/xc-dsc/v${microchip-xc-dsc.version}" + text = '' + # Make the rt directory, isolated from the host filesystem. + rt="$XDG_RUNTIME_DIR/mplab-x" + mkdir -p "$rt" + mount -t tmpfs mplab-x-wrapper "$rt" + + # Make and populate the overlay subdirectory. + mkdir -p "$rt/overlay/opt/microchip" + rsync -rlp ${fhsEnv.fhsenv}/ "$rt/overlay/" + rsync -rlp ${mplab-x-unwrapped}/etc/ "$rt/overlay/etc/" + rsync -rlp ${mplab-x-unwrapped}/lib/udev "$rt/overlay/lib/udev/" + ln -s "$HOME" "$rt/overlay/root" + for f in ${mplab-x-unwrapped}/opt/microchip/*; do + ln -s "$f" "$rt/overlay/opt/microchip/" + done + + mkdir "$rt/overlay/opt/microchip/xc16" + ln -s ${microchip-xc16} "$rt/overlay/opt/microchip/xc16/v${microchip-xc16.version}" + + # Make and mount (with FUSE) the newroot subdirectory. + mkdir "$rt/newroot" + fuse-overlayfs -o lowerdir="$rt/overlay":/ "$rt/newroot" + trap 'fusermount -zu "$rt/newroot"' EXIT + + # Bind mount some subtrees we want to make mutable. + mount --rbind /dev "$rt/newroot/dev" + mount --rbind /home "$rt/newroot/home" + mount --rbind /proc "$rt/newroot/proc" + mount --rbind /run "$rt/newroot/run" + mount --rbind /tmp "$rt/newroot/tmp" + mount --rbind /var "$rt/newroot/var" + + # Chroot into the new rootfs and launch the IDE. + export LD_LIBRARY_PATH="/lib''${LD_LIBRARY_PATH:+:}''${LD_LIBRARY_PATH:-}" + chroot "$rt/newroot" execline-cd "$(pwd)" \ + ${mplab-x-unwrapped}/opt/microchip/mplabx/v${mplab-x-unwrapped.version}/mplab_platform/bin/mplab_ide + ''; + + inherit (mplab-x-unwrapped) meta; + }; + +in +writeShellApplication { + name = "mplab_ide"; + text = '' + unshare -mUr -- ${lib.getExe stage2} "$@" + ''; + + inherit (mplab-x-unwrapped) meta; +} diff --git a/pkgs/development/compilers/microchip/xc-dsc/default.nix b/pkgs/development/compilers/microchip/xc-dsc/default.nix new file mode 100644 index 0000000000000..9c99f54af87a9 --- /dev/null +++ b/pkgs/development/compilers/microchip/xc-dsc/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc-dsc-unwrapped"; + version = "3.00"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc-dsc-v${version}-full-install-linux64-installer.run"; + hash = "sha256-129EUXfFQP2p3bdoRLIlZQqg+Dy5ZJLBjHcLbxsw4bw="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all dsPIC DSCs"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/compilers/microchip/xc16/default.nix b/pkgs/development/compilers/microchip/xc16/default.nix new file mode 100644 index 0000000000000..ba9bdd936d8eb --- /dev/null +++ b/pkgs/development/compilers/microchip/xc16/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc16-unwrapped"; + version = "2.10"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc16-v${version}-full-install-linux64-installer.run"; + hash = "sha256-1k1ec5Hshi1N0Wk2G2aAtyX4lgQ1EhcJtF6xpK/hXcg="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all 16-bit PIC microcontrollers (MCUs)"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/compilers/microchip/xc32/default.nix b/pkgs/development/compilers/microchip/xc32/default.nix new file mode 100644 index 0000000000000..4458ac65cdb40 --- /dev/null +++ b/pkgs/development/compilers/microchip/xc32/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in stdenvNoCC.mkDerivation rec { + pname = "microchip-xc32-unwrapped"; + version = "4.35"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc32-v${version}-full-install-linux-x64-installer.run"; + hash = "sha256-TYRPGJZMn9LEoLgvITGB++xBKHzf+2s/GLSNZu/+f9Y="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC16 C compiler toolchain for all 32-bit PIC and SAM MCUs and MPUs featuring Arm® and MIPS® cores"; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/development/compilers/microchip/xc8/default.nix b/pkgs/development/compilers/microchip/xc8/default.nix new file mode 100644 index 0000000000000..22caf0982e8b8 --- /dev/null +++ b/pkgs/development/compilers/microchip/xc8/default.nix @@ -0,0 +1,63 @@ +{ lib, stdenvNoCC, bubblewrap, buildFHSEnv, fakeroot, fetchurl, glibc, rsync }: + +let + fhsEnv = buildFHSEnv { + name = "mplab-x-build-fhs-env"; + targetPkgs = pkgs: [ fakeroot glibc ]; + }; + +in +stdenvNoCC.mkDerivation rec { + pname = "microchip-xc8-unwrapped"; + version = "2.46"; + + src = fetchurl { + url = + "https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v${version}-full-install-linux-x64-installer.run"; + hash = "sha256-FlWPjPEKpq+Nla3ucC4+VwWIEM+0Tsdf1LveAYV2CSs="; + }; + + nativeBuildInputs = [ bubblewrap rsync ]; + + unpackPhase = '' + runHook preUnpack + + install $src installer.run + + runHook postUnpack + ''; + installPhase = '' + runHook preInstall + + rsync -a ${fhsEnv.fhsenv}/ chroot/ + find chroot -type d -exec chmod 755 {} \; + echo "root:x:0:0:root:/root:/bin/bash" > chroot/etc/passwd + echo "root:x:0:root" > chroot/etc/group + mkdir -p chroot/tmp/home + + bwrap \ + --bind chroot / \ + --bind /nix /nix \ + --ro-bind installer.run /installer \ + --setenv HOME /tmp/home \ + -- /bin/fakeroot /installer \ + --debuglevel 4 \ + --LicenseType FreeMode \ + --mode unattended \ + --netservername localhost \ + --prefix $out + + runHook postInstall + ''; + dontFixup = true; + + meta = with lib; { + homepage = + "https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers"; + description = + "Microchip's MPLAB XC8 C compiler toolchain for all 8-bit PIC® and AVR® microcontrollers (MCUs)."; + license = licenses.unfree; + maintainers = with maintainers; [ remexre nyadiia ]; + platforms = [ "x86_64-linux" ]; + }; +}