Skip to content

Conversation

@TroyKomodo
Copy link
Contributor

@TroyKomodo TroyKomodo commented Dec 18, 2025

Not sure if wanted, can close if not.

Adds nix flake so that nix shells can inherit the required tooling to build / develop the project.

developer env usage

# direnv + nix
direnv allow

# nix only
nix develop .

package building

The nix flake also adds the package building process used by end users (separate component can be removed).

nix build .#sccache

module integration

# Add flake input
sccache.url = "github:mozilla/sccache";

# Add overlay
nixpkgs.overlays = [ sccache.overlays.default ];
environment.systemPackages = [ pkgs.sccache ]; # nixos

Signed-off-by: Troy Benson <[email protected]>
Copy link

@nbp nbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with the .envrc files, and I am not fond of pulling online resources when doing local development. However this file might be slightly outdated (3.0.7 -> 3.1.0) compared to https://github.com/nix-community/nix-direnv/blob/master/templates/flake/.envrc

Overall the flake looks good.

I would not have included the NixOS / HomeManager modules only for registering the flake output as part of the system packages, unless there was some added value such as registering a systemd jobs for starting the sccache server.

I will also note that the lack of overlay for the definition of packages imply that this flake creates an additional instances of Nixpkgs (line 54: import nixpkgs) when using any of the modules, which is a bad practice.

On another note, I am surprise that rustup now works in nix develop shells, but I guess things sometimes get fixed by not looking at them for about 10 years.

@TroyKomodo
Copy link
Contributor Author

I am not familiar with the .envrc files, and I am not fond of pulling online resources when doing local development. However this file might be slightly outdated (3.0.7 -> 3.1.0) compared to https://github.com/nix-community/nix-direnv/blob/master/templates/flake/.envrc

direnv basically initializes the shell when entering the directory. Also plays nice with vscode using the https://marketplace.visualstudio.com/items?itemName=mkhl.direnv extension which causes all of the other vscode extensions to inherit the nix dev shell. (such as rust-analyzer)

Hmm, i see the latest release is https://github.com/nix-community/nix-direnv/releases/tag/3.0.7, but i see the 3.1.0 tag so i think they just forgot to create a git release for it. I'll update.

I would not have included the NixOS / HomeManager modules only for registering the flake output as part of the system packages, unless there was some added value such as registering a systemd jobs for starting the sccache server.

I think thats out of scope for this. I'll remove them.

I will also note that the lack of overlay for the definition of packages imply that this flake creates an additional instances of Nixpkgs (line 54: import nixpkgs) when using any of the modules, which is a bad practice.

I think I fixed it?

Copy link

@nbp nbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds good to me!

I could be pedantic about the differences between final and prev for pulling library functions, but this has no impact today …

@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.04%. Comparing base (cd7dcd5) to head (3c5e3c7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2518   +/-   ##
=======================================
  Coverage   71.04%   71.04%           
=======================================
  Files          64       64           
  Lines       35369    35369           
=======================================
+ Hits        25128    25129    +1     
+ Misses      10241    10240    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sylvestre sylvestre merged commit dc2085c into mozilla:main Dec 19, 2025
54 checks passed
@TroyKomodo TroyKomodo deleted the troy/nix branch December 19, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants