Closed Silverdev2482 closed 7 months ago
I think this might actually just straight up be a nixpkgs issue.
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, ... }: {
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ];
};
};
}
Running nix eval .#nixosConfigurations.test
leads to something that is (effectively) infinite recursion, in that it endlessly prints the same error then stack overflows.
This is... wild, to say the least.
I think that might be a nix eval
specific issue though. Lemme see if I can make a minimum reproduction case.
Nevermind, I think I found it.
Change specialArgs = inputs;
to specialArgs = { inherit inputs; };
Thanks, that fixed that issue, should a note be added for flake requirements in the documentation?
I have been getting miscellaneous errors, some being errors about having incorrect hashes, which I eventually fixed, now it isn't caring about anything, there are no process running that have java or minecraft in their names, nor are there any systemd units I can start.
Rebuild output:
[root@Server:/etc/nixos]# nixos-rebuild switch --option eval-cache false --flake ./
building the system configuration...
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
reloading user units for sddm...
reloading user units for silverdev2482...
setting up tmpfiles
[root@Server:/etc/nixos]#
Updated Flake:
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
};
outputs =
{ self
, nixpkgs
, ...
}@inputs:
let
system = "x86_64-linux";
in
{
formatter.${system} = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
nixosConfigurations = {
Server = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
./hardware-configuration.nix
./configuration.nix
];
};
};
};
}
updated configuration.nix
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, lib, inputs, ... }:
{
# Use the systemd-boot EFI boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
nixpkgs.config.allowUnfree = true;
networking.hostName = "Server"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty.
# };
# Enable the X11 windowing system.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
services.minecraft-servers.servers.survival =
let
modpack = pkgs.fetchPackwizModpack {
url = "https://raw.githubusercontent.com/Silverdev2482/Survival-mods/main/pack.toml";
packHash = "Yes this is a totaly normal hash and not a random string";
};
mcVersion = modpack.manifest.versions.minecraft;
fabricVersion = modpack.manifest.versions.fabric;
serverVersion = lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}";
in
{
enable = true;
eula = true;
autoStart = true;
nonExistantOptionThatShouldThrowError = true;
dataDir = "/srv/survival";
openFirewall = true;
package = pkgs.fabricServers.${serverVersion}.override { loaderVersion = fabricVersion; };
symlinks = {
"mods" = "${modpack}/mods";
};
};
services.minecraft-servers.servers.idk = {
pleaseThrowAnError = true;
enable = true;
eula = false;
};
# Enable the Plasma 5 Desktop Environment.
services = {
xserver = {
displayManager.sddm.enable = true;
desktopManager.plasma5.enable = true;
enable = true;
};
# minecraft-server = {
# enable = false;
# eula = true;
# jvmOpts = "-Xmx6144M -Xms4096M";
# dataDir = "/persist/minecraft";
# openFirewall = true;
#
# package =
# let
# version = "1.20.2";
# url = "https://meta.fabricmc.net/v2/versions/loader/1.20.2/0.14.23/0.11.2/server/jar";
# sha256 = "1mac4sv7d0r4z4lh78kqfq2kwj43612z2ch9jqnc2y4j05g6v9nj";
# in
# (pkgs.minecraft-server.overrideAttrs (old: rec {
# name = "minecraft-server-${version}";
# inherit version;
#
# src = pkgs.fetchurl {
# inherit url sha256;
# };
# }));
# };
};
#
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users = {
mutableUsers = true;
users.silverdev2482 = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
};
users.users.storage-server = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
# packages = with pkgs; [
# firefox
# tree
# ];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
mimalloc
qjoypad
wget
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
firefox
openjdk17-bootstrap
git
packwiz
neofetch
btop
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
programs.mosh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
networking.firewall.allowedUDPPorts = [ 24454 ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configura[{"name":"Silverdev2482","uuid":"2674143f-9e1b-4a43-b685-0332e9a01956",tion.nix.
# system.copySystemConfiguration = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}```
The only way I have been able get errors from in that code block is syntax errors.
after uncommenting the normal minecraft server now for some reason that one isn't working either. no sysemd units or running processes like before. I have no idea what is going on.
You forgot to do services.minecraft-servers.enable = true;
If the main enable option isn't set to true, nothing gets setup at all.
Not sure about the normal minecraft server not making a systemd unit.
Also, where did you get that fabric jar trick you used there?
Oh I know why the normal minecraft server isn't working. You set enable = false;
It appears to be working but I need to figure out how to move my world. Thank you so much for the help.
Moving the world is pretty straight forward. The original server should be in /var/lib/minecraft
, while your new server should be in /srv/minecraft/servernamehere
Reread the configuration, your original server seems to be in /persist/minecraft
.
Please note! Your configuration isn't correctly setting the data directory for the new server!
nix-minecraft
doesn't let you set the data directory per-server, only the base for all servers. Your server will be in /srv/minecraft/servernamehere
currently.
I decided /srv would be the better directory to put stuff, I just wasn't sure where to put the server before, I have manually moved the world files. however the server is crashing when I attempt to start it with the old world, works fine on the automatically created world however. I also forgot to make /srv a string so that was a minor problem.
May I ask where the original fetch code snippet was supposed to go? Outside the { } inside configuration.nix? As for documentation should a full configuration be included in it? I would be willing to help make a boilerplate config based on the one I arrived at.
Is there a better way to update the mod pack than deleting the hash and getting the new one from nixos-rebuild?
There are better ways, but they generally require a lot more infrastructure. I personally just rebuild and fill in the hash for those kinds of things.
As written, the snippet is the body of a module. So in this case, it would be the body of a configuration.nix
, missing module the inputs at the top.
A complete configuration, flake and all, is a bit out of scope of the documentation, but could be put as a template instead. Even then, I feel like it's overkill.
I personally would have found it useful. Should I try and make a full tutorial in a seperate repo, with a complete boilerplate config? I am somewhat busy, and don't have the best of knowledge, but I could work on it and improve it. If it got good enough you could redirect people to it or import it into the docs. Also can't the documentation from the services.minecraft-server just be copied from the file as it appears to be there?
I am not sure if I am doing something wrong here or this is an issue with the flake but I am getting this error I also have a normal nixpkgs minecraft server running on this pc but I don't think it is causing this issue Is this user error or a problem with the flake?
Here is the full log, abridged configuration.nix, and flake.nix log.txt