Skip to content

feat: add initial NUR repository setup - #1

Open
leonid-shevtsov wants to merge 1 commit into
mainfrom
chore/initial-nur-setup
Open

feat: add initial NUR repository setup#1
leonid-shevtsov wants to merge 1 commit into
mainfrom
chore/initial-nur-setup

Conversation

@leonid-shevtsov

@leonid-shevtsov leonid-shevtsov commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What & why

Bootstrap a Mailtrap NUR-style Nix package repo so we can distribute mailtrap-local (and later other tools) via Nix, with release updates driven from goreleaser.

  • Scaffold from the nix-community NUR template: default.nix, flake, overlay, CI eval/build workflow.
  • Add mailtrap-local as a prebuilt GitHub Releases package (same artifacts as Homebrew), owned by goreleaser PRs on each tag.

How to test

  • nix build github:mailtrap/mailtrap-nur/chore/initial-nur-setup#mailtrap-local (or clone this branch and nix build .#mailtrap-local)
  • ./result/bin/mailtrap-local --version prints 0.2.0

Summary by CodeRabbit

  • New Features

    • Established Mailtrap NUR (Nix User Repository) with the mailtrap-local package available for installation.
    • Added support for both flake-based and traditional Nix installation methods.
  • Documentation

    • Added comprehensive guide with installation instructions, usage examples, and developer setup information.
  • Chores

    • Added MIT license and configured CI/build infrastructure for the repository.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@leonid-shevtsov, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: efebec78-8fe6-477e-a513-1cba3f777834

📥 Commits

Reviewing files that changed from the base of the PR and between ace337f and a449fc7.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .github/workflows/build.yml
  • LICENSE
  • README.md
  • ci.nix
  • default.nix
  • flake.nix
  • lib/default.nix
  • nixos-modules/default.nix
  • overlay.nix
  • overlays/default.nix
  • pkgs/mailtrap-local/default.nix
📝 Walkthrough

Walkthrough

This change establishes a Nix repository for Mailtrap tooling, packages mailtrap-local version 0.2.0, exposes flake and overlay interfaces, adds CI evaluation and build workflows, and documents installation, development, contribution, and licensing information.

Changes

Mailtrap package foundation

Layer / File(s) Summary
Package definition
default.nix, pkgs/mailtrap-local/default.nix
Defines the exported repository attributes and packages the platform-specific mailtrap-local binary with a mailtrap-sendmail symlink.

Nix exports and overlays

Layer / File(s) Summary
Nix exports and overlays
flake.nix, overlay.nix, lib/default.nix, nixos-modules/default.nix, overlays/default.nix
Adds per-system flake packages, NixOS module and library placeholders, and an overlay that exports non-reserved repository attributes.

CI package selection and builds

Layer / File(s) Summary
CI package selection and builds
ci.nix, .github/workflows/build.yml
Selects buildable and cacheable derivations and runs restricted evaluation and uncached builds across three nixpkgs versions on pull requests, branch pushes, schedules, and manual dispatches.

Documentation and licensing

Layer / File(s) Summary
Documentation and licensing
README.md, LICENSE
Documents available packages, installation and development commands, package contribution steps, and MIT licensing terms.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: bootstrapping an initial NUR repository setup.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leonid-shevtsov
leonid-shevtsov force-pushed the chore/initial-nur-setup branch from ace337f to a449fc7 Compare July 29, 2026 09:19
@@ -0,0 +1,58 @@
# This file was generated by GoReleaser. DO NOT EDIT.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file would be typically updated by PR from GoReleaser, but for now we're seeding the current version as is to have the package present.

Once the pipeline is fully in place we'll make a new release to do it properly.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/build.yml (1)

33-43: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise the flake interface in CI.

The current checks only evaluate default.nix and ci.nix; they can pass while flake.nix outputs are broken. Add a nix flake check or targeted flake evaluation after fixing the system mismatch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml around lines 33 - 43, Add a CI step after
resolving the system mismatch that runs `nix flake check` (or an equivalent
targeted evaluation) against the repository’s flake interface. Keep the existing
`Check evaluation` and `Build nix packages` steps intact while ensuring flake
outputs are exercised during workflow validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build.yml:
- Around line 22-30: Update the checkout step using actions/checkout@v5 to set
persist-credentials to false, and restrict the workflow’s permissions to
read-only where possible while preserving the existing build behavior.

