From ac24d5aa95b615aba2c907eab96621b631049292 Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Sun, 18 May 2025 04:27:57 +0200 Subject: [PATCH] Updated flake --- flake.lock | 87 +++++++++++++++++++++++++++++++++---- flake.nix | 10 ++--- nix-modpack/flake.nix | 6 +-- nix-modpack/lib/default.nix | 32 +++++++++----- result | 2 +- 5 files changed, 108 insertions(+), 29 deletions(-) diff --git a/flake.lock b/flake.lock index 4439cab..f2312e7 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -34,6 +50,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nix-minecraft": { "inputs": { "flake-compat": "flake-compat", @@ -54,10 +88,30 @@ "type": "github" } }, + "nix-minecraft_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1747526922, + "narHash": "sha256-NmBP0W4RJ8NTkeaMKy/NNzMBIQDa8n161Igbu7zWM2E=", + "owner": "Jan-Bulthuis", + "repo": "nix-minecraft", + "rev": "566b5218ff51d80da60873fe3b5930b8da12091c", + "type": "github" + }, + "original": { + "owner": "Jan-Bulthuis", + "repo": "nix-minecraft", + "type": "github" + } + }, "nix-modpack": { "inputs": { - "nix-minecraft": "nix-minecraft", - "nixpkgs": "nixpkgs_2" + "nix-minecraft": "nix-minecraft_2", + "nixpkgs": "nixpkgs_3" }, "locked": { "path": "./nix-modpack", @@ -87,15 +141,15 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1747327360, - "narHash": "sha256-LSmTbiq/nqZR9B2t4MRnWG7cb0KVNU70dB7RT4+wYK4=", - "owner": "NixOS", + "lastModified": 1742889210, + "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "e06158e58f3adee28b139e9c2bcfcc41f8625b46", + "rev": "698214a32beb4f4c8e3942372c694f40848b360d", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "nixos", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -119,8 +173,8 @@ }, "root": { "inputs": { - "nix-modpack": "nix-modpack", - "nixpkgs": "nixpkgs_3" + "nix-minecraft": "nix-minecraft", + "nix-modpack": "nix-modpack" } }, "systems": { @@ -137,6 +191,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 40e2e30..e92f6ed 100644 --- a/flake.nix +++ b/flake.nix @@ -2,14 +2,14 @@ description = "Minecraft Modpack"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nix-modpack.url = "./nix-modpack"; + nix-minecraft.url = "github:Jan-Bulthuis/nix-minecraft"; }; outputs = inputs: - inputs.nix-modpack { - inherit inputs; - url = "https://git.bulthuis.dev/Jan/Modpack"; - }; + inputs.nix-modpack (system: { + packUrl = "https://git.bulthuis.dev/Jan/Modpack/raw/branch/main/pack.toml"; + server = inputs.nix-minecraft.legacyPackages.${system}.neoForgeServers.neoforge-21_1_172; + }); } diff --git a/nix-modpack/flake.nix b/nix-modpack/flake.nix index 639aa15..7346574 100644 --- a/nix-modpack/flake.nix +++ b/nix-modpack/flake.nix @@ -2,14 +2,14 @@ description = "Create nix derivations from a packwiz modpack"; inputs = { - nix-minecraft.url = "github:Jan-Bulthuis/nix-minecraft"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = - { nix-minecraft, ... }: + { nixpkgs, nix-minecraft, ... }: let lib = import ./lib { - inherit nix-minecraft; + inherit nixpkgs nix-minecraft; }; in { diff --git a/nix-modpack/lib/default.nix b/nix-modpack/lib/default.nix index 9196f05..ac852da 100644 --- a/nix-modpack/lib/default.nix +++ b/nix-modpack/lib/default.nix @@ -1,20 +1,30 @@ -{ nix-minecraft, ... }: +{ nixpkgs, ... }: let + lib = nixpkgs.lib; + + eachSystem = + fn: lib.genAttrs lib.systems.flakeExposed (system: fn (import nixpkgs { inherit system; })); + mkModpack = - { inputs }: + builder: let - nixpkgs = inputs.nixpkgs; - lib = nixpkgs.lib; + mkPackages = + pkgs: + let + bootstrap = pkgs.fetchurl { + url = "https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar"; + sha256 = "qPuyTcYEJ46X9GiOgtPZGjGLmO/AjV2/y8vKtkQ9EWw="; + }; - eachSystem = - fn: lib.genAttrs lib.systems.flakeExposed (system: fn (import nixpkgs { inherit system; })); - - mkPackages = pkgs: { - modpack = nix-minecraft.legacyPackages.${pkgs.system}.fetchPackwizModpack { - url = inputs.self; + buildInfo = builder pkgs.system; + in + lib.trace buildInfo { + server = pkgs.writeShellScriptBin "minecraft-server" '' + ${lib.getExe pkgs.jre} -jar ${bootstrap} -g -s server ${buildInfo.packUrl} + # ${buildInfo.server}/bin/minecraft-server + ''; }; - }; overlay = final: prev: mkPackages prev; in diff --git a/result b/result index a09b9bb..f7119cc 120000 --- a/result +++ b/result @@ -1 +1 @@ -/nix/store/7kz7ab64z7nf5mpdv3d21ncq0ndg5v0x-modpack-1.0.0 \ No newline at end of file +/nix/store/vl5npy1z774a3kmmyifdlscgfw8g3zia-minecraft-server \ No newline at end of file