Giter VIP home page Giter VIP logo

minecraft.nix's Introduction

minecraft.nix

Inspired by this thread, this flake contains derivations of both vanilla and fabric edition (if available) for all versions of minecraft.

(Old versions are not fully tested, feel free to file an issue if you encounter problems.)

USAGE

Run Client

$ nix run github:Ninlives/minecraft.nix#v1_18_1.vanilla.client

You will be asked to login before launching the game. Only MSA login is supported, since Microsoft has started to migrate all Mojang accounts to Microsoft accounts.

Run Server

$ nix run github:Ninlives/minecraft.nix#v1_18_1.vanilla.server

Configuration

You may use the withConfig function to add extra configurations to the game:

{
  description = "A simple modpack.";
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.minecraft = {
    url = "github:Ninlives/minecraft.nix";
    inputs.metadata.follows = "minecraft-metadata";
  };
  inputs.minecraft-metadata.url = "github:Ninlives/minecraft.json";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, minecraft, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      inherit (pkgs) fetchurl;
    in {
      packages.minecraft-with-ae2 =
        (minecraft.legacyPackages.${system}.v1_18_1.fabric.client.withConfig [{
          mods = [
            (fetchurl {
              # file name must have a ".jar" suffix to be loaded by fabric
              name = "fabric-api.jar";
              url =
                "https://media.forgecdn.net/files/3609/610/fabric-api-0.46.1%2B1.18.jar";
              sha256 =
                "sha256:0d6dw9lsryy51by9iypcg2mk1p1ixf0bd3dblfgmv6nx8g98whlh";
            })
            (fetchurl {
              url =
                "https://media.forgecdn.net/files/3609/46/appliedenergistics2-10.0.0.jar";
              sha256 =
                "sha256:0v7nw98b22lbwyd5qy71w93rj7sh7ps30g4cb38s3g3n997yk49n";
            })
          ];
          # withConfig is also composable
        }]).withConfig {
          resourcePacks = [
            (fetchurl {
              url =
                "https://media.forgecdn.net/files/3577/971/Bare+Bones+1.18.zip";
              sha256 =
                "sha256:11a4d9rw0983y7jipir8gzsa2kpwl2p8jinx3gbh5lcy2a2pxzds";
            })
          ];
        };
    });
}

Available Options

For client:

Name Description
mods List of mods load by the game.
resourcePacks List of resourcePacks available to the game.
shaderPacks List of shaderPacks available to the game. The mod for loading shader packs should be add to option ``mods'' explicitly.
authClientID The client id of the authentication application.
declarative Whether using a declarative way to manage game files. Currently only resource packs and shader packs are managed.

For server:

Name Description
mods List of mods load by the game.
declarative Whether using a declarative way to manage game files. No-op for server currently.

TODO

  • Configure Minecraft and mods in nix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.