mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 07:46:09 +01:00
4a7f99d55d
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
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ lib, stdenv, fetchurl, libX11, xorgproto, libXpm, libXt }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "xsokoban";
|
|
version = "3.3c";
|
|
|
|
src = fetchurl {
|
|
url = "https://www.cs.cornell.edu/andru/release/${pname}-${version}.tar.gz";
|
|
sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
|
|
};
|
|
|
|
buildInputs = [ libX11 xorgproto libXpm libXt ];
|
|
|
|
NIX_CFLAGS_COMPILE = "-I${libXpm.dev}/include/X11";
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
prePatch = ''
|
|
substituteInPlace Makefile.in --replace 4755 0755
|
|
'';
|
|
|
|
preConfigure = ''
|
|
sed -e 's/getline/my_getline/' -i score.c
|
|
|
|
chmod a+rw config.h
|
|
cat >>config.h <<EOF
|
|
#define HERE "@nixos-packaged"
|
|
#define WWW 0
|
|
#define OWNER "$(whoami)"
|
|
#define ROOTDIR "$out/lib/xsokoban"
|
|
#define ANYLEVEL 1
|
|
#define SCOREFILE ".xsokoban-score"
|
|
#define LOCKFILE ".xsokoban-score-lock"
|
|
EOF
|
|
|
|
sed -i main.c \
|
|
-e 's/getpass[(][^)]*[)]/PASSWORD/' \
|
|
-e '/if [(]owner[)]/iowner=1;'
|
|
'';
|
|
|
|
preBuild = ''
|
|
sed -i Makefile \
|
|
-e "s@/usr/local/@$out/@" \
|
|
-e "s@ /bin/@ @"
|
|
mkdir -p $out/bin $out/share $out/man/man1 $out/lib
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "X sokoban";
|
|
license = licenses.publicDomain;
|
|
maintainers = [ maintainers.raskin ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|