From 6423baebd92e45c9be85157c443dff42e65d8d14 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 1 Sep 2023 00:00:00 +0000 Subject: refactor: rebuild app skeleton Create skeleton for a complete rebuild of the prototype as a production ready product. Includes design patterns for: - dependency injection - unit testing with dependency mocking - integration testing - error handling - config storage BREAKING-CHANGE: ground-up redesign with incompatible protocol standards --- flake.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7c36e2d --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + 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 { + + nativeBuildInputs = [ + # stable to be introduced when the following issue is resolved + # https://github.com/oxalica/rust-overlay/issues/136 + # rust-bin.stable.latest.default + # nightly for rustfmt + ( + rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + extensions = [ + "rust-src" + "rustfmt" + "clippy" + ]; + }) + ) + ]; + + buildInputs = [ + rust-analyzer + gitlint + ]; + shellHook = '' + # auto-install git hooks + dot_git="$(git rev-parse --git-common-dir)" + if [[ ! -d "$dot_git/hooks" ]]; then mkdir "$dot_git/hooks"; fi + for hook in git_hooks/* ; do ln -sf "$(pwd)/$hook" "$dot_git/hooks/" ; done + + # For rust-analyzer 'hover' tooltips to work. + export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} + ''; + }; + } + ); +} -- cgit v1.2.3