From df4feaa5a1610cd87f32a454adc917cdeccfd4a3 Mon Sep 17 00:00:00 2001 From: PseudoFractal Date: Sun, 14 Jun 2026 23:45:25 +0530 Subject: [PATCH 1/7] add nix flake with home manager module Adds a Nix flake that builds rmcl from source via rustPlatform.buildRustPackage and a Home Manager module for configuring programs.rmcl. The HM module generates config.toml and theme.toml from Nix options. The package option defaults to the flake's own build so users don't need rmcl in their nixpkgs. Also adds Nix install instructions and a HM usage example to the README, and updates .gitignore for Nix build artifacts. (cherry picked from commit a8c244097ab5b3098fff8ece85b7a28049efd709) --- .gitignore | 3 + README.md | 7 ++ flake.lock | 61 ++++++++++++++ flake.nix | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 309 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index ec9de82..3eff1f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /target /scripts *.log +result +result-* +.direnv diff --git a/README.md b/README.md index 567e80c..477d4ab 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ paru -S rmcl-bin paru -S rmcl-git ``` +### Nix + +```sh +nix run github:objz/rmcl +nix profile install github:objz/rmcl +``` + ### Cargo [![crates.io](https://img.shields.io/crates/v/rmcl?style=for-the-badge&logo=rust)](https://crates.io/crates/rmcl) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f6166f0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1781359544, + "narHash": "sha256-iUuzKQcyXvopYDDzFpMK5eQKP3WIJExYny2kJtbgUcE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9f11f828c213641c2369a9f1fa31fe31557e3156", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..216dc66 --- /dev/null +++ b/flake.nix @@ -0,0 +1,238 @@ +{ + description = "rmcl: A fully featured Minecraft TUI launcher"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = "rmcl"; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; + src = pkgs.lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; + nativeBuildInputs = [pkgs.jdk]; + + meta = with pkgs.lib; { + description = "A fully featured Minecraft TUI launcher"; + homepage = "https://github.com/objz/rmcl"; + license = licenses.gpl3Only; + mainProgram = "rmcl"; + }; + }; + }) + // { + homeManagerModules.default = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.programs.rmcl; + tomlFormat = pkgs.formats.toml {}; + filterNulls = filterAttrs (_: v: v != null); + nullStr = types.nullOr types.str; + nullUint = types.nullOr types.ints.unsigned; + pathsCfg = { + instances_dir = cfg.instancesDir; + meta_dir = cfg.metaDir; + java_path = cfg.javaPath; + }; + defaultsCfg = { + memory_min = cfg.memoryMin; + memory_max = cfg.memoryMax; + }; + uiCfg = { + error_auto_dismiss_ms = cfg.errorAutoDismissMs; + error_slide_start_ms = cfg.errorSlideStartMs; + error_fly_out_ms = cfg.errorFlyOutMs; + max_error_events = cfg.maxErrorEvents; + }; + in { + options.programs.rmcl = { + enable = mkEnableOption "rmcl: A fully featured Minecraft TUI launcher"; + + package = mkOption { + type = types.package; + default = self.packages.${pkgs.stdenv.hostPlatform.system}.default; + defaultText = literalExpression "self.packages.\${pkgs.stdenv.hostPlatform.system}.default"; + description = "The rmcl package to use."; + }; + + # -- config.toml: paths -- + instancesDir = mkOption { + type = nullStr; + default = null; + example = "~/games/minecraft/instances"; + description = '' + Where Minecraft instances are stored. + Default: ~/.local/share/rmcl/instances. + ''; + }; + + metaDir = mkOption { + type = nullStr; + default = null; + example = "~/games/minecraft/meta"; + description = '' + Metadata and cache directory. + Default: ~/.local/share/rmcl/meta. + ''; + }; + + javaPath = mkOption { + type = nullStr; + default = null; + example = "${pkgs.jdk}/bin/java"; + description = '' + Path to Java executable for launching Minecraft. + Default: falls back to JAVA_HOME. + ''; + }; + + # -- config.toml: defaults -- + memoryMin = mkOption { + type = nullStr; + default = null; + example = "512M"; + description = '' + Minimum Java heap size (Xms) for Minecraft instances. + Default: "512M". + ''; + }; + + memoryMax = mkOption { + type = nullStr; + default = null; + example = "4G"; + description = '' + Maximum Java heap size (Xmx) for Minecraft instances. + Default: "2G". + ''; + }; + + # -- config.toml: ui -- + errorAutoDismissMs = mkOption { + type = nullUint; + default = null; + example = 5000; + description = '' + How long (ms) an error toast stays visible before auto-dismissing. + Default: 5000. + ''; + }; + + errorSlideStartMs = mkOption { + type = nullUint; + default = null; + example = 3500; + description = '' + When (ms) the error toast begins sliding off screen. + Default: 3500. + ''; + }; + + errorFlyOutMs = mkOption { + type = nullUint; + default = null; + example = 300; + description = '' + Duration (ms) of the error toast fly-out animation. + Default: 300. + ''; + }; + + maxErrorEvents = mkOption { + type = nullUint; + default = null; + example = 50; + description = '' + Maximum number of error events retained in the log buffer. + Default: 50. + ''; + }; + + # -- theme.toml -- + theme = mkOption { + type = types.str; + default = "catppuccin"; + example = "dracula"; + description = '' + Base theme name (one of: catppuccin, dracula, nord, gruvbox, + one-dark, solarized, tailwind, tokyo-night, rose-pine, terminal) + or an absolute path to a custom theme file. + ''; + }; + + borderStyle = mkOption { + type = types.enum ["rounded" "plain" "double" "thick"]; + default = "rounded"; + description = "Widget border style."; + }; + + customTheme = mkOption { + type = types.attrs; + default = {}; + example = literalExpression '' + { + accent = "Red"; + text = "White"; + surface = { Rgb = [36 36 36]; }; + background = { Rgb = [30 30 30]; }; + } + ''; + description = '' + Color overrides applied on top of the base theme. + Each key is a color slot (accent, accent_dim, text, text_dim, + text_bright, success, error, warning, info, diff_added, + diff_removed, diff_context, border, surface, background). + Values are either a named color string ("Red", "White", etc.) + or an RGB inline table ({ Rgb = [R G B]; }). + ''; + }; + + # -- extra config.toml fields -- + extraConfig = mkOption { + type = tomlFormat.type; + default = {}; + example = literalExpression '' + { + general.debug = true; + } + ''; + description = '' + Additional config.toml settings merged into the generated file. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [cfg.package]; + + xdg.configFile."rmcl/config.toml".source = tomlFormat.generate "rmcl-config.toml" (recursiveUpdate { + paths = filterNulls pathsCfg; + defaults = filterNulls defaultsCfg; + ui = filterNulls uiCfg; + } cfg.extraConfig); + + xdg.configFile."rmcl/theme.toml".source = tomlFormat.generate "rmcl-theme.toml" ({ + inherit (cfg) theme; + border_style = cfg.borderStyle; + } + // optionalAttrs (cfg.customTheme != {}) { + custom = cfg.customTheme; + }); + }; + }; + }; +} From 68bbf6fc1c49bdb738fa17775b87fd182911a08d Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 28 Sep 2026 21:56:08 -0400 Subject: [PATCH 2/7] chore(nix): scope v1 to the package output the home manager module is preserved on the feat/nix-home-manager branch and will land as a follow-up so the build and install path can merge on its own. --- flake.nix | 208 +----------------------------------------------------- 1 file changed, 1 insertion(+), 207 deletions(-) diff --git a/flake.nix b/flake.nix index 216dc66..962dc3c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,6 @@ }; outputs = { - self, nixpkgs, flake-utils, ... @@ -29,210 +28,5 @@ mainProgram = "rmcl"; }; }; - }) - // { - homeManagerModules.default = { - config, - lib, - pkgs, - ... - }: - with lib; let - cfg = config.programs.rmcl; - tomlFormat = pkgs.formats.toml {}; - filterNulls = filterAttrs (_: v: v != null); - nullStr = types.nullOr types.str; - nullUint = types.nullOr types.ints.unsigned; - pathsCfg = { - instances_dir = cfg.instancesDir; - meta_dir = cfg.metaDir; - java_path = cfg.javaPath; - }; - defaultsCfg = { - memory_min = cfg.memoryMin; - memory_max = cfg.memoryMax; - }; - uiCfg = { - error_auto_dismiss_ms = cfg.errorAutoDismissMs; - error_slide_start_ms = cfg.errorSlideStartMs; - error_fly_out_ms = cfg.errorFlyOutMs; - max_error_events = cfg.maxErrorEvents; - }; - in { - options.programs.rmcl = { - enable = mkEnableOption "rmcl: A fully featured Minecraft TUI launcher"; - - package = mkOption { - type = types.package; - default = self.packages.${pkgs.stdenv.hostPlatform.system}.default; - defaultText = literalExpression "self.packages.\${pkgs.stdenv.hostPlatform.system}.default"; - description = "The rmcl package to use."; - }; - - # -- config.toml: paths -- - instancesDir = mkOption { - type = nullStr; - default = null; - example = "~/games/minecraft/instances"; - description = '' - Where Minecraft instances are stored. - Default: ~/.local/share/rmcl/instances. - ''; - }; - - metaDir = mkOption { - type = nullStr; - default = null; - example = "~/games/minecraft/meta"; - description = '' - Metadata and cache directory. - Default: ~/.local/share/rmcl/meta. - ''; - }; - - javaPath = mkOption { - type = nullStr; - default = null; - example = "${pkgs.jdk}/bin/java"; - description = '' - Path to Java executable for launching Minecraft. - Default: falls back to JAVA_HOME. - ''; - }; - - # -- config.toml: defaults -- - memoryMin = mkOption { - type = nullStr; - default = null; - example = "512M"; - description = '' - Minimum Java heap size (Xms) for Minecraft instances. - Default: "512M". - ''; - }; - - memoryMax = mkOption { - type = nullStr; - default = null; - example = "4G"; - description = '' - Maximum Java heap size (Xmx) for Minecraft instances. - Default: "2G". - ''; - }; - - # -- config.toml: ui -- - errorAutoDismissMs = mkOption { - type = nullUint; - default = null; - example = 5000; - description = '' - How long (ms) an error toast stays visible before auto-dismissing. - Default: 5000. - ''; - }; - - errorSlideStartMs = mkOption { - type = nullUint; - default = null; - example = 3500; - description = '' - When (ms) the error toast begins sliding off screen. - Default: 3500. - ''; - }; - - errorFlyOutMs = mkOption { - type = nullUint; - default = null; - example = 300; - description = '' - Duration (ms) of the error toast fly-out animation. - Default: 300. - ''; - }; - - maxErrorEvents = mkOption { - type = nullUint; - default = null; - example = 50; - description = '' - Maximum number of error events retained in the log buffer. - Default: 50. - ''; - }; - - # -- theme.toml -- - theme = mkOption { - type = types.str; - default = "catppuccin"; - example = "dracula"; - description = '' - Base theme name (one of: catppuccin, dracula, nord, gruvbox, - one-dark, solarized, tailwind, tokyo-night, rose-pine, terminal) - or an absolute path to a custom theme file. - ''; - }; - - borderStyle = mkOption { - type = types.enum ["rounded" "plain" "double" "thick"]; - default = "rounded"; - description = "Widget border style."; - }; - - customTheme = mkOption { - type = types.attrs; - default = {}; - example = literalExpression '' - { - accent = "Red"; - text = "White"; - surface = { Rgb = [36 36 36]; }; - background = { Rgb = [30 30 30]; }; - } - ''; - description = '' - Color overrides applied on top of the base theme. - Each key is a color slot (accent, accent_dim, text, text_dim, - text_bright, success, error, warning, info, diff_added, - diff_removed, diff_context, border, surface, background). - Values are either a named color string ("Red", "White", etc.) - or an RGB inline table ({ Rgb = [R G B]; }). - ''; - }; - - # -- extra config.toml fields -- - extraConfig = mkOption { - type = tomlFormat.type; - default = {}; - example = literalExpression '' - { - general.debug = true; - } - ''; - description = '' - Additional config.toml settings merged into the generated file. - ''; - }; - }; - - config = mkIf cfg.enable { - home.packages = [cfg.package]; - - xdg.configFile."rmcl/config.toml".source = tomlFormat.generate "rmcl-config.toml" (recursiveUpdate { - paths = filterNulls pathsCfg; - defaults = filterNulls defaultsCfg; - ui = filterNulls uiCfg; - } cfg.extraConfig); - - xdg.configFile."rmcl/theme.toml".source = tomlFormat.generate "rmcl-theme.toml" ({ - inherit (cfg) theme; - border_style = cfg.borderStyle; - } - // optionalAttrs (cfg.customTheme != {}) { - custom = cfg.customTheme; - }); - }; - }; - }; + }); } From 9d76f852aa9e4a74b1cb616cbdffb5c0196c8688 Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 28 Sep 2026 22:28:53 -0400 Subject: [PATCH 3/7] fix(nix): link against libxcb display-info pulls in the xcb crate, which emits -lxcb; without libxcb in buildInputs the final binary fails to link. --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 962dc3c..a65b8fd 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,7 @@ src = pkgs.lib.cleanSource ./.; cargoLock.lockFile = ./Cargo.lock; nativeBuildInputs = [pkgs.jdk]; + buildInputs = [pkgs.libxcb]; meta = with pkgs.lib; { description = "A fully featured Minecraft TUI launcher"; From 6167cc8f2a769f2a2dd61937ad977bfd8bdd9574 Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 28 Sep 2026 22:28:53 -0400 Subject: [PATCH 4/7] chore(nix): refresh flake.lock nixpkgs-unstable from 2026-06-13 to 2026-09-28 so the package builds with the current toolchain. --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index f6166f0..8ce208f 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1781359544, - "narHash": "sha256-iUuzKQcyXvopYDDzFpMK5eQKP3WIJExYny2kJtbgUcE=", + "lastModified": 1790570722, + "narHash": "sha256-Avcz96Q+8OkfUIUXipBBVsQn19L622BtKP7mk6M+uls=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9f11f828c213641c2369a9f1fa31fe31557e3156", + "rev": "419fe0f449b3fbe3bdd53d9840288db4509ec32e", "type": "github" }, "original": { From 3525c7b69c8236a7c33ae29a3671518c5f7a9a6f Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 28 Sep 2026 23:57:52 -0400 Subject: [PATCH 5/7] fix(nix): expose x11 libs to the launched game minecraft's bundled lwjgl natives dlopen the host's x11 stack, which isn't on the default loader path on nixos. wrap rmcl with an LD_LIBRARY_PATH so the java process it spawns can load them. --- flake.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a65b8fd..553f217 100644 --- a/flake.nix +++ b/flake.nix @@ -13,15 +13,29 @@ }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + # minecraft's bundled lwjgl natives dlopen the host's x11 stack, which + # isn't on the default loader path on nixos. java is spawned as a child + # of rmcl, so a wrapper LD_LIBRARY_PATH propagates all the way down. + runtimeLibs = pkgs.lib.makeLibraryPath (with pkgs; [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + ]); in { packages.default = pkgs.rustPlatform.buildRustPackage { pname = "rmcl"; version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; src = pkgs.lib.cleanSource ./.; cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [pkgs.jdk]; + nativeBuildInputs = [pkgs.jdk pkgs.makeWrapper]; buildInputs = [pkgs.libxcb]; + postFixup = '' + wrapProgram $out/bin/rmcl --prefix LD_LIBRARY_PATH : ${runtimeLibs} + ''; + meta = with pkgs.lib; { description = "A fully featured Minecraft TUI launcher"; homepage = "https://github.com/objz/rmcl"; From 04c92f17bfc677c7cb5832ae2280d1f9b2b83b92 Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Tue, 29 Sep 2026 12:08:53 -0400 Subject: [PATCH 6/7] feat(nix): curseforge key env support gave flake support for adding own CURSEFORGE_API_KEY at build time; updated README.md with new details --- README.md | 15 +++++++++++++++ flake.nix | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 477d4ab..fa36939 100644 --- a/README.md +++ b/README.md @@ -98,11 +98,26 @@ paru -S rmcl-git ### Nix +[![Nix](https://img.shields.io/badge/nix-5277C4?style=for-the-badge&logo=nixos)](https://github.com/objz/rmcl) + ```sh nix run github:objz/rmcl nix profile install github:objz/rmcl ``` +the flake builds rmcl from source. as with other source builds, CurseForge +support is only enabled when `CURSEFORGE_API_KEY` is provided at build time: + +```sh +CURSEFORGE_API_KEY=your-key nix build --impure .# +``` + +without a key, Modrinth works and CurseForge is disabled. prebuilt release +binaries ship with the key baked in. + +Minecraft 1.12 and older currently fail to launch because rmcl doesn't pass +`-Djava.library.path` for legacy version profiles. + ### Cargo [![crates.io](https://img.shields.io/crates/v/rmcl?style=for-the-badge&logo=rust)](https://crates.io/crates/rmcl) diff --git a/flake.nix b/flake.nix index 553f217..1f8de68 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,9 @@ }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + # release binaries have the curseforge key compiled in; source builds + # don't, so forward the caller's key when building impurely. + curseforgeApiKey = builtins.getEnv "CURSEFORGE_API_KEY"; # minecraft's bundled lwjgl natives dlopen the host's x11 stack, which # isn't on the default loader path on nixos. java is spawned as a child # of rmcl, so a wrapper LD_LIBRARY_PATH propagates all the way down. @@ -32,6 +35,10 @@ nativeBuildInputs = [pkgs.jdk pkgs.makeWrapper]; buildInputs = [pkgs.libxcb]; + env = pkgs.lib.optionalAttrs (curseforgeApiKey != "") { + CURSEFORGE_API_KEY = curseforgeApiKey; + }; + postFixup = '' wrapProgram $out/bin/rmcl --prefix LD_LIBRARY_PATH : ${runtimeLibs} ''; From 913d2c925482e4575dd8d0c65dad3c04200d5a0d Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 5 Oct 2026 12:36:38 -0400 Subject: [PATCH 7/7] chore: removed CurseForge note in README.md --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fa36939..88bbb8d 100644 --- a/README.md +++ b/README.md @@ -105,16 +105,13 @@ nix run github:objz/rmcl nix profile install github:objz/rmcl ``` -the flake builds rmcl from source. as with other source builds, CurseForge -support is only enabled when `CURSEFORGE_API_KEY` is provided at build time: +the flake builds rmcl from source. To use your own key instead, override it +at build time: ```sh CURSEFORGE_API_KEY=your-key nix build --impure .# ``` -without a key, Modrinth works and CurseForge is disabled. prebuilt release -binaries ship with the key baked in. - Minecraft 1.12 and older currently fail to launch because rmcl doesn't pass `-Djava.library.path` for legacy version profiles.