{ pkgs, nativeRustPlatform, windowsRustPlatform, ... }: let cargoToml = fromTOML (builtins.readFile ../Cargo.toml); name = cargoToml.package.name; version = cargoToml.package.version; buildArgs = { pname = name; inherit version; src = pkgs.lib.cleanSource ../.; cargoLock.lockFile = ../Cargo.lock; useNextest = true; meta = { inherit (cargoToml.package) description homepage; }; postBuild = '' ${pkgs.upx}/bin/upx target/*/release/${name} ''; }; nativeBuild = nativeRustPlatform.buildRustPackage buildArgs // { postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}"; }; windowsBuild = windowsRustPlatform.buildRustPackage buildArgs // { postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}.exe"; }; in { default = nativeBuild; windows = windowsBuild; }