A simple Advent of Code bot made in Elixir with Nostrum. Made as part of Hack Club's Midnight event: http://midnight.hackclub.com/
You can invite it using this link.
Originally created for the discord.gg/roalgo AoC channel in 2023, where it's still used each year. Refreshed in 2025 as part of Midnight.
Once added to your server, run the /setup command. To get your AoC session cookie, follow this guide.
This flake exposes nixosModules.default and an overlay providing pkgs.aoc-bot (add the overlay so the module finds the package by default). services.aoc-bot.databaseUrl is required; provide secrets via environment or environmentFiles. The service defaults to DynamicUser = true and adds common systemd hardening.
{
inputs.aoc-bot.url = "github:susannak/aoc_bot";
outputs = inputs: {
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
inputs.aoc-bot.overlays.default
inputs.aoc-bot.nixosModules.default
({ ... }: {
services.aoc-bot = {
enable = true;
databaseUrl = "ecto://user:pass@host:5432/dbname"; # required
environment = {
DISCORD_TOKEN = "xxx";
};
environmentFiles = [ "/run/keys/aoc-bot.env" ];
};
})
];
};
};
}Use inputs.aoc-bot.overlays.default if you want the package available as pkgs.aoc-bot outside the module.
If you manage secrets with agenix, point environmentFiles at the decrypted file path:
services.aoc-bot.environmentFiles = [ config.age.secrets.aoc-bot-env.path ];The file should contain KEY=value lines such as DISCORD_TOKEN=... and DATABASE_URL=... if you override the generated one.
Licensed under AGPL-3.0 © Susan