rimstack: init at 1.1.0 (#581142)

This commit is contained in:
Keenan Weaver
2026-11-12 17:16:46 +00:00
committed by GitHub
4 changed files with 246 additions and 0 deletions

View File

@@ -20993,6 +20993,13 @@
matrix = "@neobrain:matrix.org";
name = "Tony Wasserka";
};
neolouker = {
email = "neolouker@gmail.com";
github = "neolouker";
githubId = 36087559;
matrix = "@neolouker:matrix.org";
name = "Neolouker";
};
neonvoid = {
email = "me@neonvoid.dev";
github = "neonvoidx";

View File

@@ -0,0 +1,50 @@
diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs
--- a/crates/app/src/main.rs
+++ b/crates/app/src/main.rs
@@ -29,35 +29,3 @@
-/// Written where the desktop looks for them.
-#[cfg(target_os = "linux")]
-fn put_among_applications() {
- let home = std::env::var_os("XDG_DATA_HOME")
- .map(std::path::PathBuf::from)
- .or_else(|| Some(std::path::PathBuf::from(std::env::var_os("HOME")?).join(".local/share")));
- let (Some(home), Ok(exe)) = (home, std::env::current_exe()) else {
- return;
- };
- let Some(exe) =
- rimstack_core::kept::desktop::program_to_list(&exe, |name| std::env::var_os(name))
- else {
- return;
- };
- let entry = include_str!("../assets/rimstack.desktop");
- let icon = include_bytes!("../assets/rimstack.svg");
- match rimstack_core::kept::desktop::install(&home, &exe, entry, icon) {
- // KDE reads icons again on this signal; a running desktop holds them otherwise.
- Ok(true) => {
- let told = std::process::Command::new("dbus-send")
- .args(["--session", "--type=signal", "/KIconLoader"])
- .args(["org.kde.KIconLoader.iconChanged", "int32:0"])
- .status();
- if let Err(problem) = told {
- rimstack_core::problem!("icons changed, desktop not told: {problem}");
- }
- }
- Ok(false) => {}
- Err(problem) => rimstack_core::problem!("desktop entry: {problem}"),
- }
-}
-
/// `rimstack --steamworks=subscribe:1,2`; exits 0 when Steam took the requests.
fn steamworks(app: &App, request: &str) -> std::process::ExitCode {
use rimstack_core::base::error::Error;
@@ -123,10 +91,6 @@ fn main() -> std::process::ExitCode {
early.library();
});
}
- #[cfg(target_os = "linux")]
- if !std::env::args().any(|a| a.starts_with("--shot") || a.starts_with("--check")) {
- put_among_applications();
- }
let mut qt = QGuiApplication::new();
hub::use_window_icon();
let font = app.settings().get("font").map(String::from);

View File

