Minecraft.nix - Command line Minecraft launcher managed by nix

Overview

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 a issue if your encounter problems.)

USAGE

Vanilla

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

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

Fabric

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

A utility function is also provided to define loaded mods in the nix way:

{
  description = "A simple modpack.";
  inputs.minecraft.url = "github:Ninlives/minecraft.nix";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, minecraft, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system: {
      packages.minecraft-with-ae2 = (minecraft.legacyPackages.${system}.v1_18_1.fabric.client.withMods [
        (builtins.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";
        })
        # the withMods function is also composable
      ]).withMods [
        (builtins.fetchurl {
          url =
            "https://media.forgecdn.net/files/3609/46/appliedenergistics2-10.0.0.jar";
          sha256 =
            "sha256:0v7nw98b22lbwyd5qy71w93rj7sh7ps30g4cb38s3g3n997yk49n";
        })
      ];
    });
}

TODO

  • withResourcePacks
  • Configure Minecraft and mods in nix
You might also like...
Chess-commandline - Chess in the Command Line using the Chess Module Can detect Checkmates

chess-commandline Chess in the Command Line using the Chess Module Can detect Ch

Command-line Hangman game

Hang-_an-game-python-build Hangman C command-line Hangman game. Compilation Navigate to the root of the repository from your Terminal and run make to

Minecraft clone using Python Ursina game engine!
Minecraft clone using Python Ursina game engine!

Minecraft clone using Python Ursina game engine!

Open-source project written in the ursina engine, simulating the popular game Minecraft.
Open-source project written in the ursina engine, simulating the popular game Minecraft.

Voxelcraft is an open-source project written in the ursina engine, simulating the popular game Minecraft.

Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

Setup minecraft server (Tuinity) to your directory
Setup minecraft server (Tuinity) to your directory

hapeshiva server-setup Setup minecraft server (Tuinity) for you. Support for optimization Create optimized yml Customazible server port and view dista

Automatically prepare your Minecraft maps for release

map-prepare Automatically prepare Mineraft map for release. Current state: kinda works Make sure you have backups for your world before running this p

A simple script which allows you to see how much GEXP you earned for playing in the last Minecraft Hypixel server session

Project Landscape A simple script which allows you to see how much GEXP you earned for playing in the Minecraft Server Hypixel Usage Install python 3.

 A Minecraft clone written in python and pyglet.
A Minecraft clone written in python and pyglet.

PyCraft A Minecraft clone written in python and pyglet. Running PyCraft To run PyCraft, run the following code: git clone https://github.com/TheWebCra

