upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..7c36e2d
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,52 @@
1{
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4 rust-overlay.url = "github:oxalica/rust-overlay";
5 flake-utils.url = "github:numtide/flake-utils";
6 };
7
8 outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
9 flake-utils.lib.eachDefaultSystem (system:
10 let
11 overlays = [ (import rust-overlay) ];
12 pkgs = import nixpkgs {
13 inherit system overlays;
14 };
15 in
16 with pkgs;
17 {
18 devShells.default = mkShell {
19
20 nativeBuildInputs = [
21 # stable to be introduced when the following issue is resolved
22 # https://github.com/oxalica/rust-overlay/issues/136
23 # rust-bin.stable.latest.default
24 # nightly for rustfmt
25 (
26 rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
27 extensions = [
28 "rust-src"
29 "rustfmt"
30 "clippy"
31 ];
32 })
33 )
34 ];
35
36 buildInputs = [
37 rust-analyzer
38 gitlint
39 ];
40 shellHook = ''
41 # auto-install git hooks
42 dot_git="$(git rev-parse --git-common-dir)"
43 if [[ ! -d "$dot_git/hooks" ]]; then mkdir "$dot_git/hooks"; fi
44 for hook in git_hooks/* ; do ln -sf "$(pwd)/$hook" "$dot_git/hooks/" ; done
45
46 # For rust-analyzer 'hover' tooltips to work.
47 export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
48 '';
49 };
50 }
51 );
52}