From 19a5f9ae076b0d4a4fea9a170f4125b8b3567d5f Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Wed, 6 Nov 2024 10:26:41 -0800 Subject: [PATCH] add AWS Lambda/Rust, utilizing rust flake as base --- aws-rust-lambda/flake.lock | 127 +++++++++++++++++++++++++++++++++++++ aws-rust-lambda/flake.nix | 29 +++++++++ 2 files changed, 156 insertions(+) create mode 100644 aws-rust-lambda/flake.lock create mode 100644 aws-rust-lambda/flake.nix diff --git a/aws-rust-lambda/flake.lock b/aws-rust-lambda/flake.lock new file mode 100644 index 0000000..a106799 --- /dev/null +++ b/aws-rust-lambda/flake.lock @@ -0,0 +1,127 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1730272153, + "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-flake": "rust-flake" + } + }, + "rust-flake": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "dir": "/rust", + "narHash": "sha256-gu3plp+xRyVCCAO0IS633xMCxFbMVB7Pok8uYh9OPXc=", + "type": "tarball", + "url": "https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/rust" + }, + "original": { + "dir": "/rust", + "type": "tarball", + "url": "https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/rust" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/aws-rust-lambda/flake.nix b/aws-rust-lambda/flake.nix new file mode 100644 index 0000000..ee56d8a --- /dev/null +++ b/aws-rust-lambda/flake.nix @@ -0,0 +1,29 @@ +# lambda-flake/flake.nix +{ + description = "AWS Lambda deployment flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-flake.url = "https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/rust"; # Adjust this path as needed + # rust-flake.url = "https://git.lerch.org/lobo/nix-flake-examples/archive/master.tar.gz?dir=/rust"; # Adjust this path as needed + }; + + outputs = { self, nixpkgs, flake-utils, rust-flake }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + buildInputs = [ + # Include Rust tools from the rust-flake + rust-flake.devShells.${system}.default.buildInputs + + # Add AWS Lambda deployment tools + pkgs.cargo-lambda + ]; + }; + } + ); +}