NixOS: The last word in Armagetron hosting

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

NixOS: The last word in Armagetron hosting

Post by numinit »

Hi there,

Long time lurker since 2008. I used to run the iD Tech Camps High Rubber and Racing back when I was a teenager. I recently turned 30, and realized that I've been doing Linux hosting for the majority of the time I've been alive, and it sort of began with this game.

15 years later, it's time to give back to the community that got me started with a career in computer engineering.

We've come a long way since the times of PHP scripts for server management and handing out the root password to random people. However, Docker was a huge step in the wrong direction. It's easy, yes, but shipping an entire Linux distribution to run applications is a terrible idea. What happens when you need to update any of the binary dependencies? Bitrot and throwing everything in /home happens, and things tend to be hard to maintain.

nixpkgs solves these problems, and now lets you build the following Armagetron servers or clients using this pull request:
  • pkgs.armagetronad
  • pkgs.armagetronad.dedicated
  • pkgs.armagetronad."0.2.9-sty+ct+ap"
  • pkgs.armagetronad."0.2.9-sty+ct+ap".dedicated
  • pkgs.armagetronad."0.4"
  • pkgs.armagetronad."0.4".dedicated
So, once it's merged into nixpkgs, you can do something like:

Code: Select all

nix run 'nixpkgs#armagetronad."0.2.9-sty+ct+ap"'
In the meantime, you can try this, swapping out the attribute with one of those in the above list to get any of the major branches of Armagetron:

Code: Select all

nix run 'github:numinit/nixpkgs/armagetronad#armagetronad."0.2.9-sty+ct+ap"'
Not content with that, I created another pull request creating a NixOS module with automated end-to-end integration tests that verify that two users can join the same server and that one can coredump another. It steps through the tutorial, using OCR to click menu entries.

So, here's how you conjure multiple dedicated servers from thin air now:

Code: Select all

services.armagetronad.servers = {
  high-rubber = {
    enable = true;
    name = "My High Rubber Server";
    port = 4534;
    dns = "mydomain.example.com";
    settings = {
      SERVER_OPTIONS = "Example high rubber server.";
      CYCLE_RUBBER = 40;
      SIZE_FACTOR = 0.5;
    };
    roundSettings = {
      SAY = [
        "Maybe you should try NixOS..."
        "https://nixos.org"
      ];
    };
  };
  low-rubber = {
    # Another config goes here ...
  };
};
Please enjoy hosting whatever servers you damn please, in perpetuity, using NixOS.

The cost: $0.

----

Since it's been a while, greetz to SmOoThIcE and Puffyfluff. Thanks guys.

-Morgan [numinit]
https://github.com/numinit/
Last edited by numinit on Wed Nov 01, 2023 5:18 am, edited 1 time in total.
User avatar
Z-Man
God & Project Admin
Posts: 11550
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: NixOS: The last word in Armagetron hosting

Post by Z-Man »

That sounds absolutely fantastic! I'll try this out as soon as possible.

(I do love me some docker for building software. Gives a nice, stable, reproducible environment. Sure, it's just chroot on steroids when used like that, but... it's chroot on steroids.)
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

Re: NixOS: The last word in Armagetron hosting

Post by numinit »

Z-Man wrote: Sat Oct 28, 2023 11:29 am That sounds absolutely fantastic! I'll try this out as soon as possible.

(I do love me some docker for building software. Gives a nice, stable, reproducible environment. Sure, it's just chroot on steroids when used like that, but... it's chroot on steroids.)
Cool. :D Questions for you.
  • I noticed a compile error with sty+ct+ap related to player shuffling only making sense on the dedicated server, here's a patch. Would be great if this was upstreamed.
  • Are you aware of crashes with --enable-memmanager such as this one? https://github.com/NixOS/nixpkgs/issues/263244
  • Should we be pulling from Bazaar or Git? Right now I'm pulling from Bazaar but could switch to Git.
  • What analog to https://launchpad.net/armagetronad/${la ... rsion}.tbz could be directly fetched from Bazaar or Git? Nix performs the bootstrap.sh and I noticed that tarball is already bootstrapped.
  • Should the input file just be an empty file? (A fifo freezes the entire server.)
  • Any chance you could change this account name to numinit (and delete the account "numinit" that I already created)? I like the 15 year history on this one better but haven't gone by this dumb username since high school.
User avatar
aP|Nelg
Match Winner
Posts: 618
Joined: Wed Oct 22, 2014 10:22 pm
Contact:

Re: NixOS: The last word in Armagetron hosting

Post by aP|Nelg »

Neat!

maclover201 wrote: Sat Oct 28, 2023 10:02 pm I noticed a compile error with sty+ct+ap related to player shuffling
Ah, looks like I lazily cut'n'pasted an AccessLevelSetter line from somewhere and failed to properly update it for SHUFFLE_PLAYER, whoops. :oops:

