nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, makeDesktopItem
5, copyDesktopItems
6, pkg-config
7, gtk3
8, alsa-lib
9}:
10
11stdenv.mkDerivation rec {
12 pname = "free42";
13 version = "3.0.20";
14
15 src = fetchFromGitHub {
16 owner = "thomasokken";
17 repo = pname;
18 rev = "v${version}";
19 hash = "sha256-Dqrys7bAkSnpbOF0D17RDYi7q47ExlM75d5OOAnHCVU=";
20 };
21
22 nativeBuildInputs = [
23 copyDesktopItems
24 pkg-config
25 ];
26
27 buildInputs = [
28 alsa-lib
29 gtk3
30 ];
31
32 postPatch = ''
33 sed -i -e "s|/bin/ls|ls|" gtk/Makefile
34 '';
35
36 dontConfigure = true;
37
38 buildPhase = ''
39 runHook preBuild
40
41 make -C gtk cleaner
42 make --jobs=$NIX_BUILD_CORES -C gtk
43 make -C gtk clean
44 make --jobs=$NIX_BUILD_CORES -C gtk BCD_MATH=1
45
46 runHook postBuild
47 '';
48
49 installPhase = ''
50 runHook preInstall
51
52 install --directory $out/bin \
53 $out/share/doc/${pname} \
54 $out/share/${pname}/skins \
55 $out/share/icons/hicolor/48x48/apps \
56 $out/share/icons/hicolor/128x128/apps
57
58 install -m755 gtk/free42dec gtk/free42bin $out/bin
59 install -m644 gtk/README $out/share/doc/${pname}/README-GTK
60 install -m644 README $out/share/doc/${pname}/README
61
62 install -m644 gtk/icon-48x48.xpm $out/share/icons/hicolor/48x48/apps
63 install -m644 gtk/icon-128x128.xpm $out/share/icons/hicolor/128x128/apps
64 install -m644 skins/* $out/share/${pname}/skins
65
66 runHook postInstall
67 '';
68
69 desktopItems = [
70 (makeDesktopItem {
71 name = "com.thomasokken.free42bin";
72 desktopName = "Free42Bin";
73 genericName = "Calculator";
74 exec = "free42bin";
75 type = "Application";
76 comment = meta.description;
77 categories = [ "Utility" "Calculator" ];
78 })
79 (makeDesktopItem {
80 name = "com.thomasokken.free42dec";
81 desktopName = "Free42Dec";
82 genericName = "Calculator";
83 exec = "free42dec";
84 type = "Application";
85 comment = meta.description;
86 categories = [ "Utility" "Calculator" ];
87 })
88 ];
89
90 meta = with lib; {
91 homepage = "https://github.com/thomasokken/free42";
92 description = "A software clone of HP-42S Calculator";
93 license = licenses.gpl2Only;
94 maintainers = with maintainers; [ AndersonTorres plabadens ];
95 platforms = with platforms; unix;
96 };
97}