diff options
| -rw-r--r-- | customized/factorio.nix | 148 | ||||
| -rw-r--r-- | ymir.nix | 9 | ||||
| -rw-r--r-- | ymir/factorio.nix | 88 |
3 files changed, 0 insertions, 245 deletions
diff --git a/customized/factorio.nix b/customized/factorio.nix deleted file mode 100644 index beed0910..00000000 --- a/customized/factorio.nix +++ /dev/null | |||
| @@ -1,148 +0,0 @@ | |||
| 1 | { stdenv, callPackage, fetchurl, makeWrapper | ||
| 2 | , alsaLib, libX11, libXcursor, libXinerama, libXrandr, libXi, mesa_noglu | ||
| 3 | , factorio-utils | ||
| 4 | , releaseType | ||
| 5 | , mods ? [] | ||
| 6 | , username ? "" , password ? "" | ||
| 7 | }: | ||
| 8 | |||
| 9 | assert releaseType == "alpha" || releaseType == "headless"; | ||
| 10 | |||
| 11 | with stdenv.lib; | ||
| 12 | let | ||
| 13 | version = "0.14.5"; | ||
| 14 | isHeadless = releaseType == "headless"; | ||
| 15 | |||
| 16 | arch = if stdenv.system == "x86_64-linux" then { | ||
| 17 | inUrl = "linux64"; | ||
| 18 | inTar = "x64"; | ||
| 19 | } else if stdenv.system == "i686-linux" then { | ||
| 20 | inUrl = "linux32"; | ||
| 21 | inTar = "i386"; | ||
| 22 | } else abort "Unsupported platform"; | ||
| 23 | |||
| 24 | authenticatedFetch = callPackage ./fetch.nix { inherit username password; }; | ||
| 25 | |||
| 26 | fetch = rec { | ||
| 27 | url = "https://www.factorio.com/get-download/${version}/${releaseType}/${arch.inUrl}"; | ||
| 28 | name = "factorio_${releaseType}_${arch.inTar}-${version}.tar.gz"; | ||
| 29 | x64 = { | ||
| 30 | headless = fetchurl { inherit name url; sha256 = "734b3689146baa340cf8f8139d31f170538ebfad807b09b0b64527b8f3e97a94"; }; | ||
| 31 | alpha = authenticatedFetch { inherit url; sha256 = null; }; | ||
| 32 | }; | ||
| 33 | i386 = { | ||
| 34 | headless = abort "Factorio 32-bit headless binaries are not available for download."; | ||
| 35 | alpha = authenticatedFetch { inherit url; sha256 = null; }; | ||
| 36 | }; | ||
| 37 | }; | ||
| 38 | |||
| 39 | configBaseCfg = '' | ||
| 40 | use-system-read-write-data-directories=false | ||
| 41 | [path] | ||
| 42 | read-data=$out/share/factorio/data/ | ||
| 43 | [other] | ||
| 44 | check_updates=false | ||
| 45 | ''; | ||
| 46 | |||
| 47 | updateConfigSh = '' | ||
| 48 | #! $SHELL | ||
| 49 | if [[ -e ~/.factorio/config.cfg ]]; then | ||
| 50 | # Config file exists, but may have wrong path. | ||
| 51 | # Try to edit it. I'm sure this is perfectly safe and will never go wrong. | ||
| 52 | sed -i 's|^read-data=.*|read-data=$out/share/factorio/data/|' ~/.factorio/config.cfg | ||
| 53 | else | ||
| 54 | # Config file does not exist. Phew. | ||
| 55 | install -D $out/share/factorio/config-base.cfg ~/.factorio/config.cfg | ||
| 56 | fi | ||
| 57 | ''; | ||
| 58 | |||
| 59 | modDir = factorio-utils.mkModDirDrv mods; | ||
| 60 | |||
| 61 | base = { | ||
| 62 | name = "factorio-${releaseType}-${version}"; | ||
| 63 | |||
| 64 | src = fetch.${arch.inTar}.${releaseType}; | ||
| 65 | |||
| 66 | preferLocalBuild = true; | ||
| 67 | dontBuild = true; | ||
| 68 | |||
| 69 | installPhase = '' | ||
| 70 | mkdir -p $out/{bin,share/factorio} | ||
| 71 | cp -a data $out/share/factorio | ||
| 72 | cp -a bin/${arch.inTar}/factorio $out/bin/factorio | ||
| 73 | patchelf \ | ||
| 74 | --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ | ||
| 75 | $out/bin/factorio | ||
| 76 | ''; | ||
| 77 | |||
| 78 | meta = { | ||
| 79 | description = "A game in which you build and maintain factories"; | ||
| 80 | longDescription = '' | ||
| 81 | Factorio is a game in which you build and maintain factories. | ||
| 82 | |||
| 83 | You will be mining resources, researching technologies, building | ||
| 84 | infrastructure, automating production and fighting enemies. Use your | ||
| 85 | imagination to design your factory, combine simple elements into | ||
| 86 | ingenious structures, apply management skills to keep it working and | ||
| 87 | finally protect it from the creatures who don't really like you. | ||
| 88 | |||
| 89 | Factorio has been in development since spring of 2012 and it is | ||
| 90 | currently in late alpha. | ||
| 91 | ''; | ||
| 92 | homepage = https://www.factorio.com/; | ||
| 93 | license = stdenv.lib.licenses.unfree; | ||
| 94 | maintainers = with stdenv.lib.maintainers; [ Baughn elitak ]; | ||
| 95 | platforms = [ "i686-linux" "x86_64-linux" ]; | ||
| 96 | }; | ||
| 97 | }; | ||
| 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 | --add-flags "-c \$HOME/.factorio/config.cfg ${optionalString (mods != []) "--mod-directory=${modDir}"}" | ||
| 118 | |||
| 119 | # TODO Currently, every time a mod is changed/added/removed using the | ||
| 120 | # modlist, a new derivation will take up the entire footprint of the | ||
| 121 | # client. The only way to avoid this is to remove the mods arg from the | ||
| 122 | # package function. The modsDir derivation will have to be built | ||
| 123 | # separately and have the user specify it in the .factorio config or | ||
| 124 | # right along side it using a symlink into the store I think i will | ||
| 125 | # just remove mods for the client derivation entirely. this is much | ||
| 126 | # cleaner and more useful for headless mode. | ||
| 127 | |||
| 128 | # TODO: trying to toggle off a mod will result in read-only-fs-error. | ||
| 129 | # not much we can do about that except warn the user somewhere. In | ||
| 130 | # fact, no exit will be clean, since this error will happen on close | ||
| 131 | # regardless. just prints an ugly stacktrace but seems to be otherwise | ||
| 132 | # harmless, unless maybe the user forgets and tries to use the mod | ||
| 133 | # manager. | ||
| 134 | |||
| 135 | install -m0644 <(cat << EOF | ||
| 136 | ${configBaseCfg} | ||
| 137 | EOF | ||
| 138 | ) $out/share/factorio/config-base.cfg | ||
| 139 | |||
| 140 | install -m0755 <(cat << EOF | ||
| 141 | ${updateConfigSh} | ||
| 142 | EOF | ||
| 143 | ) $out/share/factorio/update-config.sh | ||
| 144 | |||
| 145 | cp -a doc-html $out/share/factorio | ||
| 146 | ''; | ||
| 147 | }; | ||
| 148 | in stdenv.mkDerivation (if isHeadless then headless else alpha) | ||
| @@ -25,7 +25,6 @@ in rec { | |||
| 25 | [ | 25 | [ |
| 26 | ./ymir/hw.nix | 26 | ./ymir/hw.nix |
| 27 | ./ymir/mlmmj-expose.nix | 27 | ./ymir/mlmmj-expose.nix |
| 28 | ./ymir/factorio.nix | ||
| 29 | ./custom/zsh.nix | 28 | ./custom/zsh.nix |
| 30 | ./users.nix | 29 | ./users.nix |
| 31 | ./custom/tinc/def.nix | 30 | ./custom/tinc/def.nix |
| @@ -590,12 +589,4 @@ in rec { | |||
| 590 | users.groups."filebin" = { | 589 | users.groups."filebin" = { |
| 591 | members = ["gkleen" "uucp"]; | 590 | members = ["gkleen" "uucp"]; |
| 592 | }; | 591 | }; |
| 593 | |||
| 594 | services.murmur = { | ||
| 595 | enable = true; | ||
| 596 | clientCertRequired = true; | ||
| 597 | registerName = "ymir.yggdrasil.li"; | ||
| 598 | sslCert = "/var/lib/acme/yggdrasil.li/fullchain.pem"; | ||
| 599 | sslKey = "/var/lib/acme/yggdrasil.li/key.pem"; | ||
| 600 | }; | ||
| 601 | } | 592 | } |
diff --git a/ymir/factorio.nix b/ymir/factorio.nix deleted file mode 100644 index 15969d9a..00000000 --- a/ymir/factorio.nix +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | { config, pkgs, ... }: | ||
| 2 | |||
| 3 | let | ||
| 4 | modDrv = pkgs.factorio-utils.modDrv { | ||
| 5 | allRecommendedMods = true; | ||
| 6 | allOptionalMods = false; | ||
| 7 | }; | ||
| 8 | modPortalDrv = { name, version, sha256, deps ? [], optionalDeps ? [], recommendedDeps ? [] }: modDrv { | ||
| 9 | # src = pkgs.factorio-fetch { | ||
| 10 | # name = ''${name}_${version}.zip''; | ||
| 11 | # url = ''https://mods.factorio.com/api/downloads/data/mods/${id}_${version}.zip''; | ||
| 12 | # inherit sha256; | ||
| 13 | # loginUrl = ""; | ||
| 14 | # }; | ||
| 15 | name = ''${name}-${version}''; | ||
| 16 | src = pkgs.fetchurl { | ||
| 17 | url = ''https://f.141.li/${name}_${version}.zip''; | ||
| 18 | inherit sha256; | ||
| 19 | }; | ||
| 20 | inherit deps optionalDeps recommendedDeps; | ||
| 21 | }; | ||
| 22 | |||
| 23 | availableMods = rec { | ||
| 24 | autofill = modPortalDrv { | ||
| 25 | name = "autofill"; | ||
| 26 | version = "1.4.5"; | ||
| 27 | sha256 = "1nmn12d7fpi6gk5i6dvzqnca1hs9icqssgvjc2qdi9hz2n07h265"; | ||
| 28 | }; | ||
| 29 | EvoGUI = modPortalDrv { | ||
| 30 | name = "EvoGUI"; | ||
| 31 | version = "0.4.108"; | ||
| 32 | sha256 = "1z7cx8a4ybilccvxsmd85i7q2fy95as1mjs7gvbmnllp0r6p73pj"; | ||
| 33 | }; | ||
| 34 | factorio-reach = modPortalDrv { | ||
| 35 | name = "factorio-reach"; | ||
| 36 | version = "2.1.1"; | ||
| 37 | sha256 = "1ll77ns2bvzsvypd27y545inb5489lsk2is4wv01q4i8zbvbviac"; | ||
| 38 | }; | ||
| 39 | FAIR = modPortalDrv { | ||
| 40 | name = "FAIR"; | ||
| 41 | version = "0.0.1"; | ||
| 42 | sha256 = "0cwgidy3ycp90jy9qrll2gyvkmdxys5v8w6qrciifh3h77dx5ryg"; | ||
| 43 | }; | ||
| 44 | EvenMoreLight = modPortalDrv { | ||
| 45 | name = "EvenMoreLight"; | ||
| 46 | version = "0.0.3"; | ||
| 47 | sha256 = "06j891nbcl07di2rs0zh87hczp2p1mbpai14w52myxag0ysy4zya"; | ||
| 48 | }; | ||
| 49 | RailTanker = modPortalDrv { | ||
| 50 | name = "RailTanker"; | ||
| 51 | version = "1.4.0"; | ||
| 52 | sha256 = "1y9p6qiwrypyqk58rr3ahq11ikyk752fbap3n15mdplkc9i4gpfr"; | ||
| 53 | }; | ||
| 54 | rso-mod = modPortalDrv { | ||
| 55 | name = "rso-mod"; | ||
| 56 | version = "2.2.2"; | ||
| 57 | sha256 = "0d46vz204bv220ifjaa8qcvnbzkalrqgppmzwk43kvy1jyp9xil4"; | ||
| 58 | }; | ||
| 59 | YARM = modPortalDrv { | ||
| 60 | name = "YARM"; | ||
| 61 | version = "0.7.106"; | ||
| 62 | sha256 = "1qy7bylp79jfs9s81sc4g9qqwby2hsy3hcjz80cfha1sz0c048i7"; | ||
| 63 | }; | ||
| 64 | }; | ||
| 65 | in { | ||
| 66 | services.factorio = { | ||
| 67 | enable = true; | ||
| 68 | saveName = config.networking.hostName; | ||
| 69 | mods = with availableMods; [ | ||
| 70 | autofill | ||
| 71 | EvoGUI | ||
| 72 | factorio-reach | ||
| 73 | FAIR | ||
| 74 | EvenMoreLight | ||
| 75 | RailTanker | ||
| 76 | rso-mod | ||
| 77 | YARM | ||
| 78 | ]; | ||
| 79 | autosave-interval = 10; | ||
| 80 | }; | ||
| 81 | |||
| 82 | nixpkgs.config.allowUnfree = true; | ||
| 83 | |||
| 84 | nixpkgs.config.packageOverrides = pkgs: { | ||
| 85 | factorio-mkModDirDrv = pkgs.factorio-utils.mkModDirDrv; | ||
| 86 | factorio-headless = pkgs.callPackage ../customized/factorio.nix { releaseType = "headless"; }; | ||
| 87 | }; | ||
| 88 | } | ||
