Add base Nix/Flake setup

This commit is contained in:
Hassan Abedi 2026-05-29 14:58:38 +02:00
parent 88d767b9df
commit 9ef8db2d08
3 changed files with 138 additions and 6 deletions

View File

@ -12,12 +12,6 @@ The demo:
![Workflow Diagram](docs/diagrams/workflow.svg)
The SVG is generated from `docs/diagrams/workflow.dot`. To regenerate it after editing the `.dot` source, run:
```sh
bash docs/diagrams/make_figures.sh docs/diagrams
```
### Run
```sh

82
flake.lock generated Normal file
View File

@ -0,0 +1,82 @@
{
"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": 1779560665,
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1780024773,
"narHash": "sha256-aU9nlrS9S+IJ2EiCzsaxzOXUhggogqTrJojBicE6Oeg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "40b0a3a193e0840c76174b4a322874c8f6dd0a63",
"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
}

56
flake.nix Normal file
View File

@ -0,0 +1,56 @@
{
description = "Storage engine playground: Rust workspace for FlowLog, DBSP, CRDT, and Geomerge experiments.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
# Edition 2024 requires Rust >= 1.85. Pin to a recent stable.
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
};
in
{
devShells.default = pkgs.mkShell {
name = "storage-engine-playground";
packages = [
rustToolchain
# Diagram regeneration in crates/geomerge-demo/docs/diagrams.
pkgs.graphviz
# Cargo helpers.
pkgs.cargo-watch
pkgs.cargo-nextest
# Pre-commit hooks (see .pre-commit-config.yaml, Makefile setup-hooks).
pkgs.pre-commit
pkgs.python3
];
env = {
RUST_BACKTRACE = "1";
};
shellHook = ''
echo "storage-engine-playground dev shell"
echo " rustc: $(rustc --version)"
echo " cargo: $(cargo --version)"
echo " dot: $(dot -V 2>&1)"
'';
};
formatter = pkgs.nixpkgs-fmt;
});
}