mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 10:30:14 +01:00
bundle rust toolchain for RustRover
This commit is contained in:
parent
73f3255741
commit
d208e7ea9d
39
flake.nix
39
flake.nix
|
@ -3,14 +3,11 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
naersk = {
|
naersk = {
|
||||||
url = "github:nix-community/naersk";
|
url = "github:nix-community/naersk";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
nix-filter = {
|
|
||||||
url = "github:numtide/nix-filter";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
@ -29,15 +26,26 @@
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
];
|
];
|
||||||
forAllSystems = lib.genAttrs supported-systems;
|
forAllSystems = lib.genAttrs supported-systems;
|
||||||
|
make-rust-toolchain-core =
|
||||||
|
pkgs:
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "rust-toolchain-core";
|
||||||
|
paths = with pkgs; [
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
rustPlatform.rustcSrc
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages = forAllSystems (
|
packages = forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
|
rust-toolchain-core = make-rust-toolchain-core pkgs;
|
||||||
naersk' = pkgs.callPackage naersk {
|
naersk' = pkgs.callPackage naersk {
|
||||||
cargo = pkgs.cargo;
|
cargo = rust-toolchain-core;
|
||||||
rustc = pkgs.rustc;
|
rustc = rust-toolchain-core;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
@ -98,18 +106,21 @@
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
|
rust-toolchain = pkgs.symlinkJoin {
|
||||||
|
name = "rust-toolchain";
|
||||||
|
paths = with pkgs; [
|
||||||
|
(make-rust-toolchain-core pkgs)
|
||||||
|
rustfmt
|
||||||
|
clippy
|
||||||
|
cargo-expand
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell rec {
|
default = pkgs.mkShell rec {
|
||||||
inputsFrom = [ self.packages.${system}.default ];
|
inputsFrom = [ self.packages.${system}.default ];
|
||||||
packages = with pkgs; [
|
packages = [ rust-toolchain ];
|
||||||
rustfmt
|
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (builtins.concatMap (d: d.buildInputs) inputsFrom)}";
|
||||||
cargo-expand
|
|
||||||
clippy
|
|
||||||
];
|
|
||||||
# LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (
|
|
||||||
# builtins.concatMap (d: d.runtimeDependencies) inputsFrom
|
|
||||||
# )}";
|
|
||||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,10 +106,7 @@ pub(crate) fn execute_command(
|
||||||
|
|
||||||
fn check_bitmap_valid(offset: u16, payload_len: usize) -> bool {
|
fn check_bitmap_valid(offset: u16, payload_len: usize) -> bool {
|
||||||
if offset as usize + payload_len > PIXEL_COUNT {
|
if offset as usize + payload_len > PIXEL_COUNT {
|
||||||
error!(
|
error!("bitmap with offset {offset} is too big ({payload_len} bytes)");
|
||||||
"bitmap with offset {offset} is too big ({} bytes)",
|
|
||||||
payload_len
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,8 +124,7 @@ fn print_cp437_data(
|
||||||
for char_x in 0usize..grid.width() {
|
for char_x in 0usize..grid.width() {
|
||||||
let char_code = grid.get(char_x, char_y);
|
let char_code = grid.get(char_x, char_y);
|
||||||
trace!(
|
trace!(
|
||||||
"drawing char_code {:#04x} (if this was UTF-8, it would be {})",
|
"drawing char_code {char_code:#04x} (if this was UTF-8, it would be {})",
|
||||||
char_code,
|
|
||||||
char::from(char_code)
|
char::from(char_code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue