From c2c5f64f4a106fdd26d63e31cdf18c26ba1d0e94 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Sat, 27 Dec 2025 23:58:04 -0500 Subject: [PATCH] Add flake --- flake.lock | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 49 ++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d164d60 --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "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": 1766651565, + "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1766890375, + "narHash": "sha256-0Zi7ChAtjq/efwQYmp7kOJPcSt6ya9ynSUe6ppgZhsQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "91e1f7a0017065360f447622d11b7ce6ed04772f", + "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/flake.nix b/flake.nix new file mode 100644 index 0000000..de149bf --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + description = "Basic flake for devshell environments I often use"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { self, nixpkgs, flake-utils, ... }@inputs: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + + overlays = [ + (import inputs.rust-overlay) + ]; + }; + + rust-bin-nightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + rust-bin-stable = pkgs.rust-bin.stable.latest.default; + rust-bin-nightly-wasm = pkgs.rust-bin.selectLatestNightlyWith ( + toolchain: toolchain.default.override { + targets = [ "wasm32-unknown-unknown" ]; + } + ); + + extraRustPkgs = with pkgs; [ + pkg-config + openssl + ]; + in + { + devShells.rust-stable = pkgs.mkShell { + buildInputs = [ rust-bin-stable ] ++ extraRustPkgs; + }; + + devShells.rust-nightly = pkgs.mkShell { + buildInputs = [ rust-bin-nightly ] ++ extraRustPkgs; + }; + + devShells.rust-nightly-wasm = pkgs.mkShell { + buildInputs = [ rust-bin-nightly-wasm ] ++ extraRustPkgs; + }; + } + ); +}