mise-nix Plugin

repository·main·Indexed 42 days ago

https://github.com/jbadeau/mise-nix

A Mise plugin that integrates the Nix ecosystem into development workflows. It provides access to over 100,000 packages from nixpkgs, supports installation via nixhub.io and Nix Flakes, and enables the installation of VSCode, Neovim, and JetBrains plugins through Nix. Requires Mise v2025.7.8 or newer and Nix with nix-command and flakes enabled.

Tokens
2.2K
Snippets
9
Records
10
Agent score
3%

What's inside mise-nix

  1. Install Nix packages using Standard Packages

    main

    The recommended way to install packages is via nixhub.io, which provides pre-built, cached packages. You can install the latest version, a specific version, or use version aliases.

    Commands:

    • List available versions: mise ls-remote nix:<package>
    • Install latest: mise install nix:<package>
    • Install specific version: mise install nix:<package>@<version>
    • Install via alias: mise install nix:<package>@stable
    # List available versions
    mise ls-remote nix:hello
    
    # Install latest version
    mise install nix:hello
    
    # Install specific version
    mise install nix:hello@2.12.1
    
    # Install using version aliases
    mise install nix:hello@stable
  2. Install the mise-nix plugin

    main

    To use Nix packages with Mise, install the nix plugin from the official repository.

    Prerequisites:

    • Mise v2025.7.8 or newer
    • Nix installed on your system

    Nix Configuration: You must enable nix-command and flakes in your ~/.config/nix/nix.conf for the plugin to function correctly:

    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=
    mise plugin install nix https://github.com/jbadeau/mise-nix.git
  3. Install Local Flakes

    main

    To install a package from a local Flake directory, you must enable the MISE_NIX_ALLOW_LOCAL_FLAKES environment variable.

    export MISE_NIX_ALLOW_LOCAL_FLAKES=true
    mise install "nix:mytool@./my-project"
  4. Install packages from Flake references

    main

    You can install packages directly from Nix Flakes using various URI formats.

    Important: Character Workarounds Mise rejects colons (:) in version strings. When using Flake references, you must use these specific prefixes instead of colons:

    • Use github+owner/repo instead of github:owner/repo
    • Use gitlab+group/project instead of gitlab:group/project
    • Use https+host/repo.git instead of git+https://host/repo.git
    • Use ssh+git@host/repo.git instead of git+ssh://git@host/repo.git
    # GitHub
    mise install "nix:hello@github+nixos/nixpkgs"
    mise install "nix:hello@nixos/nixpkgs#hello"
    
    # GitLab
    mise install "nix:mytool@gitlab+group/project"
    
    # Git HTTPS URLs
    mise install "nix:hello@https+github.com/nixos/nixpkgs.git#hello"
    
    # Git SSH URLs
    mise install "nix:mytool@ssh+git@github.com/owner/repo.git#default"
  5. Install Neovim Plugins via Nix

    main

    Install Neovim plugins from the nixpkgs vimPlugins namespace.

    Behavior:

    • Plugins are automatically symlinked to ~/.local/share/nvim/site/pack/nix/start/.
    • They are auto-loaded by Neovim via the native :h packages mechanism (no init.lua config required).
    • They use a separate nix pack namespace, making them compatible with plugin managers like lazy.nvim or packer.nvim.
    # Install nvim-treesitter
    mise install "nix:neovim+install=vimPlugins.nvim-treesitter"
    
    # Install plenary.nvim
    mise install "nix:neovim+install=vimPlugins.plenary-nvim"
    
    # Install telescope.nvim
    mise install "nix:neovim+install=vimPlugins.telescope-nvim"
  6. Configure CI Caching for mise-nix

    main

    By default, mise-nix symlinks install paths to the Nix store. Because Nix store paths are not preserved in standard CI caches, you should set MISE_NIX_INSTALL_MODE=copy. This copies outputs into the install directory, making them self-contained and cacheable.

    GitHub Actions Example: Set MISE_NIX_INSTALL_MODE: copy and cache the ~/.local/share/mise/installs directory.

    GitLab CI Example: Set variables: MISE_NIX_INSTALL_MODE: copy and cache the ~/.local/share/mise/installs directory.

    # GitHub Actions
    env:
      MISE_NIX_INSTALL_MODE: copy
    
    steps:
      - uses: actions/cache@v4
        with:
          path: ~/.local/share/mise/installs
          key: mise-nix-${{ hashFiles('mise.toml') }}
      - run: mise install
  7. Install JetBrains Plugins via Nix

    main

    Install plugins from the nix-jetbrains-plugins repository.

    Requirements:

    • The system architecture (e.g., x86_64-linux, aarch64-darwin) in the package name must match your current system.
    • Plugins are built directly from the nix-jetbrains-plugins flake (they do not use nixhub).
    • Action Required: You must restart your IDE after installation to activate the plugin.

    Note: Plugin IDs can be found at the bottom of JetBrains Marketplace pages.

    # Install File Watchers plugin for IntelliJ IDEA Ultimate (Linux)
    mise install "nix:jetbrains+install=jetbrains-plugins.x86_64-linux.idea-ultimate.2024.3.com.intellij.plugins.watcher"
    
    # Install File Watchers plugin for IntelliJ IDEA Ultimate (macOS)
    mise install "nix:jetbrains+install=jetbrains-plugins.aarch64-darwin.idea-ultimate.2024.3.com.intellij.plugins.watcher"
    
    # Install GitToolBox for GoLand
    mise install "nix:jetbrains+install=jetbrains-plugins.x86_64-linux.goland.2024.3.zielu.gittoolbox"
    
    # Install Database Tools for WebStorm
    mise install "nix:jetbrains+install=jetbrains-plugins.x86_64-linux.webstorm.2024.3.com.intellij.database"
  8. Handle Unfree and Insecure Nix Packages

    main

    Some packages in nixpkgs are marked as unfree or insecure. You can opt-in using either MISE_NIX environment variables (recommended) or native Nix environment variables.

    Unfree Packages:

    • Use export MISE_NIX_ALLOW_UNFREE=true (sets NIXPKGS_ALLOW_UNFREE=1)
    • Or export NIXPKGS_ALLOW_UNFREE=1

    Insecure Packages:

    • Use export MISE_NIX_ALLOW_INSECURE=true (sets NIXPKGS_ALLOW_INSECURE=1)
    • Or export NIXPKGS_ALLOW_INSECURE=1
    # Unfree example
    export MISE_NIX_ALLOW_UNFREE=true
    mise install nix:discord
    
    # Insecure example
    export MISE_NIX_ALLOW_INSECURE=true
    mise install nix:some-package
  9. Configure mise-nix via Environment Variables

    main

    The following environment variables control the behavior of the mise-nix plugin:

    VariableDescription
    MISE_NIX_ALLOW_UNFREESet to true to allow unfree packages (auto-sets NIXPKGS_ALLOW_UNFREE=1)
    MISE_NIX_ALLOW_INSECURESet to true to allow insecure packages (auto-sets NIXPKGS_ALLOW_INSECURE=1)
    MISE_NIX_ALLOW_LOCAL_FLAKESSet to true to enable local flake references
    MISE_NIX_NIXHUB_BASE_URLCustom nixhub.io URL
    MISE_NIX_NIXPKGS_REPO_URLCustom nixpkgs repository URL
    MISE_NIX_ENV_MODEEnvironment variable resolution: auto (default), dev-env, or path-only
    MISE_NIX_LINK_PROFILEMulti-output link profile: runtime (default) or dev
    MISE_NIX_LINK_PATHSOverride link profile with comma-separated paths (e.g. /bin,/share/man)
    MISE_NIX_INSTALL_MODEInstall strategy: symlink (default) or copy (for CI)