add minecraft

This commit is contained in:
Clayton Hickey 2026-02-08 15:35:11 -05:00
parent 6fcb438f67
commit 6291633247
4 changed files with 231 additions and 4 deletions

View file

@ -9,7 +9,9 @@
./gnupg.nix
./bikeability.nix
./emacs.nix
./minecraft/minecraft-servers.nix
"${inputs.home-manager}/nixos"
inputs.nix-minecraft.nixosModules.minecraft-servers
];
options.cos = {

151
flake.lock generated
View file

@ -21,6 +21,22 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -79,6 +95,24 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_4"
},
"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"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -129,6 +163,25 @@
"type": "github"
}
},
"languini": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1767569345,
"narHash": "sha256-ixEb89DxtqHDFlMZ/35UVd/1fqgPbhQmMor0MKepzk0=",
"ref": "refs/heads/master",
"rev": "614b49910876415d29a86eceb09831bb15c12246",
"revCount": 81,
"type": "git",
"url": "ssh://forgejo@10.100.0.1/TutorEngine/leptos_client.git"
},
"original": {
"type": "git",
"url": "ssh://forgejo@10.100.0.1/TutorEngine/leptos_client.git"
}
},
"mapnix": {
"inputs": {
"oldNixpkgs": "oldNixpkgs"
@ -147,7 +200,59 @@
"type": "github"
}
},
"nix-minecraft": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1766628630,
"narHash": "sha256-ULKQFi7/TohrfOsLP/ESfwvd1DjAuwwshLkgj5lqijM=",
"owner": "Infinidoge",
"repo": "nix-minecraft",
"rev": "649604ce765f36edee9abbb44f65d88575811c41",
"type": "github"
},
"original": {
"owner": "Infinidoge",
"repo": "nix-minecraft",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1763464769,
"narHash": "sha256-AJHrsT7VoeQzErpBRlLJM1SODcaayp0joAoEA35yiwM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6f374686605df381de8541c072038472a5ea2e2d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1748929857,
"narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1764950072,
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
@ -163,7 +268,7 @@
"type": "github"
}
},
"nixpkgs_2": {
"nixpkgs_4": {
"locked": {
"lastModified": 1742422364,
"narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=",
@ -261,8 +366,8 @@
},
"penn-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1742609439,
@ -282,12 +387,35 @@
"inputs": {
"cnvim": "cnvim",
"home-manager": "home-manager",
"languini": "languini",
"mapnix": "mapnix",
"nixpkgs": "nixpkgs",
"nix-minecraft": "nix-minecraft",
"nixpkgs": "nixpkgs_3",
"osm-bikeability": "osm-bikeability",
"penn-nix": "penn-nix"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"languini",
"nixpkgs"
]
},
"locked": {
"lastModified": 1763606317,
"narHash": "sha256-lsq4Urmb9Iyg2zyg2yG6oMQk9yuaoIgy+jgvYM4guxA=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a5615abaf30cfaef2e32f1ff9bd5ca94e2911371",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
@ -332,6 +460,21 @@
"repo": "default",
"type": "github"
}
},
"systems_4": {
"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",

View file

@ -17,6 +17,10 @@
url = "github:clay53/osm-bikeability";
flake = false;
};
languini = {
url = "git+ssh://forgejo@10.100.0.1/TutorEngine/leptos_client.git";
};
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
};
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations.clhickey-nixos = nixpkgs.lib.nixosSystem {
@ -29,6 +33,7 @@
specialArgs = { inherit inputs; };
modules = [
./nixnas/nixnas.nix
inputs.languini.nixosModules.default
];
};
};

View file

@ -0,0 +1,77 @@
{ config, lib, pkgs, ... }:
let
survivalPort = 25565;
creativePort = 25566;
users = {
clay53_clayton = "bc2653cd-6cb1-4d15-9d24-cce0d1e8811c";
fire_chase = "c2b1a7ff-abff-41cb-af2a-4a89e942d288";
piggywhipster = "6b4419bf-2a5f-4932-b779-33dcdbbf4c06";
};
defaultWhitelist = {
inherit (users)
clay53_clayton
fire_chase
piggywhipster
;
};
defaultOperators = {
inherit (users)
clay53_clayton
fire_chase;
};
minRam = "512M";
maxRam = "1G";
in
{
config = lib.mkMerge [
(lib.mkIf (config.networking.hostName == "nixnas") {
services.minecraft-servers = {
enable = true;
eula = true;
openFirewall = false;
dataDir = "/Block/minecraft-servers";
};
services.minecraft-servers.servers.survival = {
enable = true;
autoStart = true;
restart = "always";
enableReload = false;
whitelist = defaultWhitelist;
operators = defaultOperators;
serverProperties = {
server-port = survivalPort;
difficulty = 3;
gamemode = 0;
motd = "Clayton Hickey's Survival";
white-list = true;
};
package = pkgs.minecraftServers.vanilla-1_21_11;
jvmOpts = "-Xms${minRam} -Xmx${maxRam}";
};
services.minecraft-servers.servers.creative = {
enable = true;
autoStart = true;
restart = "always";
enableReload = false;
whitelist = defaultWhitelist;
operators = defaultOperators;
serverProperties = {
server-port = creativePort;
difficulty = 3;
gamemode = 1;
motd = "Clayton Hickey's Creative";
white-list = true;
};
package = pkgs.minecraftServers.vanilla-1_21_11;
jvmOpts = "-Xms${minRam} -Xmx${maxRam}";
};
networking.firewall.interfaces.${config.cos.wireguard.interface}.allowedTCPPorts = [
survivalPort
creativePort
];
})
];
}