Skip to content

Commit

Permalink
Merge pull request #19 from 21CSM/15-ide-settings
Browse files Browse the repository at this point in the history
chore: add development tools
  • Loading branch information
21CSM authored Sep 15, 2024
2 parents 2582784 + 4773454 commit d1ea9f8
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 24 deletions.
46 changes: 46 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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
}
41 changes: 27 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
);
}
}
12 changes: 6 additions & 6 deletions nix/overlays/cargo-tauri.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
rustPlatform.buildRustPackage rec {
pname = "tauri";
version = "2.0.0-beta.25";

src = fetchFromGitHub {
owner = "tauri-apps";
repo = "tauri";
Expand All @@ -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";
}
}
10 changes: 6 additions & 4 deletions nix/overlays/default.nix
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit d1ea9f8

Please sign in to comment.