Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
flake = false;
url = "github:nothings/stb/5736b15f7ea0ffb08dd38af21067c314d6a3aae9";
};
ninecraft-mod-toolchain-build-scripts = {
flake = false;
url = "github:MCPI-Revival/ninecraft-mod-toolchain-build-scripts";
};
};

outputs = {
Expand All @@ -31,11 +35,15 @@
glad,
ancmp,
stb,
ninecraft-mod-toolchain-build-scripts,
}: let
mkPkgs = system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
overlays = [nixgl.overlay];
};
in
Expand All @@ -45,11 +53,14 @@
packages =
(import ./nix/pkgs {
inherit pkgs;
inherit glad stb ancmp;
flakeRoot = self;
# inherit glad stb ancmp ninecraft-mod-toolchain-build-scripts;
# ancmp = ./ancmp;
})
// {
default = packages.ninecraft;
default = packages.buildNinecraftInstance {
version = packages.mcpeVersions.a0_6_1;
};
};
apps = {
extract = {
Expand All @@ -58,9 +69,6 @@
};
};
formatter = pkgs.alejandra;
devShell = pkgs.callPackage ./nix/shell.nix {
inherit (packages) ninecraft ninecraft-nixgl;
};
})
// {
nixosModule = {pkgs, ...}: {
Expand Down
178 changes: 110 additions & 68 deletions nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Please don't just blindly copy and paste the below, please [learn about nix flak
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
ninecraft = {
ninecraft = {
url = "github:MCPI-Revival/Ninecraft";
inputs.nixpkgs.follows = "nixpkgs";
};
Expand All @@ -25,8 +25,8 @@ Please don't just blindly copy and paste the below, please [learn about nix flak
nixosConfigurations = {
# NOTE: change "host" to your system's hostname
host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = [ninecraft];
system = "x86_64-linux";
specialArgs = [ninecraft];
modules = [
./configuration.nix
];
Expand All @@ -37,11 +37,11 @@ Please don't just blindly copy and paste the below, please [learn about nix flak
user = lib.homeManagerConfiguration {
extraSpecialArgs = moduleArgs;

specialArgs = [ninecraft];
specialArgs = [ninecraft];
modules = [
./home.nix
];
system
system
};
};
};
Expand All @@ -57,78 +57,120 @@ Please don't just blindly copy and paste the below, please [learn about nix flak
```nix
{pkgs,lib,...}:
{
imports = [
# without flakes
<ninecraft/nix/nixos>
#with flakes
ninecraft.nixosModule
];

# ... other stuff

programs.ninecraft = {
enable = true;
openFirewall = true;
};
imports = [
# without flakes
<ninecraft/nix/nixos>
#with flakes
ninecraft.nixosModule
];

# ... other stuff

programs.ninecraft = {
enable = true;
openFirewall = true;
};
}
```

## HomeManager

> home.nix

This is a work in progress and many options may not function yet.

```nix
{pkgs,lib,...}:
{
imports = [
# without flakes
<ninecraft/nix/home>
#with flakes
ninecraft.homeManagerModule
];

# ... other stuff

programs.ninecraft = {
enable = true;
version = "0.6.0";
#apk = fetchzip {
# url = "https://archive.org/download/MCPEAlpha/PE-a0.7.0-x86.apk"
# hash = lib.fakeHash;
# }
options = {
"mp_username"="Steve";
"mp_server"="Steve";
"mp_server_visible_default"=true;
"gfx_fancygraphics"=true;
"gfx_lowquality"=false;
"ctrl_sensitivity"=0.5
"ctrl_invertmouse"=false;
"ctrl_islefthanded"=false;
"ctrl_usetouchscreen"=false;
"ctrl_usetouchjoypad"=false;
"feedback_vibration"=false;
"game_difficulty"=4;
};
#extracts into mod folder
mods = with pkgs; [
(fetchzip {
url = "example.com/mod.zip";
hash = lib.fakeHash;
})
(fetchgit {
url = "https://.../ok.git";
hash = lib.fakeHash;
})
(fetchFromGitHub {
owner = "a";
repo = "b";
rev = "main";
hash = lib.fakeHash;
})
]
}
imports = [
# without flakes
<ninecraft/nix/home>
#with flakes
ninecraft.homeManagerModule
];

# ... other stuff

programs.ninecraft = {
enable = true;
version = "0.6.0";
#apk = fetchzip {
# url = "https://archive.org/download/MCPEAlpha/PE-a0.7.0-x86.apk"
# hash = lib.fakeHash;
# }
options = {
"mp_username"="Steve";
"mp_server"="Steve";
"mp_server_visible_default"=true;
"gfx_fancygraphics"=true;
"gfx_lowquality"=false;
"ctrl_sensitivity"=0.5
"ctrl_invertmouse"=false;
"ctrl_islefthanded"=false;
"ctrl_usetouchscreen"=false;
"ctrl_usetouchjoypad"=false;
"feedback_vibration"=false;
"game_difficulty"=4;
};
#extracts into mod folder
mods = with pkgs; [
(fetchzip {
url = "example.com/mod.zip";
hash = lib.fakeHash;
})
(fetchgit {
url = "https://.../ok.git";
hash = lib.fakeHash;
})
(fetchFromGitHub {
owner = "a";
repo = "b";
rev = "main";
hash = lib.fakeHash;
})
]
}
}
```
```

# Modding

## Create Mod

```nix
with import <ninecraft/nix/pkgs> {}:
buildNinecraftMod {
pname = "mymod";
version = "0.1.0";
src = ./src;
}
```
```nix
with import <ninecraft/nix/pkgs> {}:
buildNinecraftMod {
pname = "mymod";
version = "0.1.0";
src = fetchurl {
url = "example.com/path/to/mod.zip";
hash = lib.fakeHash;
};
precompiled = true;
compiledX86 = "x86/mod.so";
compiledArm = "arm/mod.so";
}
```

```nix
with import <nixpkgs> {};
with import <ninecraft/nix/pkgs> {}:
buildNinecraftMod {
pname = "mymod";
version = "0.1.0";
src = fetchurl {
url = "example.com/path/to/mod/${system}/mod.so";
hash = lib.fakeHash;
};
precompiled = true;
}
```
17 changes: 17 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
pkgs ?
import <nixpkgs> {
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
},
lib ? import ./lib.nix {inherit pkgs;},
ninecraftPkgs ? import ./pkgs {inherit pkgs;},
}:
ninecraftPkgs
// {
inherit (lib) nixgl;
home = import ./home;
nixos = import ./nixos;
}
Loading
Loading