From 222eb72da97784c76cc477a708fd06425461de77 Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Sat, 25 May 2024 12:21:32 +0200 Subject: [PATCH] build: added `shell.nix` and direnv integration --- .envrc | 1 + .gitignore | 1 + shell.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index 9b8adcb..629f81b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +/.direnv flamegraph.svg perf.data* diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..1cc9698 --- /dev/null +++ b/shell.nix @@ -0,0 +1,40 @@ +let + nixpkgs = builtins.fetchGit { + name = "nixos-23.11"; + url = "https://github.com/nixos/nixpkgs"; + ref = "refs/heads/nixos-23.11"; + }; + + nixpkgs-unstable = builtins.fetchGit { + name = "nixos-unstable"; + url = "https://github.com/nixos/nixpkgs"; + ref = "refs/heads/nixos-unstable"; + }; + + pkgs = import nixpkgs {}; + pkgs-unstable = import nixpkgs-unstable {}; + +in pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + pkgs-unstable.rustc + pkgs-unstable.rustfmt + pkgs-unstable.cargo + pkgs-unstable.clippy + + gcc + cmake + pkg-config + ]; + + buildInputs = with pkgs; [ + gtk4 + glib + gdk-pixbuf + gobject-introspection + + libadwaita + ]; + + RUST_SRC_PATH = "${pkgs-unstable.rust.packages.stable.rustPlatform.rustLibSrc}"; + RUST_BACKTRACE = 1; +}