In `@flake.nix`:
- Around line 7-17: Restrict the forAllSystems systems list used by
legacyPackages and packages to the four platforms declared in mailtrap-local’s
meta.platforms, rather than iterating over nixpkgs.lib.systems.flakeExposed.
Update the shared system-attribute generation near forAllSystems so unsupported
targets cannot evaluate urlMap.${system}; preserve the existing package
filtering and per-system imports for supported platforms.

In `@README.md`:
- Around line 21-40: Update the README flake example’s outputs attrset to expose
mailtrap-local as an actual package output, using the existing
pkgs.mailtrap-local package and the configured system attribute so copied flakes
can build or run it.
- Around line 52-57: Update the non-flake Nix example around the mailtrap
binding so the mailtrap assignment is valid top-level syntax, wrapping it in a
let...in expression or attribute set while preserving the existing pkgs
inheritance and mailtrap.mailtrap-local usage.

---

Nitpick comments:
In @.github/workflows/build.yml:
- Around line 33-43: Add a CI step after resolving the system mismatch that runs
`nix flake check` (or an equivalent targeted evaluation) against the
repository’s flake interface. Keep the existing `Check evaluation` and `Build
nix packages` steps intact while ensuring flake outputs are exercised during
workflow validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 09b726da-1221-494b-99c4-fc323c2f7946

📥 Commits

Reviewing files that changed from the base of the PR and between 3f5bb56 and ace337f.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .github/workflows/build.yml
  • LICENSE
  • README.md
  • ci.nix
  • default.nix
  • flake.nix
  • lib/default.nix
  • nixos-modules/default.nix
  • overlay.nix
  • overlays/default.nix
  • pkgs/mailtrap-local/default.nix

Comment on lines +22 to +30
- name: Checkout repository
uses: actions/checkout@v5
- name: Install nix
uses: cachix/install-nix-action@v31
with:
nix_path: "${{ matrix.nixPath }}"
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== candidate workflow =="
fd -a 'build.yml$' .github/workflows 2>/dev/null || true

echo "== build.yml relevant lines =="
if [ -f .github/workflows/build.yml ]; then
  nl -ba .github/workflows/build.yml | sed -n '1,140p'
fi

