From 40f22a612a7351ca4322fc05613fd9346a67b69c Mon Sep 17 00:00:00 2001 From: Gerknis <102861180+Gerknis@users.noreply.github.com> Date: Sun, 18 Oct 2026 17:41:02 +0500 Subject: [PATCH] Fix flake.nix (#526) * Add experimental flake.nix for NixOS/Linux development This adds an experimental flake-based development environment and package entry for ArtCraft Launcher. What this adds: - `flake.nix` at the repository root - Rust toolchain via `rust-overlay` - Required native Linux libraries for the Rust workspace - A dev shell via `nix develop` - A package/app target via `nix run` / `nix build` Why: ArtCraft Launcher is a Rust workspace and currently has no Nix flake support. This makes local development and installation much easier for NixOS/Linux users. Notes: - This is intentionally minimal and experimental. - It targets the development environment and local package use. - Additional refinements may be needed for specific Wayland/X11 setups. * Fix flake metadata to match ArtCraft Launcher and remove GTK dependency * add flake.lock * Update flake.nix: replace deprecated xorg packages with their new names * added runtimeDependencies and fixed nativeBuildInputs: removed ninja and cmake to resolve conflicts with Cargo on app build, added autoPatchelfHook to auto hook runtimeDependencies into the RPATH of bin; added result in .gitignore to prevent build results from project * Add X11 support libraries Added X11 support libraries to the flake configuration. * Nix: build the flake in CI and document nixGL for other distros The new Nix workflow builds the flake and checks that every library winit and wgpu dlopen() at runtime is on the binary's RUNPATH, so a missing runtimeDependencies entry fails CI instead of failing on `nix run`. It only runs when the flake, Cargo manifests or lockfile change. The README gains a short Nix section: the dev shell, `nix run`, and nixGL for non-NixOS distros, where a Nix-built program can't load the host's GPU drivers. Co-Authored-By: Claude Opus 5.5 * Drop the local runtime-libs job; it moves to the shared Nix workflow Per review: the build-and-RUNPATH check belongs in storytold/craft-common-actions (opt-in check-runtime-libs), so .github/workflows/nix.yml goes back to main's shared eval job. --------- Co-authored-by: SaB131X Co-authored-by: skylar taylor-barrick Co-authored-by: Claude Opus 5.5 --- .gitignore | 1 + README.md | 17 +++++++++++++++++ flake.nix | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2fe44401..5699135e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ builds/ /dist /temp /craft-fonts +result diff --git a/README.md b/README.md index 87e9a69f..7f6d707a 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,23 @@ rustup target add wasm32-unknown-unknown cd apps/artcraft-launcher-web && trunk serve ``` +### Nix (experimental) + +`flake.nix` gives a dev shell (`nix develop`, then the cargo commands above) and a package: + +```sh +nix run github:storytold/craft-launcher +``` + +On NixOS this uses the system's graphics drivers. On other distros, a Nix-built program can't load +the host's GPU drivers, so the window may fail to open. Run it through +[nixGL](https://github.com/nix-community/nixGL) instead (NVIDIA needs nixGL's matching NVIDIA +variant), or use the AppImage, `.deb` or `.rpm` release: + +```sh +nix run --impure github:nix-community/nixGL -- nix run github:storytold/craft-launcher +``` + ### Installing your own builds To install and update the Craft apps from checkouts on your machine instead of GitHub, clone them diff --git a/flake.nix b/flake.nix index 92940a06..b50b9c09 100644 --- a/flake.nix +++ b/flake.nix @@ -65,12 +65,24 @@ nativeBuildInputs = with pkgs; [ pkg-config - cmake - ninja libclang + autoPatchelfHook ]; buildInputs = commonDeps; + runtimeDependencies = with pkgs; [ + wayland + libxkbcommon + libGL + vulkan-loader + #X11 support + libx11 + libxcursor + libxrandr + libxi + libxcb + ]; + doCheck = false; };