nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, fetchurl, tcl, tk, libX11, zlib, makeWrapper, makeDesktopItem }:
2
3tcl.mkTclDerivation rec {
4 pname = "scid-vs-pc";
5 version = "4.22";
6
7 src = fetchurl {
8 url = "mirror://sourceforge/scidvspc/scid_vs_pc-${version}.tgz";
9 sha256 = "sha256-PSHDPrfhJI/DyEVQLo8Ckargqf/iUG5PgvUbO/4WNJM=";
10 };
11
12 nativeBuildInputs = [ makeWrapper ];
13 buildInputs = [ tk libX11 zlib ];
14
15 prePatch = ''
16 sed -i -e '/^ *set headerPath *{/a ${tcl}/include ${tk}/include' \
17 -e '/^ *set libraryPath *{/a ${tcl}/lib ${tk}/lib' \
18 -e '/^ *set x11Path *{/a ${libX11}/lib/' \
19 configure
20
21 sed -i -e '/^ *set scidShareDir/s|\[file.*|"'"$out/share"'"|' \
22 tcl/config.tcl
23 '';
24
25 # configureFlags = [
26 # "BINDIR=$(out)/bin"
27 # "SHAREDIR=$(out)/share"
28 # "FONTDIR=$(out)/fonts"
29 # ];
30
31 preConfigure = ''configureFlags="
32 BINDIR=$out/bin
33 SHAREDIR=$out/share
34 FONTDIR=$out/fonts"
35 '';
36
37 patches = [
38 ./0001-put-fonts-in-out.patch
39 ];
40
41 hardeningDisable = [ "format" ];
42
43 dontPatchShebangs = true;
44
45 # TODO: can this use tclWrapperArgs?
46 postFixup = ''
47 sed -i -e '1c#!'"$out"'/bin/tcscid' "$out/bin/scidpgn"
48 sed -i -e '1c#!${tk}/bin/wish' "$out/bin/sc_remote"
49 sed -i -e '1c#!'"$out"'/bin/tkscid' "$out/bin/scid"
50
51 for cmd in $out/bin/* ; do
52 wrapProgram "$cmd" \
53 --set TK_LIBRARY "${tk}/lib/${tk.libPrefix}"
54 done
55 '';
56
57 postInstall = ''
58 mkdir -p $out/share/applications
59 cp $desktopItem/share/applications/* $out/share/applications/
60
61 install -D icons/scid.png "$out"/share/icons/hicolor/128x128/apps/scid.png
62 '';
63
64 desktopItem = makeDesktopItem {
65 name = "scid-vs-pc";
66 desktopName = "Scid vs. PC";
67 genericName = "Chess Database";
68 comment = meta.description;
69 icon = "scid";
70 exec = "scid";
71 categories = [ "Game" "BoardGame" ];
72 };
73
74 meta = with lib; {
75 description = "Chess database with play and training functionality";
76 homepage = "https://scidvspc.sourceforge.net/";
77 license = lib.licenses.gpl2;
78 maintainers = [ maintainers.paraseba ];
79 platforms = lib.platforms.linux;
80 };
81}