Nix flake for mgrep - a calm, CLI-native way to semantically grep everything, like code, images, PDFs and more.
Features:
- Direct npm packaging from Mixedbread's official distribution
- Smart Home Manager detection with automatic symlink management
- Pre-built binaries via Garnix for instant installation
- Daily automated updates for new mgrep versions
- Linux and macOS support (x86_64 and aarch64)
Try without installing:
nix run github:dominicnunez/mgrep-nixInstall to your profile:
nix profile add github:dominicnunez/mgrep-nixThis flake uses Garnix for CI and binary caching. The nixConfig in flake.nix automatically configures the cache, so pre-built binaries are fetched without any manual setup.
If prompted to allow configuration from the flake, answer yes or add accept-flake-config = true to your Nix configuration.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
mgrep-nix.url = "github:dominicnunez/mgrep-nix";
};
outputs = { self, nixpkgs, mgrep-nix, ... }: {
# Your configuration here
};
}{ inputs, pkgs, ... }:
{
environment.systemPackages = [
inputs.mgrep-nix.packages.${pkgs.system}.default
];
}{ inputs, pkgs, ... }:
{
home.packages = [
inputs.mgrep-nix.packages.${pkgs.system}.default
];
}{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
mgrep-nix.url = "github:dominicnunez/mgrep-nix";
};
outputs = { self, nixpkgs, mgrep-nix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ mgrep-nix.overlays.default ];
};
in {
# pkgs.mgrep is now available
devShells.${system}.default = pkgs.mkShell {
buildInputs = [ pkgs.mgrep ];
};
};
}This package includes smart Home Manager detection. When Home Manager is detected, the package skips creating symlinks to respect your declarative configuration.
Detection methods:
HM_SESSION_VARSenvironment variable is set~/.config/home-managerdirectory exists/etc/profiles/per-user/$USERdirectory exists
Behavior:
- Home Manager detected: Skips symlink creation and cleans up any orphaned symlinks
- Home Manager absent: Creates
~/.local/bin/mgrepsymlink for convenience
Automatic cleanup: If you previously installed mgrep standalone (creating a ~/.local/bin/mgrep symlink) and later enable Home Manager, the package will automatically remove the orphaned symlink on first run to prevent PATH conflicts.
| Variable | Description |
|---|---|
MGREP_NIX_VERBOSE |
Set to 1 to enable Home Manager detection and symlink management messages |
Example:
export MGREP_NIX_VERBOSE=1If using nix profile add:
nix profile upgrade '.*mgrep.*'If using as a flake input:
nix flake update mgrep-nix
nixos-rebuild switch # or home-manager switchgit clone https://github.com/dominicnunez/mgrep-nix
cd mgrep-nix
nix develop # enters shell with dev tools
nix build
./result/bin/mgrep --versionThe update.sh script checks for new mgrep releases and updates version.json:
# Enter dev shell (provides required tools)
nix develop
# Check for updates (dry run)
./update.sh
# Update to latest version
./update.sh --updateThe script:
- Queries npm registry for the latest release
- Compares against current version in
version.json - With
--update: fetches hashes and updatesversion.json
A GitHub Actions workflow runs daily to check for new releases. When a new version is found, it automatically:
- Updates
version.jsonwith new version and hashes - Validates with
nix flake check - Pushes directly to main
.
├── flake.nix # Flake definition with outputs
├── flake.lock # Locked dependencies
├── package.nix # mgrep package derivation
├── package-lock.json # npm lockfile for reproducible builds
├── version.json # Current version and hashes
├── update.sh # Update detection and hash fetching script
├── README.md # This file
├── garnix.yaml # Garnix CI configuration
└── .github/workflows/
├── update.yml # Daily update workflow
└── ci.yml # Garnix build validation
This packaging is MIT-licensed.
mgrep is developed by Mixedbread. See their terms of service for usage terms.