@@ -0,0 +1,129 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
coreutils,
git,
gnutar,
gzip,
nix-update-script,
pkg-config,
qt6,
steam-run-free,
}:
let
qtBuildEnv = qt6.env "qt6-rimstack" [ qt6.qtdeclarative ];
# Tests copy sleep to RimWorld. The multicall binary relies on argv[0],
# so use a standalone executable.
testCoreutils = coreutils.override { singleBinary = false; };
externalRunner = steam-run-free.override { privateTmp = false; };
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "rimstack";
version = "1.1.0";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "TheForgotten69";
repo = "RimStack";
tag = "v${finalAttrs.version}";
hash = "sha256-VWPZxpJLocKm43gcIN0dNGIMS2tBFYETKa1+9+ubbvE=";
};
cargoHash = "sha256-BedPTyvZXEr+9DGoiuIErEsBSjw4Vc5Vsqpq3t9StDQ=";
patches = [
./disable-desktop-install.patch
./steam-run.patch
];
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace \
crates/app/src/workspace/load_order/tests.rs \
crates/core/src/sources/maintenance.rs \
--replace-fail '"/bin/sleep"' '"${lib.getExe' testCoreutils "sleep"}"'
'';
nativeBuildInputs = [
pkg-config
qt6.wrapQtAppsHook
];
buildInputs = [
qt6.qtbase
qt6.qtdeclarative
qt6.qtsvg
]
++ lib.optionals stdenv.hostPlatform.isLinux [ qt6.qtwayland ];
nativeCheckInputs = [ git ];
checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
# This test compares path spelling on a case-insensitive filesystem.
"--skip=rimworld::about::tests::about_is_located_whatever_its_case"
# These tests use Linux installation paths with the host's OS detection.
"--skip=rimworld::paths::tests::game_in_a_second_library_is_found_and_symlinked_roots_count_once"
"--skip=rimworld::paths::tests::library_listing_the_app_beats_a_stale_copy"
"--skip=rimworld::paths::tests::native_install_is_found"
"--skip=rimworld::paths::tests::proton_settings_are_found"
"--skip=rimworld::paths::tests::steam_s_list_of_libraries_is_read_from_either_place_it_keeps_it"
# SteamCMD is disabled upstream on macOS.
"--skip=sources::redownload::tests::a_download_is_taken_from_this_run_s_own_folder_when_steamcmd_says_it_succeeded"
"--skip=sources::redownload::tests::an_earlier_download_left_in_the_scratch_is_not_taken_for_a_failed_one"
"--skip=sources::redownload::tests::one_run_tells_each_item_s_own_outcome"
"--skip=sources::redownload::tests::only_a_number_is_asked_of_steamcmd"
"--skip=sources::redownload::tests::steamcmd_is_run_with_a_home_of_its_own_never_the_user_s"
];
# CXX-Qt needs a shared Qt prefix. Use qmake from qtBuildEnv.
# Set QMAKE here because the Qt setup hook overwrites it.
preConfigure = ''
export QMAKE=${qtBuildEnv}/bin/qmake
'';
env = {
QT_QPA_PLATFORM = "offscreen";
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_CFLAGS_COMPILE = "-F${qtBuildEnv}/lib";
};
postInstall = ''
install -Dm644 crates/app/assets/rimstack.desktop $out/share/applications/rimstack.desktop
install -Dm644 crates/app/assets/rimstack.svg $out/share/icons/hicolor/scalable/apps/rimstack.svg
'';
qtWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [
git
gnutar
gzip
])
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"--set"
"RIMSTACK_LAUNCHER"
(lib.getExe externalRunner)
];
passthru.updateScript = nix-update-script { };
meta = {
description = "Fast mod manager for RimWorld";
homepage = "https://github.com/TheForgotten69/RimStack";
changelog = "https://github.com/TheForgotten69/RimStack/releases/tag/v${finalAttrs.version}";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [
neolouker
adda
];
mainProgram = "rimstack";
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
};
})

View File

@@ -0,0 +1,60 @@
Run SteamCMD and RimWorld in steam-run's FHS environment.
Include SteamCMD's stderr in download errors.
diff --git a/crates/core/src/base/program.rs b/crates/core/src/base/program.rs
--- a/crates/core/src/base/program.rs
+++ b/crates/core/src/base/program.rs
@@ -20,2 +20,13 @@
command
+}
+
+/// Prefix the command with RIMSTACK_LAUNCHER if set.
+pub fn command_with_launcher(program: impl AsRef<OsStr>) -> Command {
+ if let Some(launcher) = std::env::var_os("RIMSTACK_LAUNCHER") {
+ let mut command = command(launcher);
+ command.arg(program);
+ command
+ } else {
+ command(program)
+ }
}
diff --git a/crates/core/src/sources/maintenance.rs b/crates/core/src/sources/maintenance.rs
--- a/crates/core/src/sources/maintenance.rs
+++ b/crates/core/src/sources/maintenance.rs
@@ -184,7 +184,7 @@
pub fn start_game(game_dir: &Path, arguments: &str) -> Result<()> {
let program = game_program(game_dir)
.ok_or_else(|| Error::program(said!("the game's program was not found in its folder")))?;
- std::process::Command::new(&program)
+ crate::base::program::command_with_launcher(&program)
.args(self::arguments(arguments))
.current_dir(game_dir)
.spawn()
diff --git a/crates/core/src/sources/redownload.rs b/crates/core/src/sources/redownload.rs
--- a/crates/core/src/sources/redownload.rs
+++ b/crates/core/src/sources/redownload.rs
@@ -221,7 +221,7 @@
// A home of its own: with the user's, SteamCMD writes over Steam's list of library folders.
let home = scratch.join("home");
let _ = std::fs::create_dir_all(&home);
- let mut command = crate::base::program::command(steamcmd);
+ let mut command = crate::base::program::command_with_launcher(steamcmd);
command
.env("HOME", &home)
.env_remove("XDG_DATA_HOME")
@@ -233,7 +233,14 @@
command.args(["+workshop_download_item", GAME, id, "validate"]);
}
let ran = crate::base::program::run(command.arg("+quit"), crate::base::program::DOWNLOAD)
- .map(|out| plain(&out.stdout))
+ .map(|output| {
+ let mut text = plain(&output.stdout);
+ if !output.stderr.is_empty() {
+ text.push('\n');
+ text.push_str(&plain(&output.stderr));
+ }
+ text
+ })
.map_err(|e| Error::program(said!("SteamCMD could not be run: {}", e)));
let content = attempt.join("steamapps/workshop/content").join(GAME);
// SteamCMD exits with 0 when an item fails, and may run messages together on one line: