diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/flake.lock b/flake.lock index 1100636..6868307 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1754498491, @@ -52,7 +34,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } @@ -74,21 +55,6 @@ "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", diff --git a/flake.nix b/flake.nix index eb90221..643f630 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,37 @@ { - description = "Rust Development Shell"; + description = "Pinned Rust dev shell"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + 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: + outputs = { self, nixpkgs, rust-overlay, ... }: + let + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let - overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { - inherit system overlays; + inherit system; + overlays = [ (import rust-overlay) ]; }; - in - with pkgs; - { - devShells.default = mkShell { - buildInputs = [ - openssl - pkg-config - ( - rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { - extensions = [ - "rust-src" - "rust-analyzer" - ]; - }) - ) - ]; + rustToolchain = pkgs.rust-bin.stable."1.89.0".default.override { + extensions = [ "rust-src" "rust-analyzer" ]; }; - } + in f pkgs rustToolchain ); + in { + devShells = forAllSystems (pkgs: rustToolchain: { + default = pkgs.mkShell { + nativeBuildInputs = [ + pkgs.pkg-config + rustToolchain + pkgs.lldb + ]; + buildInputs = [ + pkgs.openssl + ]; + }; + }); + }; } diff --git a/flake_old.nix b/flake_old.nix new file mode 100644 index 0000000..eb90221 --- /dev/null +++ b/flake_old.nix @@ -0,0 +1,36 @@ +{ + description = "Rust Development Shell"; + + 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; + }; + in + with pkgs; + { + devShells.default = mkShell { + buildInputs = [ + openssl + pkg-config + ( + rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + extensions = [ + "rust-src" + "rust-analyzer" + ]; + }) + ) + ]; + }; + } + ); +}