diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..069035c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,46 @@ +{ + "files.watcherExclude": { + "**/.direnv/**": true, + "**/result/**": true, + "**/result-*/**": true, + "**/target/**": true + }, + "editor.formatOnSave": true, + "editor.rulers": [ + 100 + ], + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + // Rust-specific settings + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer", + "editor.formatOnSave": true, + "editor.inlayHints.enabled": "on" + }, + "rust-analyzer.linkedProjects": [ + "./src-tauri/Cargo.toml" + ], + "rust-analyzer.cargo.features": "all", + "rust-analyzer.check.command": "clippy", + "rust-analyzer.inlayHints.chainingHints.enable": true, + "rust-analyzer.inlayHints.typeHints.enable": true, + "rust-analyzer.diagnostics.experimental.enable": true, + "rust-analyzer.rustfmt.extraArgs": [ + "--config", + "max_width=100" + ], + // Nix-specific settings + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "nix.formatterPath": "nixpkgs-fmt", + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide", + "editor.formatOnSave": true + }, + // General settings + "editor.minimap.enabled": false, + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": "active", + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 1000 +} diff --git a/flake.nix b/flake.nix index 3d78dc0..0df6ede 100644 --- a/flake.nix +++ b/flake.nix @@ -14,28 +14,40 @@ overlays = [ fenix.overlays.default (import ./nix/overlays) ]; pkgs = import nixpkgs { inherit system overlays; }; rustToolchain = pkgs.fenix.stable.withComponents [ - "cargo" "rustc" "rust-src" "clippy" "rustfmt" + "cargo" + "rustc" + "rust-src" + "clippy" + "rustfmt" ]; buildInputs = with pkgs; [ - rustToolchain openssl cargo-tauri nodejs_20 pnpm + rustToolchain + rust-analyzer + nixpkgs-fmt + openssl + cargo-tauri + nodejs_20 + pnpm ] ++ lib.optionals stdenv.isLinux [ pkg-config glib gtk3 webkitgtk libsoup ] - ++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.WebKit ]; - in { + ++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.WebKit ]; + in + { devShells.default = pkgs.mkShell { inherit buildInputs; shellHook = '' export PATH=${pkgs.lib.makeBinPath buildInputs}:$PATH ''; }; - checks.default = pkgs.runCommand "check-rust-tauri-env" { - inherit buildInputs; - } '' + checks.default = pkgs.runCommand "check-rust-tauri-env" + { + inherit buildInputs; + } '' export PATH=${pkgs.lib.makeBinPath buildInputs}:$PATH - + # Check Rust toolchain command -v rustc > /dev/null && command -v cargo > /dev/null || { echo "Rust toolchain not found"; exit 1; } rustc --version | grep -q "rustc 1" || { echo "Incorrect Rust version"; exit 1; } - + # Check Tauri CLI command -v cargo-tauri > /dev/null || { echo "Tauri CLI not found"; exit 1; } cargo_tauri_version=$(cargo-tauri --version) @@ -45,25 +57,26 @@ command -v node > /dev/null || { echo "Node.js not found"; exit 1; } command -v pnpm > /dev/null || { echo "pnpm not found"; exit 1; } node --version | grep -q "v20" || { echo "Node.js version should be 20.x"; exit 1; } - + # Check OpenSSL command -v openssl > /dev/null || { echo "OpenSSL not found"; exit 1; } - + ${pkgs.lib.optionalString pkgs.stdenv.isLinux '' # Linux-specific checks pkg-config --exists gtk+-3.0 || { echo "GTK3 not found"; exit 1; } pkg-config --exists webkit2gtk-4.0 || { echo "WebKitGTK not found"; exit 1; } pkg-config --exists libsoup-2.4 || { echo "libsoup not found"; exit 1; } ''} - + ${pkgs.lib.optionalString pkgs.stdenv.isDarwin '' # macOS-specific checks [ -d /System/Library/Frameworks/WebKit.framework ] || { echo "WebKit framework not found"; exit 1; } ''} - + echo "All checks passed" touch $out ''; + formatter = pkgs.nixpkgs-fmt; } ); -} \ No newline at end of file +} diff --git a/nix/overlays/cargo-tauri.nix b/nix/overlays/cargo-tauri.nix index d9f9aca..b78adaa 100644 --- a/nix/overlays/cargo-tauri.nix +++ b/nix/overlays/cargo-tauri.nix @@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec { pname = "tauri"; version = "2.0.0-beta.25"; - + src = fetchFromGitHub { owner = "tauri-apps"; repo = "tauri"; @@ -31,10 +31,10 @@ rustPlatform.buildRustPackage rec { buildInputs = [ openssl ] ++ lib.optionals stdenv.isLinux [ glibc libsoup cairo gtk3 webkitgtk ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ - CoreServices - Security - SystemConfiguration - ]); + CoreServices + Security + SystemConfiguration + ]); meta.mainProgram = "cargo-tauri"; -} \ No newline at end of file +} diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 7344705..9cb39db 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -1,5 +1,7 @@ -final: prev: let - cargo-tauri = prev.callPackage ./cargo-tauri.nix {}; -in { +final: prev: +let + cargo-tauri = prev.callPackage ./cargo-tauri.nix { }; +in +{ inherit cargo-tauri; -} \ No newline at end of file +}