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