diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index c392a19..f26ead8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,8 @@ /examples/target /examples/pastebin/upload .idea -/tests/integration/__pycache__ \ No newline at end of file +/tests/integration/__pycache__ +.direnv/ + +# output of `nix build` +result diff --git a/README.md b/README.md index 47ca003..e061440 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,42 @@ cargo install bugstalker --no-default-features pacman -S bugstalker ``` +#### Nix package manager +There's flake which you can use to start using it. Just [enable flakes](https://wiki.nixos.org/wiki/Flakes#Enable_flakes_temporarily) +then you're able to use it with: +``` +nix run github:godzie44/BugStalker +``` + +`bugstalker` also provides a package which you can include to your NixOS config. +For example: + +
+ +```nix +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + bugstalker.url = "github:godzie44/BugStalker"; + }; + + outpus = {nixpkgs, bugstalker, ...}: { + nixosConfigurations.your_hostname = nixpkgs.lib.nixosSystem { + modules = [ + ({...}: { + environment.systemPackages = [ + # assuming your system runs on a x86-64 cpu + bugstalker.packages."x86_64-linux".default + ]; + }) + ]; + }; + }; +} +``` + +
+ --- ## Start debugger session diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4d86785 --- /dev/null +++ b/flake.lock @@ -0,0 +1,127 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1717974879, + "narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1706487304, + "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1718072316, + "narHash": "sha256-p33h73iQ1HkLalCplV5MH0oP3HXRaH3zufnFqb5//ps=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "bedc47af18fc41bb7d2edc2b212d59ca36253f59", + "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..1cc7991 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } + { + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + perSystem = { self', lib, system, pkgs, config, ... }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + + overlays = with inputs; [ + rust-overlay.overlays.default + ]; + }; + + apps.default = { + type = "app"; + program = self'.packages.default; + }; + + packages.default = pkgs.callPackage (import ./nix/package.nix) { }; + + devShells.default = + let + bs = self'.packages.default; + rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + in + pkgs.mkShell { + packages = [ rust-toolchain ] ++ bs.buildInputs ++ bs.nativeBuildInputs; + }; + }; + }; +} diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..85b32bb --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,33 @@ +{ lib +, rustPlatform +, pkg-config +, libunwind +}: +let + cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml); +in +rustPlatform.buildRustPackage { + pname = cargoToml.package.name; + version = cargoToml.package.version; + + src = builtins.path { + path = ../.; + }; + + cargoLock.lockFile = ../Cargo.lock; + + buildInputs = [ libunwind ]; + + nativeBuildInputs = [ pkg-config ]; + + # See https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/by-name/bu/bugstalker/package.nix#L25-L26 + doCheck = false; + + meta = { + description = "Rust debugger for Linux x86-64"; + homepage = "https://github.com/godzie44/BugStalker"; + license = lib.licenses.mit; + mainProgram = "bs"; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..c0c573e --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +components = ["rust-src", "rust-analyzer"] diff --git a/src/ui/tui/config/ser.rs b/src/ui/tui/config/ser.rs index aaaf864..d90c495 100644 --- a/src/ui/tui/config/ser.rs +++ b/src/ui/tui/config/ser.rs @@ -152,7 +152,7 @@ impl<'de> Deserialize<'de> for WrappedKeyEvent { } } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] struct Common { up: Vec, down: Vec, @@ -168,7 +168,7 @@ struct Common { input_backspace: Vec, } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] struct Special { switch_window_tab: Vec, expand_left: Vec, @@ -184,7 +184,7 @@ struct Special { step_out: Vec, } -#[derive(Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub(super) struct KeyMapConfig { special: Special, common: Common,