Skip to content

Commit

Permalink
Adding nix flake (#32)
Browse files Browse the repository at this point in the history
chore(nix):
- add flake
- add installation instruction
  • Loading branch information
TornaxO7 authored Jun 12, 2024
1 parent b1fa235 commit 5181674
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 4 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
/examples/target
/examples/pastebin/upload
.idea
/tests/integration/__pycache__
/tests/integration/__pycache__
.direnv/

# output of `nix build`
result
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<details>

```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
];
})
];
};
};
}
```

</details>

---

## Start debugger session
Expand Down
127 changes: 127 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
};
}
33 changes: 33 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -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" ];
};
}
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = ["rust-src", "rust-analyzer"]
6 changes: 3 additions & 3 deletions src/ui/tui/config/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<'de> Deserialize<'de> for WrappedKeyEvent {
}
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
struct Common {
up: Vec<WrappedKeyEvent>,
down: Vec<WrappedKeyEvent>,
Expand All @@ -168,7 +168,7 @@ struct Common {
input_backspace: Vec<WrappedKeyEvent>,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
struct Special {
switch_window_tab: Vec<WrappedKeyEvent>,
expand_left: Vec<WrappedKeyEvent>,
Expand All @@ -184,7 +184,7 @@ struct Special {
step_out: Vec<WrappedKeyEvent>,
}

#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub(super) struct KeyMapConfig {
special: Special,
common: Common,
Expand Down

0 comments on commit 5181674

Please sign in to comment.