From 98c31aa066d54f064ba7ac4b1af8dc908fe28489 Mon Sep 17 00:00:00 2001 From: Gerknis <102861180+Gerknis@users.noreply.github.com> Date: Mon, 12 Oct 2026 10:54:03 +0500 Subject: [PATCH] Add experimental flake.nix for NixOS/Linux development (#72) * 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 --- flake.lock | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c013026 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "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": 1791594108, + "narHash": "sha256-XK4KceonkwD8LuMAt/vNrz982mXJM5jeHAxMwsUXXAQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6510408d147d8c5e6d76043e899e9251756f6a75", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1791707771, + "narHash": "sha256-w3m8HtAVCfGTHw+gcCTAy7jFHSdGbokm8NngbeFrkek=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "c1cfa7a2c809d364ac1a7e9b3ec418afa3f19793", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "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..98242cd --- /dev/null +++ b/flake.nix @@ -0,0 +1,82 @@ +{ + description = "Experimental Nix flake for ArtCraft Launcher"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { self, nixpkgs, flake-utils, rust-overlay }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + + rust = pkgs.rust-bin.stable.latest.default.override { + extensions = [ "rustfmt" "clippy" "rust-src" ]; + }; + + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; + + commonDeps = with pkgs; [ + pkg-config + openssl + libxkbcommon + libx11 + libxcursor + libxrandr + libxi + libxcb + libGL + vulkan-loader + mesa + wayland + wayland-protocols + fontconfig + freetype + alsa-lib + zlib + ]; + in + { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + rust + cmake + ninja + libclang + ]; + buildInputs = commonDeps; + + shellHook = '' + export LIBCLANG_PATH="${pkgs.libclang.lib}/lib" + export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH" + ''; + }; + + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = "artcraft-launcher"; + version = version; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = with pkgs; [ + pkg-config + cmake + ninja + libclang + ]; + buildInputs = commonDeps; + + doCheck = false; + }; + + apps.default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/artcraft-launcher"; + }; + }); +}