summary refs log tree commit diff
path: root/pkgs/games/factorio
diff options
context:
space:
mode:
authorGuillaume Maudoux <layus.on@gmail.com>2017-04-30 03:51:07 +0200
committerJoachim F <joachifm@users.noreply.github.com>2017-04-30 02:51:07 +0100
commit92f53af64d0be1c9a61924b45910c41da7a6d03e (patch)
treeadfff7572d4d094e6f171aa386558fa39b4b5d8b /pkgs/games/factorio
parent99c28df9e568599d0c9eb651e742da0d71c5f063 (diff)
downloadnixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar.gz
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar.bz2
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar.lz
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar.xz
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.tar.zst
nixpkgs-92f53af64d0be1c9a61924b45910c41da7a6d03e.zip
factorio-demo: init at 0.14.23 (#25265)
Diffstat (limited to 'pkgs/games/factorio')
-rw-r--r--pkgs/games/factorio/default.nix125
1 files changed, 67 insertions, 58 deletions
diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix
index 4a10015bea8..f0de56b0953 100644
--- a/pkgs/games/factorio/default.nix
+++ b/pkgs/games/factorio/default.nix
@@ -6,12 +6,11 @@
 , username ? "" , password ? ""
 }:
 
-assert releaseType == "alpha" || releaseType == "headless";
+assert releaseType == "alpha" || releaseType == "headless" || releaseType == "demo";
 
 with stdenv.lib;
 let
-  version = "0.15.1";
-  isHeadless = releaseType == "headless";
+  version = if releaseType != "demo" then "0.15.1" else "0.14.23";
 
   arch = if stdenv.system == "x86_64-linux" then {
     inUrl = "linux64";
@@ -24,15 +23,18 @@ let
   authenticatedFetch = callPackage ./fetch.nix { inherit username password; };
 
   fetch = rec {
+    extension = if releaseType != "demo" then "tar.xz" else "tar.gz";
     url = "https://www.factorio.com/get-download/${version}/${releaseType}/${arch.inUrl}";
-    name = "factorio_${releaseType}_${arch.inTar}-${version}.tar.xz";
+    name = "factorio_${releaseType}_${arch.inTar}-${version}.${extension}";
     x64 = {
-      headless = fetchurl        { inherit name url; sha256 = "1z84a9yzlld6fv53viwvswp52hlc9fkxzhb2pil7sidzkws3g49l"; };
-      alpha = authenticatedFetch { inherit name url; sha256 = "11bxasghrhqb2yg1842v1608x3mjdjv3015jgifpv1xmcqak44jp"; };
+      headless =           fetchurl { inherit name url; sha256 = "1z84a9yzlld6fv53viwvswp52hlc9fkxzhb2pil7sidzkws3g49l"; };
+      alpha    = authenticatedFetch { inherit name url; sha256 = "11bxasghrhqb2yg1842v1608x3mjdjv3015jgifpv1xmcqak44jp"; };
+      demo     =           fetchurl { inherit name url; sha256 = "10a2lwmspqviwgymn3zhjgpiynsa6dplgnikdirma5sl2hhcfb6s"; };
     };
     i386 = {
       headless = abort "Factorio 32-bit headless binaries are not available for download.";
-      alpha = abort "Factorio 32-bit client is not available for this version.";
+      alpha    = abort "Factorio 32-bit client is not available for this version.";
+      demo     = abort "Factorio 32-bit demo binaries are not available for download.";
     };
   };
 
@@ -95,55 +97,62 @@ let
       platforms = [ "i686-linux" "x86_64-linux" ];
     };
   };
-  headless = base;
-  alpha = base // {
-
-    buildInputs = [ makeWrapper ];
-
-    libPath = stdenv.lib.makeLibraryPath [
-      alsaLib
-      libX11
-      libXcursor
-      libXinerama
-      libXrandr
-      libXi
-      mesa_noglu
-    ];
-
-    installPhase = base.installPhase + ''
-      wrapProgram $out/bin/factorio                                \
-        --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \
-        --run "$out/share/factorio/update-config.sh"               \
-        --argv0 "" \
-        --add-flags "-c \$HOME/.factorio/config.cfg ${optionalString (mods != []) "--mod-directory=${modDir}"}"
-
-        # TODO Currently, every time a mod is changed/added/removed using the
-        # modlist, a new derivation will take up the entire footprint of the
-        # client. The only way to avoid this is to remove the mods arg from the
-        # package function. The modsDir derivation will have to be built
-        # separately and have the user specify it in the .factorio config or
-        # right along side it using a symlink into the store I think i will
-        # just remove mods for the client derivation entirely. this is much
-        # cleaner and more useful for headless mode.
-
-        # TODO: trying to toggle off a mod will result in read-only-fs-error.
-        # not much we can do about that except warn the user somewhere. In
-        # fact, no exit will be clean, since this error will happen on close
-        # regardless. just prints an ugly stacktrace but seems to be otherwise
-        # harmless, unless maybe the user forgets and tries to use the mod
-        # manager.
-
-      install -m0644 <(cat << EOF
-      ${configBaseCfg}
-      EOF
-      ) $out/share/factorio/config-base.cfg
-
-      install -m0755 <(cat << EOF
-      ${updateConfigSh}
-      EOF
-      ) $out/share/factorio/update-config.sh
-
-      cp -a doc-html $out/share/factorio
-    '';
+
+  releases = rec {
+    headless = base;
+    demo = base // {
+
+      buildInputs = [ makeWrapper ];
+
+      libPath = stdenv.lib.makeLibraryPath [
+        alsaLib
+        libX11
+        libXcursor
+        libXinerama
+        libXrandr
+        libXi
+        mesa_noglu
+      ];
+
+      installPhase = base.installPhase + ''
+        wrapProgram $out/bin/factorio                                \
+          --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \
+          --run "$out/share/factorio/update-config.sh"               \
+          --argv0 "" \
+          --add-flags "-c \$HOME/.factorio/config.cfg ${optionalString (mods != []) "--mod-directory=${modDir}"}"
+
+          # TODO Currently, every time a mod is changed/added/removed using the
+          # modlist, a new derivation will take up the entire footprint of the
+          # client. The only way to avoid this is to remove the mods arg from the
+          # package function. The modsDir derivation will have to be built
+          # separately and have the user specify it in the .factorio config or
+          # right along side it using a symlink into the store I think i will
+          # just remove mods for the client derivation entirely. this is much
+          # cleaner and more useful for headless mode.
+
+          # TODO: trying to toggle off a mod will result in read-only-fs-error.
+          # not much we can do about that except warn the user somewhere. In
+          # fact, no exit will be clean, since this error will happen on close
+          # regardless. just prints an ugly stacktrace but seems to be otherwise
+          # harmless, unless maybe the user forgets and tries to use the mod
+          # manager.
+
+        install -m0644 <(cat << EOF
+        ${configBaseCfg}
+        EOF
+        ) $out/share/factorio/config-base.cfg
+
+        install -m0755 <(cat << EOF
+        ${updateConfigSh}
+        EOF
+        ) $out/share/factorio/update-config.sh
+      '';
+    };
+    alpha = demo // {
+
+      installPhase = demo.installPhase + ''
+        cp -a doc-html $out/share/factorio
+      '';
+    };
   };
-in stdenv.mkDerivation (if isHeadless then headless else alpha)
+in stdenv.mkDerivation (releases.${releaseType})