Skip to content

jbadeau/mise-nix

Repository files navigation

mise-nix

mise-nix is a backend plugin for Mise that allows you to install and manage packages using Nix.

Why use this plugin?

  • πŸš€ Access to over 100,000 packages
  • ⚑ Better Nix developer experience
  • πŸ“¦ Install VSCode extensions

Prerequisites

Installation

mise plugin install nix https://github.com/jbadeau/mise-nix.git

Quick Start

# List available versions
mise ls-remote nix:hello

# Install version
mise install nix:[email protected]

Complete Usage Guide

Standard Nixpkgs Packages (Recommended - Fast & Cached)

Uses nixhub.io for pre-built, cached packages:

# Latest version
mise install nix:hello

# Specific version
mise install nix:[email protected]

# Version aliases
mise install nix:hello@stable

GitHub Sources

Uses GitHub shorthand for fast access:

# From nixpkgs GitHub repository (default branch)
mise install "nix:hello@github+nixos/nixpkgs"

# From specific branch
mise install "nix:hello@github+nixos/nixpkgs/nixos-unstable"

# From specific release/tag
mise install "nix:hello@github+nixos/nixpkgs?ref=23.11"

# From specific commit SHA
mise install "nix:hello@github+nixos/nixpkgs/abc123def456"

# With revision parameter
mise install "nix:hello@github+nixos/nixpkgs?rev=abc123def456"

# With subdirectory (flake in subdirectory)
mise install "nix:mytool@github+company/monorepo/main?dir=packages/tool"

# GitHub shorthand syntax (alternative)
mise install "nix:hello@nixos/nixpkgs#hello"

GitLab Sources

Uses GitLab shorthand:

# From GitLab repository
mise install "nix:mytool@gitlab+group/project"

Raw Git Sources

Uses full Git URLs for maximum compatibility:

# From raw git URL
mise install "nix:hello@git+https://github.com/nixos/nixpkgs.git"

Local Flakes (Experimental)

⚠️ Experimental Feature: Local flake support is experimental and subject to change.

For development with local Nix flakes:

export MISE_NIX_ALLOW_LOCAL_FLAKES=true

# Local development
mise install "nix:mytool@./my-project"

VSCode Extensions (Experimental)

Install VSCode extensions using vscode+install syntax. Extensions are installed by creating a VSIX package from the Nix store and installing it in VSCode:

mise install "nix:vscode+install=vscode-extensions.golang.go"

The extension files are symlinked for access, and a VSIX package is created and installed in VSCode for IDE integration.

Known Limitations

Due to mise's argument parsing limitations, some Git URL formats require workarounds:

Git Hosting Shorthand Limitations

# ❌ Not supported (direct prefixes with colons)
mise install nix:hello@github:nixos/nixpkgs#hello
mise install nix:mytool@gitlab:group/project#default

# βœ… Use these workarounds instead
mise install "nix:hello@github+nixos/nixpkgs"
mise install "nix:mytool@gitlab+group/project"

Git URL Workarounds

Mise rejects git+ssh:// and git+https:// as invalid prefixes, so use these alternatives:

Prefix Converts To Use Case
ssh+git@host/repo.git git+ssh://git@host/repo.git SSH access
https+user:token@host/repo.git git+https://user:token@host/repo.git HTTPS auth
# ❌ These don't work due to mise parsing
mise install "nix:hello@git+ssh://[email protected]/nixos/nixpkgs.git"
mise install "nix:hello@git+https://user:[email protected]/nixos/nixpkgs.git"

# βœ… Use these workarounds instead
mise install "nix:hello@[email protected]/nixos/nixpkgs.git"
mise install "nix:hello@https+user:[email protected]/nixos/nixpkgs.git"

Settings

# Custom NixHub instance
export MISE_NIX_NIXHUB_BASE_URL="https://custom-nixhub.example.com"

# Custom NixPkgs repository
export MISE_NIX_NIXPKGS_REPO_URL="https://github.com/custom/nixpkgs"

# Enable local flakes (security risk)
export MISE_NIX_ALLOW_LOCAL_FLAKES=true

# Enterprise Git instances
export MISE_NIX_GITHUB_ENTERPRISE_URL="github.company.com"
export MISE_NIX_GITLAB_ENTERPRISE_URL="gitlab.company.com"

Nix Configuration

Important: Add to ~/.config/nix/nix.conf for optimal performance:

experimental-features = nix-command flakes
substituters = https://cache.nixos.org https://nix-community.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:0VI8sF6Vsp2Jxw8+OFeVfYVdIY7X+GTtY+lR78QAbXs=

Without this configuration, package installations will be significantly slower as Nix will build from source instead of using pre-built binaries.

Troubleshooting

"Package not found": Check package exists on NixHub

"Invalid prefix": Use github+ syntax instead of direct github:

"Local flakes disabled": Set MISE_NIX_ALLOW_LOCAL_FLAKES=true

Build failures: Ensure Nix experimental features are enabled

Slow installs: Avoid full git URLs for large repositories

VSCode extensions not showing: Restart VSCode after installing extensions

Development

# Setup
mise init # Install and link

# Tests
mise test # Unit tests
mise e2e  # Integration tests

About

A backend plugin for Mise that allows you to install and manage packages using Nix

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •