Add Http effect for making HTTP requests: - Http.get(url) - GET request - Http.post(url, body) - POST with string body - Http.postJson(url, json) - POST with JSON body - Http.put(url, body) - PUT request - Http.delete(url) - DELETE request Returns Result<HttpResponse, String> where HttpResponse contains status code, body, and headers. Includes reqwest dependency with blocking client, OpenSSL support in flake.nix, and example at examples/http.lux demonstrating API requests with JSON parsing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.9 KiB
Nix
59 lines
1.9 KiB
Nix
{
|
|
description = "Lux - A functional programming language with first-class effects";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
extensions = [ "rust-src" "rust-analyzer" ];
|
|
};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
rustToolchain
|
|
cargo-watch
|
|
cargo-edit
|
|
];
|
|
|
|
RUST_BACKTRACE = "1";
|
|
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
|
|
|
|
shellHook = ''
|
|
printf "\n"
|
|
printf " \033[1;35m╦ ╦ ╦╦ ╦\033[0m\n"
|
|
printf " \033[1;35m║ ║ ║╔╣\033[0m\n"
|
|
printf " \033[1;35m╩═╝╚═╝╩ ╩\033[0m v0.1.0\n"
|
|
printf "\n"
|
|
printf " Functional language with first-class effects\n"
|
|
printf "\n"
|
|
printf " \033[1mCommands:\033[0m\n"
|
|
printf " cargo build Build the compiler\n"
|
|
printf " cargo run Start the REPL\n"
|
|
printf " cargo test Run tests\n"
|
|
printf " cargo run -- \033[3m<file.lux>\033[0m Run a file\n"
|
|
printf "\n"
|
|
'';
|
|
};
|
|
|
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "lux";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
buildInputs = [ pkgs.openssl ];
|
|
};
|
|
}
|
|
);
|
|
}
|