Comments
  • Update usage, correct typo

    Update usage, correct typo

    Since the metadata has been separated to another repo, it is better to advise the user to follow the repo in their flake so they can get the latest metadata.

    opened by chuangzhu 3
  • Running into error

    Running into error "error: value is a function while a list was expected" when trying to use the flake

    Hello,

    First off, thank you for this flake.

    I'm new to flakes, so this might be a beginner's mistake on my side.

    I am running on the following error when I try to use this flake in NixOS 21.11:

    error: value is a function while a list was expected
    
           at /nix/store/cijly7m9alsipw3x5097hnz2ayw4lw3x-source/builder.nix:127:19:
    
              126|       final = evalModules {
              127|         modules = modules
                 |                   ^
              128|           ++ [ ({ _module.args.pkgs = pkgs; }) (import ./module) ];
    (use '--show-trace' to show detailed location information)
    

    I invoke the flake with the following command:

    NIXPKGS_ALLOW_UNFREE=1 nixFlakes run   --impure ".#v1_18_1.vanilla.client"
    

    (The nixFlakes command comes from https://nixos.wiki/wiki/Flakes#Installation_as_an_extra_command)

    I tried to modify line 127 of builder.nix so that modules becomes a list with the following "patch":

    diff --git a/builder.nix b/builder.nix
    index 930c86a..9ccb86e 100644
    --- a/builder.nix
    +++ b/builder.nix
    @@ -124,7 +124,7 @@ let
       mkLauncher = modules:
         let
           final = evalModules {
    -        modules = modules
    +        modules = [ modules ]
               ++ [ ({ _module.args.pkgs = pkgs; }) (import ./module) ];
           };
         in final.config.launcher // {
    

    I now run into the following error:

    error: value is a list while a set was expected
    
           at /nix/store/0gcda509wdm9zchk4m0dn433aixi5300-source/lib/modules.nix:366:44:
    
              365|         options = {};
              366|         config = addFreeformType (addMeta (removeAttrs m ["_file" "key" "disabledModules" "require" "imports" "freeformType"]));
                 |                         
    

    I tried an earlier version of the repository (commit 3674454b847a2bcef7d20274003b5b1c7dfa0219) and managed to run the flake correctly (it runs the script that asks for a MSA logon).

    Do you have any ideas of what I'm doing wrong?

    Best regards, Tony

    opened by tcheneau 2
  • Prefetch version info and asset indices for all release versions

    Prefetch version info and asset indices for all release versions

    Result

    With this patch, release versions can be built without IFD.

    $ nix build github:linyinfeng/minecraft.nix#v1_18_2.vanilla.client --no-allow-import-from-derivation --json
    [{"drvPath":"/nix/store/f3q797lwks3ijmlx4h0r620ak13ln14f-minecraft.drv","outputs":{"out":"/nix/store/azf9nvpfqcyzxxw4mspi7510zjs3vidr-minecraft"}}]
    

    IFD is still required to build non-release versions.

    $ nix build github:linyinfeng/minecraft.nix#v1_19-pre1.vanilla.client --no-allow-import-from-derivation --json
    error: cannot build '/nix/store/4xphbc1g7lnz19khkwwjgg44qzgamfi8-1.19-pre1.json.drv' during evaluation because the option 'allow-import-from-derivation' is disabled
    (use '--show-trace' to show detailed location information)
    $ nix build github:linyinfeng/minecraft.nix#v1_19-pre1.vanilla.client --allow-import-from-derivation --json
    nix build github:linyinfeng/minecraft.nix#v1_19-pre1.vanilla.client --allow-import-from-derivation --json
    [{"drvPath":"/nix/store/w60kdnxhrrhk83z02pqqwwqjb5zgz9nq-minecraft.drv","outputs":{"out":"/nix/store/lsl41qy164akl4dr0cbwb9w9svhy5zaj-minecraft"}}]
    

    Space consumption

    Prefetch these JSON files only for release versions should be acceptable, these files take up 4.8M.

    $ du -h
    du -h vanilla
    3.1M	vanilla/asset_indices
    1.6M	vanilla/versions
    4.8M	vanilla
    

    I also tried to fetch all versions including old_alpha, old_beta, and snapshot.

    du -h vanilla
    3.6M	vanilla/asset_indices
    14M	vanilla/versions
    18M	vanilla
    

    If 18M is acceptable, we may prefetch all versions, removing IFD completely.

    opened by linyinfeng 1
  • Fix username and skin

    Fix username and skin

    • Pass the missing username argument to mc
    • Fix skin downloading by making the assets directory mutable
    • Also do nix flake update, bump the input nixpkgs to the latest nixos-unstable
    opened by linyinfeng 0
Owner
null
Launcherpi - Minecraft Launcher for Raspberry Pi computers

launcherpi Minecraft Launcher for Raspberry Pi computers. ASLO BIG THANKS TO KLO

null 8 Sep 24, 2022
MCRPC (Minecraft Resource Pack Comparator) checks your resource pack against any version of Minecraft to show resources missing from your pack for that version.

Minecraft Resource Pack Comparator MCRPC checks your resource pack against any version of Minecraft to show resources missing from your pack for that

null 3 Nov 3, 2022
Dontdie-minecraft - A python program that causes your computer to bluescreen whenever you die in Minecraft

Don't Die - A Python Program A python program that causes your computer to blues

null 3 Apr 19, 2022
A Cataclysm: Dark Days Ahead launcher with additional features

CDDA Game Launcher A Cataclysm: Dark Days Ahead launcher with additional features. Download here. Implemented features Launching the game Detecting th

Rémy Roy 402 Jan 2, 2023
A launcher to launch games from Riot Games under Linux

rito-launcher A launcher to launch games from Riot Games under Linux Requirements: Python 3, with the following pip plugins: 'configparser, pathlib, w

null 6 Mar 7, 2022
Launch any Heroic-Games-Launcher game using bash scripts without having to open Heroic.

HeroicBashLauncher Ever wanted to launch your EGS games installed through Heroic Games Launcher directly from the terminal, Lutris or any other fronte

null 288 Dec 27, 2022
Découvrez CubeCraft Launcher, une application uniquement codé en Python et en Batch

Découvrez CubeCraft Launcher, une application uniquement codé en Python et en Batch. Grâce à son interface graphique facile et intuitive, vous pouvez vous retrouver facilement.

null 1 May 21, 2022
🌍🍓 A better MCPi Launcher

Planet Launcher A better, maintained launcher for the Minecraft: Pi Edition Reborn mod. Report Bug | Request Feature Planet is a maintained, feature-r

null 15 Oct 19, 2022
This is a simple tic tac toe game that runs in the command line.

Tic Tac Toe Game This is a simple tic tac toe game that runs in the command line. Game Description: The game is made up of a square grid with 9 portio

Josias Aurel 2 Nov 12, 2022
Typing test and practice on command line without the need of any internet connection

Terminal-Typing-Test Typing test and practice on command line without the need of any internet connection About CLI based typing test and practice tha

Angad Deep Singh 3 Oct 19, 2022