nixos/filesystems: don't silently ignore label when device is set (#361418)
[NixPkgs.git] / pkgs / by-name / lo / logisim / package.nix
blob951d5b22deef069dd4877a52f985dfa3728f90a5
1 { lib
2 , stdenv
3 , fetchurl
4 , jre
5 , makeBinaryWrapper
6 , copyDesktopItems
7 , makeDesktopItem
8 , desktopToDarwinBundle
9 , unzip
12 stdenv.mkDerivation (finalAttrs: {
13   pname = "logisim";
14   version = "2.7.1";
16   src = fetchurl {
17     url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor finalAttrs.version}.x/${finalAttrs.version}/logisim-generic-${finalAttrs.version}.jar";
18     hash = "sha256-Nip4wSrRjCA/7YaIcsSgHNnBIUE3nZLokrviw35ie8I=";
19   };
20   dontUnpack = true;
22   nativeBuildInputs = [
23     makeBinaryWrapper
24     copyDesktopItems
25     unzip
26   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
27     desktopToDarwinBundle
28   ];
30   desktopItems = [
31     (makeDesktopItem {
32       name = "logisim";
33       desktopName = "Logisim";
34       exec = "logisim";
35       icon = "logisim";
36       comment = finalAttrs.meta.description;
37       categories = [ "Education" ];
38     })
39   ];
41   installPhase = ''
42     runHook preInstall
44     mkdir -p $out/bin
45     makeWrapper ${jre}/bin/java $out/bin/logisim --add-flags "-jar $src"
47     # Create icons
48     unzip $src "resources/logisim/img/*"
49     for size in 16 20 24 48 64 128
50     do
51       install -Dm444 "./resources/logisim/img/logisim-icon-$size.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/logisim.png"
52     done
54     runHook postInstall
55   '';
57   meta = {
58     homepage = "http://www.cburch.com/logisim/";
59     description = "Educational tool for designing and simulating digital logic circuits";
60     mainProgram = "logisim";
61     maintainers = with lib.maintainers; [ emilytrau ];
62     sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
63     license = lib.licenses.gpl2Only;
64     platforms = lib.platforms.unix;
65   };