8000 fix: Nix flake by webbrain-one · Pull Request #108 · avelino/mcp · GitHub
[go: up one dir, main page]

Skip to content

fix: Nix flake - #108

Merged
avelino merged 1 commit into
avelino:mainfrom
webbrain-one:webbrain/issue-18
Oct 13, 2026
Merged

avelino merged 1 commit into
avelino:mainfrom
webbrain-one:webbrain/issue-18

Conversation

@webbrain-one
Copy link
Copy Markdown
Contributor

Closes #18

Enables installing and running mcp via `nix run github:avelino/mcp`.
Facilitates integration into NixOS and home-manager configurations.

Closes avelino#18
Copilot AI lite review requested due to automatic review settings August 13, 2026 07:02
@webbrain-one webbrain-one mentioned this pull request Aug 13, 2026
@qodo-code-review
Copy link
Copy Markdown
< 8000 /tr>

PR Summary by Qodo

Add Nix flake to build/run mcp via nix

⚙️ Configuration changes ✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add Nix flake outputs for package, app, and dev shell.
• Enable nix run github:avelino/mcp for reproducible installs.
• Provide Rust toolchain devShell for NixOS/home-manager workflows.
Diagram

graph TD
  A["flake.nix"] --> B["flake-utils"] --> C["eachDefaultSystem"] --> D["nixpkgs"] --> E["buildRustPackage"] --> F["packages.default"]
  C --> G["apps.default"]
  C --> H["devShells.default"]
  F --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use crane for Rust builds
  • ➕ Often better incremental builds and caching in CI
  • ➕ First-class patterns for Rust workspaces and dependency-only builds
  • ➖ Adds a new flake input and slightly more setup complexity
  • ➖ May be overkill for a single-crate CLI
2. Use naersk instead of buildRustPackage
  • ➕ Simple configuration and commonly used for Rust flakes
  • ➕ Can avoid some buildRustPackage-specific quirks
  • ➖ Extra dependency and less aligned with nixpkgs standard packaging
  • ➖ May require additional tuning for reproducibility across toolchains

Recommendation: The current approach (nixpkgs rustPlatform.buildRustPackage + Cargo.lock) is the most standard and easiest to maintain for a Rust CLI. Consider switching to crane only if CI build times/caching become a priority or if the project evolves into a workspace with more complex dependency management.

Files changed (1) +42 / -0

Other (1) +42 / -0
flake.nixIntroduce Nix flake for building, running, and developing mcp +42/-0

Introduce Nix flake for building, running, and developing mcp

• Adds a flake that imports nixpkgs and uses flake-utils to generate per-system outputs. Defines a default Rust package build from Cargo.toml/Cargo.lock, an app entrypoint for 'nix run', and a dev shell with common Rust tooling.

flake.nix

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a Nix flake to let Nix/NixOS users build and run mcp via standard flake workflows (e.g., nix run), addressing the packaging gap described in Issue #18.

Changes:

  • Introduces flake.nix with buildRustPackage packaging for the Rust CLI.
  • Defines a default app entry for nix run and a Rust-focused development shell.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread flake.nix
Comment on lines +9 to +10
outputs = { self, nixpkgs, utils }:
utils.eachDefaultSystem (system:
Comment thread flake.nix
Comment on lines +23 to +26
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
@qodo-code-review
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. No flake.lock pinning 🐞 Bug ☼ Reliability
Description
The flake declares nixpkgs/flake-utils as floating GitHub references, but there is no commit
8000
ted
flake.lock, so different users/CI runs can resolve different nixpkgs revisions over time and get
inconsistent builds. This undermines the main reproducibility benefit of introducing a flake.
Code

flake.nix[R4-7]

+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+    utils.url = "github:numtide/flake-utils";
+  };
Evidence
The flake inputs are explicitly set to moving GitHub references; without a lock file, these inputs
are not pinned to a specific revision.

flake.nix[4-7]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`flake.nix` uses floating GitHub inputs (e.g., `nixos-unstable`) but the repo does not include a committed `flake.lock`, making the flake evaluation non-deterministic across time/machines.

### Issue Context
Nix flakes rely on `flake.lock` to pin exact revisions of each input. Without it, the input versions are resolved at evaluation time and can change without any repo changes.

### Fix Focus Areas
- flake.lock[1-999999]

