1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 20:21:14 +00:00
nixpkgs/pkgs/games/freenukum/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

73 lines
1.6 KiB
Nix

{ lib, stdenv
, rustPlatform
, fetchFromGitLab
, makeDesktopItem
, installShellFiles
, dejavu_fonts
, SDL2
, SDL2_ttf
}:
let
pname = "freenukum";
description = "Clone of the original Duke Nukum 1 Jump'n Run game";
desktopItem = makeDesktopItem {
desktopName = pname;
name = pname;
exec = pname;
icon = pname;
terminal = "false";
comment = description;
type = "Application";
categories = "Game;ArcadeGame;ActionGame";
genericName = pname;
fileValidation = false;
};
in
rustPlatform.buildRustPackage rec {
inherit pname;
version = "0.3.5";
src = fetchFromGitLab {
owner = "silwol";
repo = pname;
rev = "v${version}";
sha256 = "0yqfzh0c8fqk92q9kmidy15dc5li0ak1gbn3v7p3xw5fkrzf99gy";
};
cargoSha256 = "1mi98ccp4026gdc5x9jc6518zb7z4dplxl8vir78ivgdpifzz4pw";
nativeBuildInputs = [
installShellFiles
];
buildInputs = [
SDL2
SDL2_ttf
];
postPatch = ''
substituteInPlace src/graphics.rs \
--replace /usr $out
'';
postInstall = ''
mkdir -p $out/share/fonts/truetype/dejavu
ln -sf \
${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf \
$out/share/fonts/truetype/dejavu/DejaVuSans.ttf
mkdir -p $out/share/doc/freenukum
install -Dm644 README.md CHANGELOG.md COPYING $out/share/doc/freenukum/
installManPage doc/freenukum.6
install -Dm644 "${desktopItem}/share/applications/"* -t $out/share/applications/
'';
meta = with lib; {
description = "Clone of the original Duke Nukum 1 Jump'n Run game";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ _0x4A6F ];
broken = stdenv.isDarwin;
};
}