2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, jre
|
|
|
|
, makeBinaryWrapper
|
|
|
|
, copyDesktopItems
|
|
|
|
, makeDesktopItem
|
|
|
|
, desktopToDarwinBundle
|
|
|
|
, unzip
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "logisim";
|
2021-07-21 07:28:18 +00:00
|
|
|
version = "2.7.1";
|
2021-01-17 00:15:33 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
2024-04-21 15:54:59 +00:00
|
|
|
url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor finalAttrs.version}.x/${finalAttrs.version}/logisim-generic-${finalAttrs.version}.jar";
|
|
|
|
hash = "sha256-Nip4wSrRjCA/7YaIcsSgHNnBIUE3nZLokrviw35ie8I=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-07-21 07:28:18 +00:00
|
|
|
dontUnpack = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeBinaryWrapper
|
|
|
|
copyDesktopItems
|
|
|
|
unzip
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-04-21 15:54:59 +00:00
|
|
|
desktopToDarwinBundle
|
|
|
|
];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
2024-04-21 15:54:59 +00:00
|
|
|
name = "logisim";
|
2021-08-05 21:33:18 +00:00
|
|
|
desktopName = "Logisim";
|
|
|
|
exec = "logisim";
|
|
|
|
icon = "logisim";
|
2024-04-21 15:54:59 +00:00
|
|
|
comment = finalAttrs.meta.description;
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Education" ];
|
2021-08-05 21:33:18 +00:00
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-08-05 21:33:18 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
mkdir -p $out/bin
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/logisim --add-flags "-jar $src"
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
# Create icons
|
|
|
|
unzip $src "resources/logisim/img/*"
|
|
|
|
for size in 16 20 24 48 64 128
|
|
|
|
do
|
2024-04-21 15:54:59 +00:00
|
|
|
install -Dm444 "./resources/logisim/img/logisim-icon-$size.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/logisim.png"
|
2021-08-05 21:33:18 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-01-17 00:15:33 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
meta = {
|
2021-08-05 21:33:18 +00:00
|
|
|
homepage = "http://www.cburch.com/logisim/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Educational tool for designing and simulating digital logic circuits";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "logisim";
|
|
|
|
maintainers = with lib.maintainers; [ emilytrau ];
|
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
|
|
|
license = lib.licenses.gpl2Only;
|
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
})
|