Files
nixpkgs/pkgs/by-name/ic/icestudio/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

128 lines
3.3 KiB
Nix

{
lib,
fetchurl,
fetchFromGitHub,
buildNpmPackage,
makeDesktopItem,
makeWrapper,
unstableGitUpdater,
nwjs,
python3,
}:
let
# Use unstable because it has improvements for finding python
version = "0.12-unstable-2025-08-19";
src = fetchFromGitHub {
owner = "FPGAwars";
repo = "icestudio";
rev = "8bc0391117bd3639881ed947e49e4cd37c199a95";
hash = "sha256-GWG6FvBiowgiW7MWKxCOivmDbb5YveZR6Nn3foLifwY=";
};
collection = fetchurl {
url = "https://github.com/FPGAwars/collection-default/archive/v0.4.1.zip";
hash = "sha256-F2cAqkTPC7xfGnPQiS8lTrD4y34EkHFUEDPVaYzVVg8=";
};
app = buildNpmPackage {
pname = "icestudio-app";
inherit version src;
npmDepsHash = "sha256-Dpnx23iq0fK191DXFgIfnbi+MLEp65H6eL81Icg4H4U=";
sourceRoot = "${src.name}/app";
dontNpmBuild = true;
installPhase = ''
cp -r . $out
'';
};
desktopItem = makeDesktopItem {
desktopName = "Icestudio";
comment = "Visual editor for open FPGA boards";
name = "icestudio";
exec = "icestudio";
icon = "icestudio";
terminal = false;
categories = [ "Development" ];
};
in
buildNpmPackage rec {
pname = "icestudio";
inherit version src;
npmDepsHash = "sha256-QHd4d0BQXqAs/4WnnawCW/tJvSbWOz++RwomNG4XBuU=";
npmFlags = [
# Use the legacy dependency resolution, with less strict version
# requirements for transative dependencies
"--legacy-peer-deps"
# We want to avoid call the scripts/postInstall.sh until we copy the
# collection and app derivation we do that on installPhase
"--ignore-scripts"
];
buildPhase = ''
runHook preBuild
# Copy the `app` derivation into the folder expected for grunt
cp -r ${app}/* app
# Copy the cached `collection` derivation into the cache location so that
# grunt avoids downloading it
install -m444 -D ${collection} cache/collection/collection-default.zip
./node_modules/.bin/grunt getcollection
# Use grunt to distribute package
# TODO: support aarch64
./node_modules/.bin/grunt dist \
--platform=none `# skip platform-specific steps` \
--dont-build-nwjs `# use the nwjs package shipped by Nix` \
--dont-clean-tmp `# skip cleaning the tmp folder as we'll use it in $out`
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist/tmp $out
for size in 16 32 64 128 256; do
install -Dm644 docs/resources/icons/"$size"x"$size"/apps/icon.png \
$out/share/icons/hicolor/"$size"x"$size"/apps/icestudio.png
done
install -Dm644 ${desktopItem}/share/applications/icestudio.desktop -t $out/share/applications
makeWrapper ${nwjs}/bin/nw $out/bin/${pname} \
--add-flags $out \
--prefix PATH : "${python3}/bin"
runHook postInstall
'';
passthru.updateScript = unstableGitUpdater {
tagPrefix = "v";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python3 ];
meta = {
description = "Visual editor for open FPGA boards";
homepage = "https://github.com/FPGAwars/icestudio/";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [
kiike
jleightcap
rcoeurjoly
amerino
];
teams = [ lib.teams.ngi ];
mainProgram = "icestudio";
platforms = lib.platforms.linux;
};
}