From d481d06e6ec98eb5b67a28b267c371099deef7ae Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sat, 21 Jun 2025 00:59:39 -0400 Subject: [PATCH] Infini-DL360/drasl: init --- flake.lock | 43 ++++++++++++++++++++++ flake.nix | 3 ++ hosts/Infini-DL360/default.nix | 1 + hosts/Infini-DL360/drasl.nix | 66 ++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 hosts/Infini-DL360/drasl.nix diff --git a/flake.lock b/flake.lock index 743455c..86baeed 100644 --- a/flake.lock +++ b/flake.lock @@ -130,6 +130,27 @@ "type": "github" } }, + "buildNodeModules": { + "inputs": { + "nixpkgs": [ + "drasl", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1707354861, + "narHash": "sha256-L10H5hh9S6y20c7AKuKJ2h9BczODqpTCoGEZBDPJhd0=", + "owner": "adisbladis", + "repo": "buildNodeModules", + "rev": "76c7c56dd9dcea355a8e2ebd0f228a8f2d1e1ee8", + "type": "github" + }, + "original": { + "owner": "adisbladis", + "repo": "buildNodeModules", + "type": "github" + } + }, "complement": { "flake": false, "locked": { @@ -263,6 +284,27 @@ "type": "github" } }, + "drasl": { + "inputs": { + "buildNodeModules": "buildNodeModules", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1745600873, + "narHash": "sha256-pVUWppj3u0qOa1G06X/2ettNHmTsl01TrjTh8y18ZGw=", + "owner": "unmojang", + "repo": "drasl", + "rev": "8ff0a07efc4fb8ab2a0509407caccbd16934661d", + "type": "github" + }, + "original": { + "owner": "unmojang", + "repo": "drasl", + "type": "github" + } + }, "fenix": { "inputs": { "nixpkgs": [ @@ -901,6 +943,7 @@ "conduwuit": "conduwuit", "devshell": "devshell", "disko": "disko", + "drasl": "drasl", "flake-parts": "flake-parts", "flake-registry": "flake-registry", "flake-utils": "flake-utils", diff --git a/flake.nix b/flake.nix index 742b106..a10f406 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ ## Minecraft nix-minecraft.url = "github:Infinidoge/nix-minecraft"; + drasl.url = "github:unmojang/drasl"; ## Rust rust-overlay.url = "github:oxalica/rust-overlay"; @@ -100,6 +101,7 @@ conduwuit.inputs.nixpkgs.follows = "nixpkgs"; devshell.inputs.nixpkgs.follows = "nixpkgs"; disko.inputs.nixpkgs.follows = "nixpkgs"; + drasl.inputs.nixpkgs.follows = "nixpkgs"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-utils.inputs.systems.follows = "systems"; git-hooks.inputs.flake-compat.follows = "blank"; @@ -254,6 +256,7 @@ inputs.lix-module.nixosModules.default inputs.hydra.nixosModules.overlayNixpkgsForThisHydra inputs.nix-minecraft.nixosModules.minecraft-servers + inputs.drasl.nixosModules.drasl ] ++ (self.lib.leaves ./modules); }) (self.lib.flattenLeaves ./hosts); diff --git a/hosts/Infini-DL360/default.nix b/hosts/Infini-DL360/default.nix index bde88f6..0647600 100644 --- a/hosts/Infini-DL360/default.nix +++ b/hosts/Infini-DL360/default.nix @@ -13,6 +13,7 @@ private.nixosModules.minecraft-servers ./authentik.nix ./conduwuit.nix + ./drasl.nix ./factorio.nix ./forgejo.nix ./freshrss.nix diff --git a/hosts/Infini-DL360/drasl.nix b/hosts/Infini-DL360/drasl.nix new file mode 100644 index 0000000..ffcda98 --- /dev/null +++ b/hosts/Infini-DL360/drasl.nix @@ -0,0 +1,66 @@ +# I personally bought Minecraft twice +# My friends all own or have owned Minecraft +# But sometimes people don't want to use Mojang/Microsoft's servers +# This is for that +{ + common, + config, + ... +}: +let + cfg = config.services.drasl; + domain = common.subdomain "drasl"; + + Mojang = { + Nickname = "Mojang"; + SessionURL = "https://sessionserver.mojang.com"; + AccountURL = "https://api.mojang.com"; + }; +in + +{ + services.drasl = { + enable = true; + settings = { + Domain = domain; + BaseURL = "https://${domain}"; + ListenAddress = "127.0.0.1:27585"; + DefaultAdmins = [ "Infinidoge" ]; + InstanceName = "INX Drasl"; + ApplicationOwner = "INX"; + + AllowAddingDeletingPlayers = true; + AllowChangingPlayerName = true; + DefaultMaxPlayerCount = 3; + CreateNewPlayer.AllowChoosingUUID = true; + RegistrationNewPlayer = { + Allow = true; + RequireInvite = true; + }; + RegistrationExistingPlayer = { + Allow = true; + RequireInvite = true; + }; + + FallbackAPIServers = [ + ( + Mojang + // { + ServicesURL = "https://api.minecraftservices.com"; + SkinDomains = [ "textures.minecraft.net" ]; + CacheTTLSeconds = 60; + } + ) + ]; + + ImportExistingPlayer = Mojang // { + Allow = true; + SetSkinURL = "https://www.minecraft.net/msaprofile/mygames/editskin"; + }; + }; + }; + + services.nginx.virtualHosts.${domain} = common.nginx.ssl-inx // { + locations."/".proxyPass = "http://${cfg.settings.ListenAddress}"; + }; +}