nixpkgs/pkgs/by-name/lo/logisim/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

67 lines
1.6 KiB
Nix

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