Skip to content

Commit

Permalink
chore: devenv support for local coverage (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 authored Nov 10, 2023
1 parent b256c2b commit 78faf6d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
19 changes: 18 additions & 1 deletion devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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 +149,7 @@
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1699271226,
Expand All @@ -154,6 +170,7 @@
"devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"pre-commit-hooks": "pre-commit-hooks"
}
},
Expand Down
25 changes: 17 additions & 8 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
{ pkgs, lib, config, ... }:

{ pkgs, lib, config, inputs, ... }:
let
pkgs-stable = import inputs.nixpkgs-stable { system = pkgs.stdenv.system; };
in
{
# https://devenv.sh/basics/

# 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.isDarwin (with pkgs.darwin.apple_sdk; [
frameworks.CoreServices
frameworks.CoreFoundation
]);
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.isDarwin
(with pkgs.darwin.apple_sdk; [
frameworks.CoreServices
frameworks.CoreFoundation
]);

# https://devenv.sh/scripts/
scripts.hello.exec = "echo Welcome to hugr dev shell!";

enterShell = ''
hello
cargo --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
2 changes: 2 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
inputs:
nixpkgs-stable:
url: github:NixOS/nixpkgs/nixos-23.05
fenix:
url: github:nix-community/fenix
inputs:
Expand Down

0 comments on commit 78faf6d

Please sign in to comment.