From a39ea0fc5a08236c24d216fcdd9646bb5234732e Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Thu, 25 Jan 2024 22:37:08 +0100 Subject: [PATCH] add rustpython --- rust-toolchain/flake.lock | 6 +-- rust/flake.lock | 6 +-- rustpython/.envrc | 1 + rustpython/flake.lock | 80 ++++++++++++++++++++++++++++++++++ rustpython/flake.nix | 48 ++++++++++++++++++++ rustpython/rust-toolchain.toml | 2 + 6 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 rustpython/.envrc create mode 100644 rustpython/flake.lock create mode 100644 rustpython/flake.nix create mode 100644 rustpython/rust-toolchain.toml diff --git a/rust-toolchain/flake.lock b/rust-toolchain/flake.lock index be929ba..e2e18ee 100644 --- a/rust-toolchain/flake.lock +++ b/rust-toolchain/flake.lock @@ -46,11 +46,11 @@ ] }, "locked": { - "lastModified": 1705976279, - "narHash": "sha256-Zx97bJ3+O8IP70uJPD//rRsr8bcxICISMTZUT/L9eFk=", + "lastModified": 1706062676, + "narHash": "sha256-aIgYdyQyKRHZ8gSmke3DE09D5ypK4tP+XYqrKPAd/3M=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "f889dc31ef97835834bdc3662394ebdb3c96b974", + "rev": "81eb4bdb219d97d749f152eb4de6a081b088b08d", "type": "github" }, "original": { diff --git a/rust/flake.lock b/rust/flake.lock index be929ba..e2e18ee 100644 --- a/rust/flake.lock +++ b/rust/flake.lock @@ -46,11 +46,11 @@ ] }, "locked": { - "lastModified": 1705976279, - "narHash": "sha256-Zx97bJ3+O8IP70uJPD//rRsr8bcxICISMTZUT/L9eFk=", + "lastModified": 1706062676, + "narHash": "sha256-aIgYdyQyKRHZ8gSmke3DE09D5ypK4tP+XYqrKPAd/3M=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "f889dc31ef97835834bdc3662394ebdb3c96b974", + "rev": "81eb4bdb219d97d749f152eb4de6a081b088b08d", "type": "github" }, "original": { diff --git a/rustpython/.envrc b/rustpython/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/rustpython/.envrc @@ -0,0 +1 @@ +use flake diff --git a/rustpython/flake.lock b/rustpython/flake.lock new file mode 100644 index 0000000..e2e18ee --- /dev/null +++ b/rustpython/flake.lock @@ -0,0 +1,80 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1705856552, + "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", + "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", + "revCount": 574351, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.574351%2Brev-612f97239e2cc474c13c9dafa0df378058c5ad8d/018d3085-aff0-7a0b-ab80-1a9c414de8cd/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706062676, + "narHash": "sha256-aIgYdyQyKRHZ8gSmke3DE09D5ypK4tP+XYqrKPAd/3M=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "81eb4bdb219d97d749f152eb4de6a081b088b08d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "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/rustpython/flake.nix b/rustpython/flake.nix new file mode 100644 index 0000000..73f2733 --- /dev/null +++ b/rustpython/flake.nix @@ -0,0 +1,48 @@ +{ + description = "A Nix-flake-based Rust development environment"; + + inputs = { + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { self + , nixpkgs + , rust-overlay + , + }: + let + overlays = [ + rust-overlay.overlays.default + (final: prev: { + rustToolchain = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + }) + ]; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs { inherit overlays system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + rustToolchain + openssl + pkg-config + cargo-deny + cargo-edit + cargo-watch + rust-analyzer + rustpython + ]; + }; + }); + }; +} diff --git a/rustpython/rust-toolchain.toml b/rustpython/rust-toolchain.toml new file mode 100644 index 0000000..f2415f8 --- /dev/null +++ b/rustpython/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.69.0"