-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
84 lines (76 loc) · 3.27 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "Nix PaperMC and Fabric Options";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
};
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in rec {
packages.${system} = let
web-port = 8080;
in {
default = let
cfg = {config, pkgs, lib, ...}: {
system.stateVersion = "24.05";
minecraft.servers = {
fabric = {
type = "fabric";
mods = with instances.mods; [
servux
fabric-proxy-lite
];
jvm-args = [
"-Xms2024M"
"-Xmx2024M"
];
};
paper = {
type = "paper";
plugins = with instances.plugins; [
decent-holograms
iportal-updated
dynmap
];
extra-configs."plugins/dynmap/configuration.txt" = ''
webserver-port: ${builtins.toString web-port}
'';
};
};
minecraft.port = 25565;
minecraft.eula = true;
users.users.root.packages = with pkgs; [nmap htop (mc-cmd config)];
users.users.root.password = "root";
users.users.root.shell = pkgs.zsh;
programs.zsh.enable = true;
virtualisation.vmVariant = {
virtualisation.graphics = false;
virtualisation.forwardPorts = [
{ from = "host"; host.port = 2222; guest.port = 22; }
{ from = "host"; host.port = web-port; guest.port = web-port; }
{ from = "host"; host.port = config.minecraft.port; guest.port = config.minecraft.port; }
];
virtualisation.memorySize = 8192;
virtualisation.cores = 4;
};
services.getty.autologinUser = "root";
networking.firewall.enable = false;
networking.hostName = "nix-velocity";
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
};
in (nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nixosModules.default
cfg
];
}).config.system.build.vm;
test-instances = import ./utils/test-instances.nix {inherit pkgs instances;};
};
nixosModules.default = import ./.;
mc-cmd = config: import ./utils/mc-cmd.nix {inherit pkgs config;};
instances = import ./instances { inherit pkgs; };
utils = import ./utils {inherit pkgs; lib = pkgs.lib; };
};
}