Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / freenukum / default.nix
blobed6c41edac44d160a91300c25bd16186e04026f9
1 { lib, stdenv
2 , rustPlatform
3 , fetchFromGitLab
4 , makeDesktopItem
5 , installShellFiles
6 , dejavu_fonts
7 , SDL2
8 , SDL2_ttf
9 , SDL2_image
11 let
12   pname = "freenukum";
13   description = "Clone of the original Duke Nukum 1 Jump'n Run game";
15   desktopItem = makeDesktopItem {
16     desktopName = pname;
17     name = pname;
18     exec = pname;
19     icon = pname;
20     comment = description;
21     categories = [ "Game" "ArcadeGame" "ActionGame" ];
22     genericName = pname;
23   };
26 rustPlatform.buildRustPackage rec {
27   inherit pname;
28   version = "0.4.0";
30   src = fetchFromGitLab {
31     domain = "salsa.debian.org";
32     owner = "silwol";
33     repo = "freenukum";
34     rev = "v${version}";
35     hash = "sha256-Tk9n2gPwyPin6JZ4RSO8d/+xVpEz4rF8C2eGKwrAXU0=";
36   };
38   cargoSha256 = "sha256-8RfiObWDqZJg+sjjDBk+sRoS5CiECIdNPH79T+O8e8M=";
40   nativeBuildInputs = [
41     installShellFiles
42   ];
44   buildInputs = [
45     SDL2
46     SDL2_ttf
47     SDL2_image
48   ];
50   postPatch = ''
51     substituteInPlace src/graphics.rs \
52       --replace /usr $out
53   '';
55   postInstall = ''
56     mkdir -p $out/share/fonts/truetype/dejavu
57     ln -sf \
58       ${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf \
59       $out/share/fonts/truetype/dejavu/DejaVuSans.ttf
60     mkdir -p $out/share/doc/freenukum
61     install -Dm644 README.md CHANGELOG.md $out/share/doc/freenukum/
62     installManPage doc/freenukum.6
63     install -Dm644 "${desktopItem}/share/applications/"* -t $out/share/applications/
64   '';
66   meta = with lib; {
67     description = "Clone of the original Duke Nukum 1 Jump'n Run game";
68     homepage = "https://salsa.debian.org/silwol/freenukum";
69     changelog = "https://salsa.debian.org/silwol/freenukum/-/blob/v${version}/CHANGELOG.md";
70     license = licenses.agpl3Plus;
71     maintainers = with maintainers; [ _0x4A6F ];
72     broken = stdenv.isDarwin;
73   };