{ description = "ColdIron - Learning Rust and Iced"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = inputs @ {self, ...}: let supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems ( system: f { pkgs = import inputs.nixpkgs { inherit system; overlays = [ inputs.self.overlays.default ]; }; } ); in { overlays.default = _final: prev: { rustToolchain = with inputs.fenix.packages.${prev.stdenv.hostPlatform.system}; combine ( with stable; [ clippy rustc cargo rustfmt rust-src ] ); coldiron = prev.callPackage ./package.nix {}; }; packages = forEachSupportedSystem ( {pkgs}: { default = pkgs.callPackage ./package.nix {}; coldiron = pkgs.callPackage ./package.nix {}; } ); apps = forEachSupportedSystem ( {pkgs}: { default = { type = "app"; program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.default; }; coldiron = { type = "app"; program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.coldiron; }; } ); devShells = forEachSupportedSystem ( {pkgs}: let runtimeLibs = with pkgs; [ wayland libxkbcommon libGL vulkan-loader libx11 libxcursor libxrandr libxi ]; in { default = pkgs.mkShell { packages = with pkgs; [ rustToolchain git gnumake alejandra statix deadnix flatpak flatpak-builder openssl pkg-config cargo-deny cargo-edit cargo-watch rust-analyzer pre-commit ] ++ runtimeLibs; env = { # Required by rust-analyzer RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs; }; shellHook = '' export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath runtimeLibs}:$LD_LIBRARY_PATH" # Initialize git repository if not already present if [ ! -d .git ]; then git init echo "✓ Initialized git repository" fi # Ensure user's Cargo-installed binaries are available export PATH="$HOME/.cargo/bin:$PATH" echo "[ColdIron] Welcome to the ColdIron development shell!" echo "Commands: 'cargo run' to start GUI, 'cargo test' to run tests, 'make flatpak-build' for Flatpak." ''; }; } ); }; }