From 990437ad13f07b40eec1e3b1ff9ea8e7cf7ab689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Wed, 5 Jun 2024 20:51:21 +0200 Subject: [PATCH 1/2] build(nix): add bear to dev shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A useful addition to make sure is available, since we also make clangd available through clang-tools. bear can generate the `compile_commands.json` for clangd. For example with `make clean && bear -- make -j$(nproc)`. Signed-off-by: Thomas Mühlbacher --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 6c379313f..5222d6551 100644 --- a/flake.nix +++ b/flake.nix @@ -174,6 +174,7 @@ # development, and might need to be version matched with build # dependencies (e.g. clippy or rust-analyzer). packages = with pkgs; [ + bear cargo-audit cargo-outdated clang-tools From 2a15fc044537a07fec61bf1dc003175309e5b067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Thu, 6 Jun 2024 17:58:22 +0200 Subject: [PATCH 2/2] build(nix): use actual commit rev in version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way we get an actually unique version for every version that can be traced back to the source. Signed-off-by: Thomas Mühlbacher --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 5222d6551..e4bc38eaf 100644 --- a/flake.nix +++ b/flake.nix @@ -66,11 +66,11 @@ craneLib = crane.mkLib pkgs; - libbcachefsCommit = substring 0 7 (builtins.readFile ./.bcachefs_revision); + rev = self.shortRev or self.dirtyShortRev or (substring 0 8 self.lastModifiedDate); makefileVersion = removePrefix "VERSION=" ( findFirst (line: hasPrefix "VERSION=" line) "VERSION=0.0.0" (split "\n" (readFile ./Makefile)) ); - version = "${makefileVersion}+git-${libbcachefsCommit}"; + version = "${makefileVersion}+${rev}"; commonArgs = { inherit version;