Fixed now.
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

Re: NixOS: The last word in Armagetron hosting

Post by numinit »

Perfect, confirmed working.

Regarding the source tarball, it doesn't look like there's a release for 0.2.9.1.1 on github so I'm just using bzr for everything for now.
User avatar
Z-Man
God & Project Admin
Posts: 11550
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: NixOS: The last word in Armagetron hosting

Post by Z-Man »

maclover201 wrote: Sat Oct 28, 2023 10:02 pm [*]Are you aware of crashes with --enable-memmanager such as this one? https://github.com/NixOS/nixpkgs/issues/263244
No, but we no longer use that in any way, it used to be faster that the system memory manager and used to give good leak finding results, but these days, it's mostly useless. I should remove it from the configuration.
[*]Should we be pulling from Bazaar or Git? Right now I'm pulling from Bazaar but could switch to Git.
Git is our primary now.
[*]What analog to https://launchpad.net/armagetronad/${la ... rsion}.tbz could be directly fetched from Bazaar or Git? Nix performs the bootstrap.sh and I noticed that tarball is already bootstrapped.
Gitlab provides source archives of the form https://gitlab.com/armagetronad/armaget ... .9.tar.bz2, replace "legacy_0.2.9" with the desired branch name. I guess those would do.
[*]Should the input file just be an empty file? (A fifo freezes the entire server.)
I don't follow; input for what?

About the forum name change, I pinged that to tank/guru3 on IRC, he is the only one who can do it.
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

Re: NixOS: The last word in Armagetron hosting

Post by numinit »

No, but we no longer use that in any way, it used to be faster that the system memory manager and used to give good leak finding results, but these days, it's mostly useless. I should remove it from the configuration.
I've added --disable-memmanager to our compiles for NixOS. That seemed to help the user that was having memory manager crashes.
Git is our primary now. Gitlab provides source archives of the form https://gitlab.com/armagetronad/armaget ... .9.tar.bz2, replace "legacy_0.2.9" with the desired branch name. I guess those would do.
Switched to gitlab, nixpkgs has a helpful fetchFromGitLab function that worked.
I don't follow; input for what?
The --input file used as an alternative to stdin. The NixOS module runs it as a systemd service and uses --daemon --input /var/lib/armagetronad/${server}/input. It seems like this just has to be an empty file instead of a fifo or the server will just block on reading it, which makes sense.
About the forum name change, I pinged that to tank/guru3 on IRC, he is the only one who can do it.
Appreciate it. :D
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

Re: NixOS: The last word in Armagetron hosting

Post by numinit »

aP|Nelg wrote: Mon Oct 30, 2023 11:23 pm Neat!

maclover201 wrote: Sat Oct 28, 2023 10:02 pm I noticed a compile error with sty+ct+ap related to player shuffling
Ah, looks like I lazily cut'n'pasted an AccessLevelSetter line from somewhere and failed to properly update it for SHUFFLE_PLAYER, whoops. :oops:

Fixed now.
https://gitlab.com/armagetronad/armaget ... 39a1720186 seems to fail to compile the dedicated server now, FYI. Lots of opengl functions missing. I just packaged the preceding git revision.

In any case, if users want to override the source input they can with something like

Code: Select all

environment.systemPackages = with pkgs; [
  (armagetronad."0.2.9-sty+ct+ap".dedicated.overrideAttrs (prev: {
    src = fetchFromGitLab {
      # insert your custom fetcher here to use whatever sty+ct+ap you'd like...
    };
  }))
]
User avatar
Lucifer
Project Developer
Posts: 8625
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: NixOS: The last word in Armagetron hosting

Post by Lucifer »

maclover201 wrote: Sun Nov 05, 2023 9:22 pmThe --input file used as an alternative to stdin. The NixOS module runs it as a systemd service and uses --daemon --input /var/lib/armagetronad/${server}/input. It seems like this just has to be an empty file instead of a fifo or the server will just block on reading it, which makes sense.
I don't know whose idea that was, but they should be fired. :) If there is no other process connected to the pipe, the kernel will not start the process. In other words, both sides of the pipe have to be connected to something before any associated processes can start.

So the file *should* be a text file, and you should be able to echo to it to send it commands. That's how I wrote it for a little project awhile back.
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden
User avatar
numinit
On Lightcycle Grid
Posts: 18
Joined: Sat Dec 06, 2008 5:52 am

Re: NixOS: The last word in Armagetron hosting

Post by numinit »

I don't know whose idea that was, but they should be fired.
I totally forgot about the process spawning behavior with named pipes. Yikes. Reason #100 why I don't bother with them.

In any case, the text file works (and has a unit test in the NixOS module :D)
Post Reply