Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Rewrite #217

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 25 additions & 7 deletions flake.lock

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

66 changes: 33 additions & 33 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@
description = "Minecraft server in Nix";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
import-cargo.url = github:edolstra/import-cargo;
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
import-cargo.url = "github:edolstra/import-cargo";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, import-cargo, flake-utils }:
outputs = {
self,
nixpkgs,
import-cargo,
flake-utils,
}:
{
overlays = rec {
mineflake = final: prev: {
mineflake = import ./pkgs {
pkgs = prev;
lib = prev.lib;
inherit (import-cargo.builders) importCargo;
};
};

mineflakeWithCustomAttrs = attrs: final: prev: {
mineflake = import ./pkgs ({
pkgs = prev;
lib = prev.lib;
inherit (import-cargo.builders) importCargo;
} // attrs);
pkgs = prev;
inherit (import-cargo.builders) importCargo;
}
// attrs);
};

default = mineflake;
Expand Down Expand Up @@ -52,38 +56,34 @@
};
default = docker;
};
} // flake-utils.lib.eachDefaultSystem (system:
let
}
// flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
overlays = [self.overlays.default];
};
overlay = (self.overlays.default pkgs pkgs).mineflake;
in
{
devShells.default = import ./shell.nix { inherit pkgs; };
in {
devShells.default = import ./shell.nix {inherit pkgs;};

packages =
let
buildInputs = builtins.filter (p: p ? outPath) (builtins.attrValues overlay);
namedInputs =
builtins.listToAttrs
(builtins.map
(p:
{
name = p;
value = builtins.getAttr p overlay;
})
(builtins.filter
(p: (builtins.getAttr p overlay) ? outPath)
(builtins.attrNames overlay)
)
);
in
(overlay // {
packages = let
buildInputs = builtins.filter (p: p ? outPath) (builtins.attrValues overlay);
namedInputs =
builtins.listToAttrs
(
map
(p: {
name = p.name;
value = p.outPath;
})
buildInputs
);
in (overlay
// {
# This is a hack to get the buildInputs of the overlay
# Used for caching on cachix
default = pkgs.stdenv.mkDerivation {
default = pkgs.stdenvNoCC.mkDerivation {
name = "all";
src = ./.;
buildInputs = buildInputs;
Expand Down
29 changes: 29 additions & 0 deletions pkgs/bungeecord/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
lib,
maven,
fetchgit,
mineflake,
}:
maven.buildMavenPackage rec {
pname = "bungeecord";
version = "1858";

src = fetchgit {
url = "https://github.com/SpigotMC/BungeeCord.git";
fetchSubmodules = true;
rev = "cd56fb32c207b39b9470d66d7c61f68d9f0c7e78";
sha256 = "sha256-pD0ZQRIYNJuohcnj6lKnOaALMiSB6yj/Arz/reu2qSM=";
};

mvnHash = "sha256-7vcVC/TZwiAQh38i7c9YK/ef1hj/v/d3mprFqiCYch4=";

nativeBuildInputs = [mineflake.installConfig];

installPhase = ''
install -Dm644 ./bootstrap/target/BungeeCord.jar $out/server.jar
${lib.concatMapStrings (name: ''
install -Dm644 ./module/cmd-${name}/target/cmd_${name}.jar $out/modules/cmd_${name}.jar
'') ["alert" "find" "list" "send" "server"]}
install -Dm644 ./module/reconnect-yaml/target/reconnect_yaml.jar $out/modules/reconnect_yaml.jar
'';
}
Loading
Loading