echo "== workflow files outline =="
if [ -d .github/workflows ]; then
  for f in .github/workflows/*.yml .github/workflows/*.yaml; do
    [ -f "$f" ] || continue
    echo "--- $f ---"
    rg -n "pull_request|push|permissions:|contents:|actions/checkout|persist-credentials|cabix/install-nix-action|nixPath|nix|eval" "$f" || true
  done
fi

Repository: mailtrap/mailtrap-nur

Length of output: 302


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== build.yml contents =="
awk '{printf "%6d  %s\n", NR, $0}' .github/workflows/build.yml

echo "== workflow permissions and triggers =="
for f in .github/workflows/*.yml .github/workflows/*.yaml; do
  [ -f "$f" ] || continue
  echo "--- $f ---"
  awk '{printf "%6d  %s\n", NR, $0}' "$f"
done

echo "== pull_request refs in workflows =="
grep -RInE "pull_request:|pull requests|pull_request" .github/workflows || true

Repository: mailtrap/mailtrap-nur

Length of output: 3915


🌐 Web query:

actions/checkout persist-credentials default pull_request cache token persisted git config user

💡 Result:

In the actions/checkout GitHub Action, persist-credentials is a boolean configuration option that determines whether the authentication token or SSH key used to fetch the repository is configured within the local git config [1][2]. The default value for persist-credentials is true [1][3]. When enabled, this allows subsequent steps in your GitHub Actions workflow to run authenticated git commands (such as git push or git fetch) without needing to manually re-authenticate [1][4]. Regarding technical implementation and security: - Historical Behavior: In earlier versions of the action, these credentials were saved directly into the local.git/config file [1][5]. - Recent Updates (v6+): Starting with version 6.0.0, the action was updated to store these credentials in a separate file under the $RUNNER_TEMP directory instead of the local git config, providing improved credential security [1][5]. - Lifecycle: The persisted credentials are automatically removed during the post-job cleanup step [1][4]. - Opt-out: You can disable this behavior by explicitly setting persist-credentials to false in your workflow definition [1][4]. - Cache Warning: It is important to distinguish this from GitHub's cache action. Users are strictly advised not to store sensitive information, such as access tokens or credentials, in cached paths, as these caches may be accessible by anyone with read access to the repository, including those who can open pull requests [6].

Citations:


🌐 Web query:

actions/checkout v5 default persist-credentials input documentation

💡 Result:

In actions/checkout v5, the persist-credentials input has a default value of true [1][2]. This setting determines whether the authentication token or SSH key used to check out the repository is configured in the local git configuration [3][4]. When enabled (true), it allows your workflow scripts to execute authenticated git commands (such as git fetch or git push) automatically [3][5]. The token is removed during the post-job cleanup phase [3][5]. To opt out of this behavior, you can set persist-credentials to false in your workflow file [3][5].

Citations:


Disable checkout credential persistence.

This workflow runs on pull requests and evaluates repository-controlled Nix code. Set actions/checkout to persist-credentials: false and narrow workflow permissions to read-only where possible.

Proposed fix
       - name: Checkout repository
         uses: actions/checkout@v5
+        with:
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout repository
uses: actions/checkout@v5
- name: Install nix
uses: cachix/install-nix-action@v31
with:
nix_path: "${{ matrix.nixPath }}"
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install nix
uses: cachix/install-nix-action@v31
with:
nix_path: "${{ matrix.nixPath }}"
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
🧰 Tools
🪛 zizmor (1.28.0)

[warning] 22-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build.yml around lines 22 - 30, Update the checkout step
using actions/checkout@v5 to set persist-credentials to false, and restrict the
workflow’s permissions to read-only where possible while preserving the existing
build behavior.

Source: Linters/SAST tools

Comment thread flake.nix
Comment thread README.md
Comment on lines +21 to +40
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
mailtrap-nur.url = "github:mailtrap/mailtrap-nur";
};

outputs = { nixpkgs, mailtrap-nur, ... }:
let
system = "aarch64-darwin"; # or x86_64-linux, …
pkgs = import nixpkgs {
inherit system;
overlays = [ mailtrap-nur.overlays.default ];
};
in
{
# pkgs.mailtrap-local
};
}
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the package in the flake example.

As written, the example’s outputs attrset contains no actual package output; # pkgs.mailtrap-local is only a comment. A user copying this snippet cannot build or run mailtrap-local from the resulting flake.

Proposed fix
-  outputs = { nixpkgs, mailtrap-nur, ... }:
+  outputs = { nixpkgs, mailtrap-nur, ... }:
    let
      system = "aarch64-darwin"; # or x86_64-linux, …
      pkgs = import nixpkgs {
        inherit system;
        overlays = [ mailtrap-nur.overlays.default ];
      };
    in
    {
-      # pkgs.mailtrap-local
+      packages.${system}.mailtrap-local = pkgs.mailtrap-local;
+      packages.${system}.default = pkgs.mailtrap-local;
    };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
mailtrap-nur.url = "github:mailtrap/mailtrap-nur";
};
outputs = { nixpkgs, mailtrap-nur, ... }:
let
system = "aarch64-darwin"; # or x86_64-linux, …
pkgs = import nixpkgs {
inherit system;
overlays = [ mailtrap-nur.overlays.default ];
};
in
{
# pkgs.mailtrap-local
};
}
```
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 21 - 40, Update the README flake example’s outputs
attrset to expose mailtrap-local as an actual package output, using the existing
pkgs.mailtrap-local package and the configured system attribute so copied flakes
can build or run it.

Comment thread README.md
Comment on lines +52 to +57
```nix
mailtrap = import (builtins.fetchTarball "https://github.com/mailtrap/mailtrap-nur/archive/main.tar.gz") {
inherit pkgs;
};
# mailtrap.mailtrap-local
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the non-flake example valid Nix syntax.

The assignment cannot appear at the top level as shown. Wrap it in let ... in (or an attribute set) so users can copy the example directly.

Proposed fix
- mailtrap = import (builtins.fetchTarball "https://github.com/mailtrap/mailtrap-nur/archive/main.tar.gz") {
-   inherit pkgs;
- };
- # mailtrap.mailtrap-local
+ let
+   mailtrap = import (builtins.fetchTarball "https://github.com/mailtrap/mailtrap-nur/archive/main.tar.gz") {
+     inherit pkgs;
+   };
+ in
+   mailtrap.mailtrap-local
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 52 - 57, Update the non-flake Nix example around the
mailtrap binding so the mailtrap assignment is valid top-level syntax, wrapping
it in a let...in expression or attribute set while preserving the existing pkgs
inheritance and mailtrap.mailtrap-local usage.

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.

2 participants