nixpkgs/pkgs/by-name/ke/keeperrl/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

93 lines
2.0 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, requireFile
, openal
, curl
, libogg
, libvorbis
, SDL2
, SDL2_image
, zlib
, clang
, libtheora
, unfree_assets ? false }:
let
pname = "keeperrl";
version = "alpha34";
free_src = fetchFromGitHub {
owner = "miki151";
repo = pname;
rev = version;
sha256 = "sha256-0sww+ppctXvxMouclG3OdXpcNgrrOZJw9z8s2GhJ+IE=";
};
assets = requireFile rec {
name = "keeperrl_data_${version}.tar.gz";
message = ''
This nix expression requires that the KeeperRL art assets are already
part of the store. These can be obtained from a purchased copy of the game
and found in the "data" directory. Make a tar archive of this directory
with
"tar czf ${name} data"
Then add this archive to the nix store with
"nix-prefetch-url file://\$PWD/${name}".
'';
sha256 = "0115pxdzdyma2vicxgr0j21pp82gxdyrlj090s8ihp0b50f0nlll";
};
in
stdenv.mkDerivation {
inherit pname version;
srcs = [ free_src ] ++ lib.optional unfree_assets assets;
sourceRoot = free_src.name;
postUnpack = lib.optionalString unfree_assets ''
mv data $sourceRoot
'';
buildInputs = [
openal curl libogg libvorbis libtheora SDL2 SDL2_image zlib clang
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${SDL2.dev}/include/SDL2"
];
enableParallelBuilding = true;
makeFlags = [
"OPT=true"
"RELEASE=true"
"DATA_DIR=$(out)/share"
"ENABLE_LOCAL_USER_DIR=true"
"NO_STEAMWORKS=true"
];
installPhase = ''
install -Dm755 keeper $out/bin/keeper
install -Dm755 appconfig.txt $out/share/appconfig.txt
cp -r data_free $out/share
cp -r data_contrib $out/share
${lib.optionalString unfree_assets "cp -r data $out/share"}
'';
meta = with lib; {
description = "Dungeon management rogue-like";
mainProgram = "keeper";
homepage = "https://keeperrl.com/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ onny ];
# TODO: Add OS X
platforms = [ "i686-linux" "x86_64-linux" ];
};
}