### Suggested fix
1. Run `nix flake lock` (or `nix flake update` if you intend to refresh inputs).
2. Commit the generated `flake.lock` file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. Unneeded fetchGit fallback 🐞 Bug ⚙ Maintainability
Description
cargoLock.allowBuiltinFetchGit = true enables a fallback mechanism intended for git-based Cargo
dependencies, but for registry-sourced dependencies it provides no benefit and adds avoidable
configuration surface. Keeping it disabled unless required helps preserve stricter/reproducible
fetch behavior.
Code

flake.nix[R23-26]

+          cargoLock = {
+            lockFile = ./Cargo.lock;
+            allowBuiltinFetchGit = true;
+          };
Evidence
The PR explicitly enables allowBuiltinFetchGit. The lockfile contains registry-sourced packages
(example), which do not require this git fallback.

flake.nix[23-26]
Cargo.lock[208-213]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`cargoLock.allowBuiltinFetchGit = true` is enabled in the flake. This setting is generally only needed when your `Cargo.lock` contains git dependencies that you are not pinning via `outputHashes`.

### Issue Context
The current lockfile includes registry-sourced packages (example shown in citations). If you don’t have git dependencies, leaving this enabled is unnecessary.

### Fix Focus Areas
- flake.nix[23-26]

### Suggested fix
- Remove `allowBuiltinFetchGit = true;`.
- If you do have git dependencies that require special handling, prefer adding explicit `outputHashes` (and optionally add a short comment documenting which dependency requires it).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context
✅ Compliance rules (platform): 28 rules
Review mode: ⚖️ Balanced: This adds runtime build, packaging, app, and development-shell configuration; it is localized but behaviorally significant and not eligible for lite or skip.

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread flake.nix
Comment on lines +4 to +7
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. No flake.lock pinning 🐞 Bug ☼ Reliability

The flake declares nixpkgs/flake-utils as floating GitHub references, but there is no committed
flake.lock, so different u
8000
sers/CI runs can resolve different nixpkgs revisions over time and get
inconsistent builds. This undermines the main reproducibility benefit of introducing a flake.
Agent Prompt
### Issue description
`flake.nix` uses floating GitHub inputs (e.g., `nixos-unstable`) but the repo does not include a committed `flake.lock`, making the flake evaluation non-deterministic across time/machines.

### Issue Context
Nix flakes rely on `flake.lock` to pin exact revisions of each input. Without it, the input versions are resolved at evaluation time and can change without any repo changes.

### Fix Focus Areas
- flake.lock[1-999999]

### Suggested fix
1. Run `nix flake lock` (or `nix flake update` if you intend to refresh inputs).
2. Commit the generated `flake.lock` file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread flake.nix
Comment on lines +23 to +26
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

2. Unneeded fetchgit fallback 🐞 Bug ⚙ Maintainability

cargoLock.allowBuiltinFetchGit = true enables a fallback mechanism intended for git-based Cargo
dependencies, but for registry-sourced dependencies it provides no benefit and adds avoidable
configuration surface. Keeping it disabled unless required helps preserve stricter/reproducible
fetch behavior.
Agent Prompt
### Issue description
`cargoLock.allowBuiltinFetchGit = true` is enabled in the flake. This setting is generally only needed when your `Cargo.lock` contains git dependencies that you are not pinning via `outputHashes`.

### Issue Context
The current lockfile includes registry-sourced packages (example shown in citations). If you don’t have git dependencies, leaving this enabled is unnecessary.

### Fix Focus Areas
- flake.nix[23-26]

### Suggested fix
- Remove `allowBuiltinFetchGit = true;`.
- If you do have git dependencies that require special handling, prefer adding explicit `outputHashes` (and optionally add a short comment documenting which dependency requires it).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review
Copy link
Copy Markdown

Qodo Fixer

✅ Merged (0) · ☑ Fixed (0)

Process

  • No fixes were applied (no_fixes_applied)

avelino commented Oct 7, 2026
Copy link
Copy Markdown
Owner

Thanks for adding this, and sorry for the slow reply. Happy to have Nix support. A few small things before merging: could you commit the flake.lock so builds are reproducible, drop defaultPackage (packages.default already covers it), and add a short install line to the README, something like nix run github:avelino/mcp? Then it's good to go.

@avelino
avelino merged commit 30456e4 into avelino:main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nix flake

3 participants

0