Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add lldb #20

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Tauri Development Debug",
"cargo": {
"args": [
"build",
"--manifest-path=./src-tauri/Cargo.toml",
"--no-default-features"
]
},
// task for the `beforeDevCommand` if used, must be configured in `.vscode/tasks.json`
"preLaunchTask": "ui:dev"
},
{
"type": "lldb",
"request": "launch",
"name": "Tauri Production Debug",
"cargo": {
"args": [
"build",
"--release",
"--manifest-path=./src-tauri/Cargo.toml"
]
},
// task for the `beforeBuildCommand` if used, must be configured in `.vscode/tasks.json`
"preLaunchTask": "ui:build"
}
]
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "ui:dev",
"type": "shell",
// `dev` keeps running in the background
// ideally you should also configure a `problemMatcher`
// see https://code.visualstudio.com/docs/editor/tasks#_can-a-background-task-be-used-as-a-prelaunchtask-in-launchjson
"isBackground": true,
// change this to your `beforeDevCommand`:
"command": "pnpm",
"args": [
"dev"
]
},
{
"label": "ui:build",
"type": "shell",
// change this to your `beforeBuildCommand`:
"command": "pnpm",
"args": [
"build"
]
}
]
}
43 changes: 4 additions & 39 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
cargo-tauri
nodejs_20
pnpm
] ++ lib.optionals stdenv.isLinux [ pkg-config glib gtk3 webkitgtk libsoup ]
] ++ lib.optional (pkgs ? lldb) lldb
++ lib.optionals stdenv.isLinux [ pkg-config glib gtk3 webkitgtk libsoup ]
++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.WebKit ];
checks = import ./nix/checks/check-dev-env.nix { inherit pkgs buildInputs; };
in
{
devShells.default = pkgs.mkShell {
Expand All @@ -38,44 +40,7 @@
export PATH=${pkgs.lib.makeBinPath buildInputs}:$PATH
'';
};
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)
[[ $cargo_tauri_version == tauri-cli* && $cargo_tauri_version == *2.0.0* ]] || { echo "Incorrect Tauri CLI version: $cargo_tauri_version"; exit 1; }

# Check Node.js and pnpm
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
'';
checks.default = checks;
formatter = pkgs.nixpkgs-fmt;
}
);
Expand Down
38 changes: 38 additions & 0 deletions nix/checks/check-dev-env.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ pkgs, buildInputs }:

pkgs.runCommand "check-dev-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)
[[ $cargo_tauri_version == tauri-cli* && $cargo_tauri_version == *2.0.0* ]] || { echo "Incorrect Tauri CLI version: $cargo_tauri_version"; exit 1; }
# Check Node.js and pnpm
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; }
# Check LLDB
${pkgs.lib.optionalString (pkgs ? lldb) ''
command -v lldb > /dev/null || { echo "LLDB not found"; exit 1; }
lldb --version | grep -q "lldb version" || { echo "Incorrect LLDB version"; 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
''