Skip to content

Commit

Permalink
chore: use llvm pacakge to enable local cov with devenv (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 authored Nov 10, 2023
1 parent 488fa88 commit 930e45f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
26 changes: 22 additions & 4 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1699510895,
"narHash": "sha256-eaOkJUvHeYNW/xEoRotz0rHkKihKoQdWB1ctX4q1MTQ=",
"lastModified": 1698819743,
"narHash": "sha256-L3vZfifHmog7sJvzXk8qiKISkpyltb+GaThqMJ7PU9Y=",
"owner": "nix-community",
"repo": "fenix",
"rev": "8eeef23f2c8d092227af40eff98afe5b41891e3b",
"rev": "1a92c6d75963fd594116913c23041da48ed9e020",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "monthly",
"repo": "fenix",
"type": "github"
}
Expand Down Expand Up @@ -110,6 +111,22 @@
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1699291058,
"narHash": "sha256-5ggduoaAMPHUy4riL+OrlAZE14Kh7JWX4oLEs22ZqfU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "41de143fda10e33be0f47eab2bfe08a50f234267",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
Expand All @@ -133,7 +150,7 @@
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1699271226,
Expand All @@ -154,6 +171,7 @@
"devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"pre-commit-hooks": "pre-commit-hooks"
}
},
Expand Down
20 changes: 14 additions & 6 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{ pkgs, lib, config, ... }:

{ pkgs, lib, config, inputs, ... }:
let
pkgs-stable = import inputs.nixpkgs-stable { system = pkgs.stdenv.system; };
in
{

# https://devenv.sh/packages/
# on macos frameworks have to be explicitly specified
# otherwise a linker error ocurs on rust packages
packages = [ pkgs.just ]
++ lib.optionals pkgs.stdenv.isLinux [
packages = [
pkgs.just
pkgs.llvmPackages_16.libllvm
# cargo-llvm-cov is currently marked broken on nixpkgs unstable
pkgs-stable.cargo-llvm-cov
]
++ lib.optionals pkgs.stdenv.isLinux [
pkgs.stdenv.cc.cc.lib
]
++ lib.optionals pkgs.stdenv.isDarwin (
++ lib.optionals pkgs.stdenv.isDarwin (
with pkgs.darwin.apple_sdk; [
frameworks.CoreServices
frameworks.CoreFoundation
Expand All @@ -28,6 +34,8 @@
cargo --version
python --version
poetry --version
export LLVM_COV="${pkgs.llvmPackages_16.libllvm}/bin/llvm-cov"
export LLVM_PROFDATA="${pkgs.llvmPackages_16.libllvm}/bin/llvm-profdata"
'';

# https://devenv.sh/languages/
Expand Down
4 changes: 3 additions & 1 deletion devenv.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
inputs:
nixpkgs-stable:
url: github:NixOS/nixpkgs/nixos-23.05
fenix:
url: github:nix-community/fenix
url: github:nix-community/fenix/monthly
inputs:
nixpkgs:
follows: nixpkgs

0 comments on commit 930e45f

Please sign in to comment.