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.
### 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:
@ -36,15 +59,11 @@ nix build github:MeexReay/bRAC # build binary (result/bin/bRAC)
nix run github:MeexReay/bRAC # run (builds and runs bRAC)
```
### build from source
(you have to install [rust](https://www.rust-lang.org/tools/install) at first)
Minimal version:
```bash
git clone https://github.com/MeexReay/bRAC.git
cd bRAC
cargo build --release # build release (target/release/bRAC)
cargo run --release # run (builds and runs bRAC itself)
nix build .#bRAC-minimal
nix run .#bRAC-minimal
```
## default config

View File

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