diff --git a/flake.nix b/flake.nix index d59aa55..d528014 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,11 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nix-filter.url = "github:numtide/nix-filter"; naersk = { url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; }; - nix-filter = { - url = "github:numtide/nix-filter"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = @@ -29,15 +26,26 @@ "x86_64-darwin" ]; forAllSystems = lib.genAttrs supported-systems; + make-rust-toolchain-core = + pkgs: + pkgs.symlinkJoin { + name = "rust-toolchain-core"; + paths = with pkgs; [ + rustc + cargo + rustPlatform.rustcSrc + ]; + }; in rec { packages = forAllSystems ( system: let pkgs = nixpkgs.legacyPackages."${system}"; + rust-toolchain-core = make-rust-toolchain-core pkgs; naersk' = pkgs.callPackage naersk { - cargo = pkgs.cargo; - rustc = pkgs.rustc; + cargo = rust-toolchain-core; + rustc = rust-toolchain-core; }; in rec { @@ -98,18 +106,21 @@ system: let pkgs = nixpkgs.legacyPackages."${system}"; + rust-toolchain = pkgs.symlinkJoin { + name = "rust-toolchain"; + paths = with pkgs; [ + (make-rust-toolchain-core pkgs) + rustfmt + clippy + cargo-expand + ]; + }; in { default = pkgs.mkShell rec { inputsFrom = [ self.packages.${system}.default ]; - packages = with pkgs; [ - rustfmt - cargo-expand - clippy - ]; - # LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath ( - # builtins.concatMap (d: d.runtimeDependencies) inputsFrom - # )}"; + packages = [ rust-toolchain ]; + LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (builtins.concatMap (d: d.buildInputs) inputsFrom)}"; RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; }; } diff --git a/src/execute_command.rs b/src/execute_command.rs index e746dc4..81f6f67 100644 --- a/src/execute_command.rs +++ b/src/execute_command.rs @@ -106,10 +106,7 @@ pub(crate) fn execute_command( fn check_bitmap_valid(offset: u16, payload_len: usize) -> bool { if offset as usize + payload_len > PIXEL_COUNT { - error!( - "bitmap with offset {offset} is too big ({} bytes)", - payload_len - ); + error!("bitmap with offset {offset} is too big ({payload_len} bytes)"); return false; } @@ -127,8 +124,7 @@ fn print_cp437_data( for char_x in 0usize..grid.width() { let char_code = grid.get(char_x, char_y); trace!( - "drawing char_code {:#04x} (if this was UTF-8, it would be {})", - char_code, + "drawing char_code {char_code:#04x} (if this was UTF-8, it would be {})", char::from(char_code) );