aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-09-23 18:39:37 +0000
committerFuwn <[email protected]>2024-09-23 18:45:46 +0000
commit84390d9a0cac240318381f7f0fc08823733d6788 (patch)
treec5ab0833da607935aec922c1559e069f06e8d809
parentchore(whirl): remove custom allocators (diff)
downloadwhirl-84390d9a0cac240318381f7f0fc08823733d6788.tar.xz
whirl-84390d9a0cac240318381f7f0fc08823733d6788.zip
chore(nix): add nix development environment
-rw-r--r--.envrc9
-rw-r--r--flake.lock82
-rw-r--r--flake.nix45
3 files changed, 136 insertions, 0 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..df422cf
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+if type -P lorri &>/dev/null; then
+ eval "$(lorri direnv)"
+else
+ echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
+
+ use nix
+fi
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..0664d8f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,82 @@
+{
+ "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"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1726871744,
+ "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
+ "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"
+ ]
+ },
+ "locked": {
+ "lastModified": 1727058553,
+ "narHash": "sha256-tY/UU3Qk5gP/J0uUM4DZ6wo4arNLGAVqLKBotILykfQ=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "edc5b0f896170f07bd39ad59d6186fcc7859bbb2",
+ "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..edc46d2
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,45 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ {
+ nixpkgs,
+ flake-utils,
+ rust-overlay,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ overlays = [ (import rust-overlay) ];
+ pkgs = import nixpkgs { inherit system overlays; };
+ in
+ {
+ devShell =
+ with pkgs;
+ mkShell.override
+ {
+ stdenv = stdenvAdapters.useMoldLinker clangStdenv;
+ }
+ {
+ nativeBuildInputs = [
+ rust-bin.nightly."2024-06-03".default
+ cargo-make
+ openssl
+ pkg-config
+ cargo-watch
+ ];
+
+ RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
+ };
+ }
+ );
+}