lol
1{ lib
2, fetchurl
3, fetchFromGitHub
4, unzip
5, python3
6, enableDefaultMusicPack ? true
7}:
8
9let
10 pname = "endgame-singularity";
11 version = "1.00";
12
13 main_src = fetchFromGitHub {
14 owner = "singularity";
15 repo = "singularity";
16 rev = "v${version}";
17 sha256 = "0ndrnxwii8lag6vrjpwpf5n36hhv223bb46d431l9gsigbizv0hl";
18 };
19
20 music_src = fetchurl {
21 url = "http://www.emhsoft.com/singularity/endgame-singularity-music-007.zip";
22 sha256 = "0vf2qaf66jh56728pq1zbnw50yckjz6pf6c6qw6dl7vk60kkqnpb";
23 };
24in
25
26python3.pkgs.buildPythonApplication rec {
27 inherit pname version;
28
29 srcs = [ main_src ] ++ lib.optional enableDefaultMusicPack music_src;
30 sourceRoot = main_src.name;
31
32 nativeBuildInputs = [ unzip ]; # The music is zipped
33 propagatedBuildInputs = with python3.pkgs; [ pygame numpy polib ];
34
35 # Add the music
36 postInstall = lib.optionalString enableDefaultMusicPack ''
37 cp -R "../endgame-singularity-music-007" \
38 "$(echo $out/lib/python*/site-packages/singularity)/music"
39 # ↑ we cannot glob on [...]/music, it doesn't exist yet
40 '';
41
42 meta = {
43 homepage = "http://www.emhsoft.com/singularity/";
44 description = "A simulation game about strong AI";
45 longDescription = ''
46 A simulation of a true AI. Go from computer to computer, pursued by the
47 entire world. Keep hidden, and you might have a chance
48 '';
49 # License details are in LICENSE.txt
50 license = with lib.licenses; [
51 gpl2Plus # most of the code, some translations
52 mit # recursive_fix_pickle, polib
53 cc-by-sa-30 # data and artwork, some translations
54 free # earth images from NASA, some fonts
55 cc0 # cick0.wav
56 ];
57 mainProgram = "singularity";
58 maintainers = with lib.maintainers; [ fgaz ];
59 };
60}