more nix dev

This commit is contained in:
MeexReay 2025-04-13 23:49:00 +03:00
parent 58213cf8c9
commit e504123cef
2 changed files with 37 additions and 12 deletions

View File

@ -27,7 +27,30 @@ better RAC client
go to [releases](https://github.com/MeexReay/bRAC/releases/latest) and download file you need. its simple. go to [releases](https://github.com/MeexReay/bRAC/releases/latest) and download file you need. its simple.
### from flake ### build from source
1. Make sure [Rust](https://www.rust-lang.org/tools/install) is installed
2. Clone repository
```bash
git clone https://github.com/MeexReay/bRAC.git
cd bRAC
```
3. Build or run with Cargo
```bash
cargo build --release # build release (target/release/bRAC)
cargo run --release # run (builds and runs bRAC itself)
```
Minimal version:
```bash
cargo build --release --no-default-features
cargo run --release --no-default-features
```
### nix package
If you have Nix package manager installed, you can use: If you have Nix package manager installed, you can use:
@ -36,15 +59,11 @@ nix build github:MeexReay/bRAC # build binary (result/bin/bRAC)
nix run github:MeexReay/bRAC # run (builds and runs bRAC) nix run github:MeexReay/bRAC # run (builds and runs bRAC)
``` ```
### build from source Minimal version:
(you have to install [rust](https://www.rust-lang.org/tools/install) at first)
```bash ```bash
git clone https://github.com/MeexReay/bRAC.git nix build .#bRAC-minimal
cd bRAC nix run .#bRAC-minimal
cargo build --release # build release (target/release/bRAC)
cargo run --release # run (builds and runs bRAC itself)
``` ```
## default config ## default config

View File

@ -19,17 +19,23 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
msrv = cargoToml.package.rust-version; msrv = cargoToml.package.rust-version;
rustPackage = features: rustPackage = { version, features }:
(pkgs.makeRustPlatform { (pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal; cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal; rustc = pkgs.rust-bin.stable.latest.minimal;
}).buildRustPackage { }).buildRustPackage {
inherit (cargoToml.package) name version; inherit (cargoToml.package) name;
src = ./.; src = ./.;
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
version = lib.concatStrings [ cargoToml.package.version version ];
buildFeatures = features; buildFeatures = features;
buildInputs = runtimeDeps; buildInputs = runtimeDeps;
nativeBuildInputs = buildDeps; nativeBuildInputs = buildDeps;
patchPhase = ''
substituteInPlace Cargo.toml --replace \
'version = "${cargoToml.package.version}"' \
'version = "${lib.concatStrings [ cargoToml.package.version version ]}"'
'';
}; };
mkDevShell = rustc: mkDevShell = rustc:
@ -49,8 +55,8 @@
packages.default = self'.packages.bRAC; packages.default = self'.packages.bRAC;
devShells.default = self'.devShells.stable; devShells.default = self'.devShells.stable;
packages.bRAC = (rustPackage "default"); packages.bRAC = (rustPackage { version = ""; features = "default"; });
packages.bRAC-minimal = (rustPackage ""); packages.bRAC-minimal = (rustPackage { version = "-minimal"; features = ""; });
devShells.nightly = (mkDevShell (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))); devShells.nightly = (mkDevShell (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)));
devShells.stable = (mkDevShell pkgs.rust-bin.stable.latest.default); devShells.stable = (mkDevShell pkgs.rust-bin.stable.latest.default);