Added Host kb-games-01
Some checks are pending
/ Check NixOS Configuration (push) Waiting to run

This commit is contained in:
Kaybee 2024-11-14 01:43:04 +01:00
parent 5700d32900
commit 6bd354e4d4
6 changed files with 207 additions and 0 deletions

View file

View file

@ -0,0 +1,37 @@
{ inputs, config, lib, pkgs, ... }:
let
cfg = config.services.minecraft;
in
{
imports = [
inputs.nix-minecraft.nixosModules.minecraft-servers
./vanilla-test.nix
./survival.nix
];
options.services.minecraft = {
enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "Enable minecraft server";
};
servers.vanilla.enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "test server";
};
servers.survival.enable = lib.mkOption {
type = with lib.types; uniq bool;
default = false;
description = "Survival Server";
};
};
config = lib.mkIf cfg.enable {
services.minecraft-servers = {
enable = true;
eula = true;
};
};
}

View file

@ -0,0 +1,32 @@
{
inputs,
config,
lib,
pkgs,
system,
...
}:
let
cfg = config.services.minecraft;
in
{
config = lib.mkIf (cfg.enable && cfg.servers.survival.enable) {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"minecraft-server"
];
services.minecraft-servers.servers."survival" = {
enable = true;
autoStart = true;
enableReload = true;
package = pkgs.paperServers.vanilla-1.21.3;
whitelist = {
kB01guy = "1ff88b66-beda-4386-85b9-a00a5c27437a";
};
openFirewall = true;
symlinks.plugins = pkgs.linkFarmFromDrvs "plugins" (builtins.attrValues {
});
};
};
}

View file

@ -0,0 +1,30 @@
{
inputs,
config,
lib,
pkgs,
system,
...
}:
let
cfg = config.services.minecraft;
in
{
config = lib.mkIf (cfg.enable && cfg.servers.vanilla.enable) {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"minecraft-server"
];
services.minecraft-servers.servers."vanilla-test" = {
enable = true;
autoStart = true;
enableReload = true;
package = pkgs.vanillaServers.vanilla;
whitelist = {
kB01guy = "1ff88b66-beda-4386-85b9-a00a5c27437a";
};
openFirewall = true;
};
};
}

View file

@ -0,0 +1,70 @@
{ config, lib, pkgs, inputs, ... }:
{
imports = [ # Include the results of the hardware scan.
./hardware.nix
];
# Configure Nix
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.package = pkgs.lix;
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.devices = [ "nodev" ];
boot.loader.efi.canTouchEfiVariables = true;
# Define your hostname.
networking.hostName = "kb-games-01";
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Configure keymap in X11
services.xserver.xkb.layout = "us";
# Define a user account. Don't forget to set a password with passwd.
users.users.master = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKLbU0GpeqkYOsccsddQgZAppd5SFiokGAfjKr+dEEjY kb HyperC"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHS3DoQe/4TtdTLD/Fl41rTjE0n5MyFMl59VGVejcskO kb voloxo"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPpN/3esM0SFLJ2guCBOYX8IdBC+jUiMF+xPYkTEuzbe kb-work yerukall"
];
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = with pkgs; [
tree
vim
];
};
# List packages installed in system profile. To search, run:
environment.systemPackages = with pkgs; [
vim
wget
git
];
# SSH and Mosh
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
ports = [ 3422 ];
openFirewall = true;
};
programs.mosh.enable = true;
# Minecraft Servers
services.minecraft = {
enable = true;
servers.vanilla.enable = false;
servers.survival.enable = true;
};
# Do NOT change this value
system.stateVersion = "24.05"; # Did you read the comment?
}

View file

@ -0,0 +1,38 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}