git.iko.soy/typeable/nixpkgs
on master help sign in
factorio-demo: init at 0.14.23 (#25265)
commit92f53af64d0be1c9a61924b45910c41da7a6d03e authorGuillaume Maudoux <layus.on@gmail.com> dateSun 30 Apr 2017, 03:51 (10 years ago) parent99c28df
2 files changed+69−58
pkgs/games/factorio/default.nix+67−58 pkgs/top-level/all-packages.nix+2
pkgs/games/factorio/default.nix+67−58
@@ -6,12 +6,11 @@
66, username ? "" , password ? ""
77}:
88
9−assert releaseType == "alpha" || releaseType == "headless";
9+assert releaseType == "alpha" || releaseType == "headless" || releaseType == "demo";
1010
1111with stdenv.lib;
1212let
13− version = "0.15.1";
14− isHeadless = releaseType == "headless";
13+ version = if releaseType != "demo" then "0.15.1" else "0.14.23";
1514
1615 arch = if stdenv.system == "x86_64-linux" then {
1716 inUrl = "linux64";
@@ -24,15 +23,18 @@ let
2423 authenticatedFetch = callPackage ./fetch.nix { inherit username password; };
2524
2625 fetch = rec {
26+ extension = if releaseType != "demo" then "tar.xz" else "tar.gz";
2727 url = "https://www.factorio.com/get-download/${version}/${releaseType}/${arch.inUrl}";
28− name = "factorio_${releaseType}_${arch.inTar}-${version}.tar.xz";
28+ name = "factorio_${releaseType}_${arch.inTar}-${version}.${extension}";
2929 x64 = {
30− headless = fetchurl { inherit name url; sha256 = "1z84a9yzlld6fv53viwvswp52hlc9fkxzhb2pil7sidzkws3g49l"; };
31− alpha = authenticatedFetch { inherit name url; sha256 = "11bxasghrhqb2yg1842v1608x3mjdjv3015jgifpv1xmcqak44jp"; };
30+ headless = fetchurl { inherit name url; sha256 = "1z84a9yzlld6fv53viwvswp52hlc9fkxzhb2pil7sidzkws3g49l"; };
31+ alpha = authenticatedFetch { inherit name url; sha256 = "11bxasghrhqb2yg1842v1608x3mjdjv3015jgifpv1xmcqak44jp"; };
32+ demo = fetchurl { inherit name url; sha256 = "10a2lwmspqviwgymn3zhjgpiynsa6dplgnikdirma5sl2hhcfb6s"; };
3233 };
3334 i386 = {
3435 headless = abort "Factorio 32-bit headless binaries are not available for download.";
35− alpha = abort "Factorio 32-bit client is not available for this version.";
36+ alpha = abort "Factorio 32-bit client is not available for this version.";
37+ demo = abort "Factorio 32-bit demo binaries are not available for download.";
3638 };
3739 };
3840
@@ -95,55 +97,62 @@ let
9597 platforms = [ "i686-linux" "x86_64-linux" ];
9698 };
9799 };
98− headless = base;
99− alpha = base // {
100−
101− buildInputs = [ makeWrapper ];
102−
103− libPath = stdenv.lib.makeLibraryPath [
104− alsaLib
105− libX11
106− libXcursor
107− libXinerama
108− libXrandr
109− libXi
110− mesa_noglu
111− ];
112−
113− installPhase = base.installPhase + ''
114− wrapProgram $out/bin/factorio \
115− --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \
116− --run "$out/share/factorio/update-config.sh" \
117− --argv0 "" \
118− --add-flags "-c \$HOME/.factorio/config.cfg ${optionalString (mods != []) "--mod-directory=${modDir}"}"
119−
120− # TODO Currently, every time a mod is changed/added/removed using the
121− # modlist, a new derivation will take up the entire footprint of the
122− # client. The only way to avoid this is to remove the mods arg from the
123− # package function. The modsDir derivation will have to be built
124− # separately and have the user specify it in the .factorio config or
125− # right along side it using a symlink into the store I think i will
126− # just remove mods for the client derivation entirely. this is much
127− # cleaner and more useful for headless mode.
128−
129− # TODO: trying to toggle off a mod will result in read-only-fs-error.
130− # not much we can do about that except warn the user somewhere. In
131− # fact, no exit will be clean, since this error will happen on close
132− # regardless. just prints an ugly stacktrace but seems to be otherwise
133− # harmless, unless maybe the user forgets and tries to use the mod
134− # manager.
135−
136− install -m0644 <(cat << EOF
137− ${configBaseCfg}
138− EOF
139− ) $out/share/factorio/config-base.cfg
140−
141− install -m0755 <(cat << EOF
142− ${updateConfigSh}
143− EOF
144− ) $out/share/factorio/update-config.sh
145−
146− cp -a doc-html $out/share/factorio
147− '';
100+
101+ releases = rec {
102+ headless = base;
103+ demo = base // {
104+
105+ buildInputs = [ makeWrapper ];
106+
107+ libPath = stdenv.lib.makeLibraryPath [
108+ alsaLib
109+ libX11
110+ libXcursor
111+ libXinerama
112+ libXrandr
113+ libXi
114+ mesa_noglu
115+ ];
116+
117+ installPhase = base.installPhase + ''
118+ wrapProgram $out/bin/factorio \
119+ --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \
120+ --run "$out/share/factorio/update-config.sh" \
121+ --argv0 "" \
122+ --add-flags "-c \$HOME/.factorio/config.cfg ${optionalString (mods != []) "--mod-directory=${modDir}"}"
123+
124+ # TODO Currently, every time a mod is changed/added/removed using the
125+ # modlist, a new derivation will take up the entire footprint of the
126+ # client. The only way to avoid this is to remove the mods arg from the
127+ # package function. The modsDir derivation will have to be built
128+ # separately and have the user specify it in the .factorio config or
129+ # right along side it using a symlink into the store I think i will
130+ # just remove mods for the client derivation entirely. this is much
131+ # cleaner and more useful for headless mode.
132+
133+ # TODO: trying to toggle off a mod will result in read-only-fs-error.
134+ # not much we can do about that except warn the user somewhere. In
135+ # fact, no exit will be clean, since this error will happen on close
136+ # regardless. just prints an ugly stacktrace but seems to be otherwise
137+ # harmless, unless maybe the user forgets and tries to use the mod
138+ # manager.
139+
140+ install -m0644 <(cat << EOF
141+ ${configBaseCfg}
142+ EOF
143+ ) $out/share/factorio/config-base.cfg
144+
145+ install -m0755 <(cat << EOF
146+ ${updateConfigSh}
147+ EOF
148+ ) $out/share/factorio/update-config.sh
149+ '';
150+ };
151+ alpha = demo // {
152+
153+ installPhase = demo.installPhase + ''
154+ cp -a doc-html $out/share/factorio
155+ '';
156+ };
148157 };
149−in stdenv.mkDerivation (if isHeadless then headless else alpha)
158+in stdenv.mkDerivation (releases.${releaseType})
pkgs/top-level/all-packages.nix+2
@@ -16644,6 +16644,8 @@ with pkgs;
1664416644
1664516645 factorio-headless = callPackage ../games/factorio { releaseType = "headless"; };
1664616646
16647+ factorio-demo = callPackage ../games/factorio { releaseType = "demo"; };
16648+
1664716649 factorio-mods = callPackage ../games/factorio/mods.nix { };
1664816650
1664916651 factorio-utils = callPackage ../games/factorio/utils.nix { };