Skip to content

Commit 3b6f27f

Browse files
jbadeaujbadeau
authored andcommitted
feat: Minor improvements
1 parent 46ef03e commit 3b6f27f

28 files changed

Lines changed: 561 additions & 558 deletions

.github/workflows/ci.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,33 @@ jobs:
3131
curl https://mise.run | sh
3232
echo "$HOME/.local/bin" >> $GITHUB_PATH
3333
34-
# Install tools from mise.toml (node, lua)
35-
- name: Install mise tools
36-
run: mise install
37-
38-
- run: npm ci --legacy-peer-deps
39-
4034
- name: Install nix
41-
uses: cachix/install-nix-action@v23
35+
uses: cachix/install-nix-action@v30
4236
with:
37+
nix_path: nixpkgs=channel:nixos-unstable
4338
extra_nix_config: |
4439
experimental-features = nix-command flakes
4540
accept-flake-config = true
4641
47-
# Run mise tests
42+
# Run mise init first to link the nix plugin
4843
- name: Run mise init
4944
run: mise init
5045

46+
# Install tools from mise.toml (node, lua, nix:shellspec)
47+
- name: Install mise tools
48+
run: mise install
49+
50+
# Install VSCode and virtual display for extension tests
51+
- name: Install VSCode and dependencies
52+
run: |
53+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
54+
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
55+
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
56+
sudo apt update
57+
sudo apt install -y code xvfb
58+
59+
- run: npm ci --legacy-peer-deps
60+
5161
# Run tests and build (use mise to ensure tools are in PATH)
5262
- name: Run tests
5363
run: mise exec -- npx nx run-many -t lint test e2e
@@ -72,23 +82,33 @@ jobs:
7282
curl https://mise.run | sh
7383
echo "$HOME/.local/bin" >> $GITHUB_PATH
7484
75-
# Install tools from mise.toml (node, lua)
76-
- name: Install mise tools
77-
run: mise install
78-
79-
- run: npm ci --legacy-peer-deps
80-
8185
- name: Install nix
82-
uses: cachix/install-nix-action@v23
86+
uses: cachix/install-nix-action@v30
8387
with:
88+
nix_path: nixpkgs=channel:nixos-unstable
8489
extra_nix_config: |
8590
experimental-features = nix-command flakes
8691
accept-flake-config = true
8792
88-
# Run mise tests
93+
# Run mise init first to link the nix plugin
8994
- name: Run mise init
9095
run: mise init
9196

97+
# Install tools from mise.toml (node, lua, nix:shellspec)
98+
- name: Install mise tools
99+
run: mise install
100+
101+
# Install VSCode and virtual display for extension tests
102+
- name: Install VSCode and dependencies
103+
run: |
104+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
105+
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
106+
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
107+
sudo apt update
108+
sudo apt install -y code xvfb
109+
110+
- run: npm ci --legacy-peer-deps
111+
92112
# Run tests and build (use mise to ensure tools are in PATH)
93113
- name: Run tests
94114
run: mise exec -- npx nx run-many -t lint test e2e

CHANGELOG.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# `mise-nix`
22

3-
`mise-nix` is a backend plugin for [Mise](https://github.com/jdx/mise) that allows you to install and manage packages using [Nix](https://nixos.org/).
3+
A [Mise](https://github.com/jdx/mise) plugin that brings the power of the [Nix](https://nixos.org/) ecosystem to your development workflow.
44

5-
## Why use this plugin?
5+
## Features
66

7-
- 🚀 Access to over 100,000 packages
8-
- ⚡ Better Nix developer experience
9-
- 📦 Install VSCode extensions
7+
- 🚀 **100,000+ packages** from nixpkgs
8+
- 📦 **VSCode extensions** support
109

1110
## Prerequisites
1211

@@ -29,9 +28,9 @@ mise ls-remote nix:hello
2928
mise install nix:hello@2.12.1
3029
```
3130

32-
## Complete Usage Guide
31+
## Usage
3332

34-
### Standard Nixpkgs Packages (Recommended - Fast & Cached)
33+
### Standard Packages (Recommended)
3534

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

@@ -46,152 +45,56 @@ mise install nix:hello@2.12.1
4645
mise install nix:hello@stable
4746
```
4847

49-
### GitHub Sources
50-
51-
Uses GitHub shorthand for fast access:
48+
### Flake References
5249

5350
```sh
54-
# From nixpkgs GitHub repository (default branch)
51+
# GitHub
5552
mise install "nix:hello@github+nixos/nixpkgs"
56-
57-
# From specific branch
58-
mise install "nix:hello@github+nixos/nixpkgs/nixos-unstable"
59-
60-
# From specific release/tag
61-
mise install "nix:hello@github+nixos/nixpkgs?ref=23.11"
62-
63-
# From specific commit SHA
64-
mise install "nix:hello@github+nixos/nixpkgs/abc123def456"
65-
66-
# With revision parameter
67-
mise install "nix:hello@github+nixos/nixpkgs?rev=abc123def456"
68-
69-
# With subdirectory (flake in subdirectory)
70-
mise install "nix:mytool@github+company/monorepo/main?dir=packages/tool"
71-
72-
# GitHub shorthand syntax (alternative)
7353
mise install "nix:hello@nixos/nixpkgs#hello"
74-
```
75-
76-
### GitLab Sources
7754

78-
Uses GitLab shorthand:
79-
80-
```sh
81-
# From GitLab repository
55+
# GitLab
8256
mise install "nix:mytool@gitlab+group/project"
83-
```
8457

85-
### Raw Git Sources
86-
87-
Uses full Git URLs for maximum compatibility:
88-
89-
```sh
90-
# From raw git URL
58+
# Git URLs
9159
mise install "nix:hello@git+https://github.com/nixos/nixpkgs.git"
9260
```
9361

94-
### Local Flakes (Experimental)
95-
96-
⚠️ **Experimental Feature**: Local flake support is experimental and subject to change.
97-
98-
For development with local Nix flakes:
62+
### Local Flakes
9963

10064
```sh
10165
export MISE_NIX_ALLOW_LOCAL_FLAKES=true
102-
103-
# Local development
10466
mise install "nix:mytool@./my-project"
10567
```
10668

107-
### VSCode Extensions (Experimental)
108-
109-
Install VSCode extensions using vscode+install syntax. Extensions are installed by creating a VSIX package from the Nix store and installing it in VSCode:
69+
### VSCode Extensions
11070

11171
```sh
11272
mise install "nix:vscode+install=vscode-extensions.golang.go"
11373
```
11474

115-
The extension files are symlinked for access, and a VSIX package is created and installed in VSCode for IDE integration.
75+
## Limitations
11676

117-
## Known Limitations
77+
Use `github+` instead of `github:` due to mise parsing limitations.
11878

119-
Due to mise's argument parsing limitations, some Git URL formats require workarounds:
79+
## Configuration
12080

121-
### Git Hosting Shorthand Limitations
81+
Environment variables:
12282

12383
```sh
124-
# ❌ Not supported (direct prefixes with colons)
125-
mise install nix:hello@github:nixos/nixpkgs#hello
126-
mise install nix:mytool@gitlab:group/project#default
127-
128-
# ✅ Use these workarounds instead
129-
mise install "nix:hello@github+nixos/nixpkgs"
130-
mise install "nix:mytool@gitlab+group/project"
84+
export MISE_NIX_ALLOW_LOCAL_FLAKES=true # Enable local flakes
85+
export MISE_NIX_NIXHUB_BASE_URL="https://custom.nixhub.io" # Custom nixhub
13186
```
13287

133-
### Git URL Workarounds
134-
135-
Mise rejects `git+ssh://` and `git+https://` as invalid prefixes, so use these alternatives:
88+
## Nix Setup
13689

137-
| Prefix | Converts To | Use Case |
138-
|--------|-------------|----------|
139-
| `ssh+git@host/repo.git` | `git+ssh://git@host/repo.git` | SSH access |
140-
| `https+user:token@host/repo.git` | `git+https://user:token@host/repo.git` | HTTPS auth |
141-
142-
```sh
143-
# ❌ These don't work due to mise parsing
144-
mise install "nix:hello@git+ssh://git@github.com/nixos/nixpkgs.git"
145-
mise install "nix:hello@git+https://user:token@github.com/nixos/nixpkgs.git"
146-
147-
# ✅ Use these workarounds instead
148-
mise install "nix:hello@ssh+git@github.com/nixos/nixpkgs.git"
149-
mise install "nix:hello@https+user:token@github.com/nixos/nixpkgs.git"
150-
```
151-
152-
## Settings
153-
154-
```sh
155-
# Custom NixHub instance
156-
export MISE_NIX_NIXHUB_BASE_URL="https://custom-nixhub.example.com"
157-
158-
# Custom NixPkgs repository
159-
export MISE_NIX_NIXPKGS_REPO_URL="https://github.com/custom/nixpkgs"
160-
161-
# Enable local flakes (security risk)
162-
export MISE_NIX_ALLOW_LOCAL_FLAKES=true
163-
164-
# Enterprise Git instances
165-
export MISE_NIX_GITHUB_ENTERPRISE_URL="github.company.com"
166-
export MISE_NIX_GITLAB_ENTERPRISE_URL="gitlab.company.com"
167-
```
168-
169-
## Nix Configuration
170-
171-
**Important:** Add to `~/.config/nix/nix.conf` for optimal performance:
90+
Add to `~/.config/nix/nix.conf`:
17291

17392
```ini
17493
experimental-features = nix-command flakes
17594
substituters = https://cache.nixos.org https://nix-community.cachix.org
17695
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:0VI8sF6Vsp2Jxw8+OFeVfYVdIY7X+GTtY+lR78QAbXs=
17796
```
17897

179-
Without this configuration, package installations will be significantly slower as Nix will build from source instead of using pre-built binaries.
180-
181-
## Troubleshooting
182-
183-
**"Package not found"**: Check package exists on [NixHub](https://www.nixhub.io)
184-
185-
**"Invalid prefix"**: Use `github+` syntax instead of direct `github:`
186-
187-
**"Local flakes disabled"**: Set `MISE_NIX_ALLOW_LOCAL_FLAKES=true`
188-
189-
**Build failures**: Ensure Nix experimental features are enabled
190-
191-
**Slow installs**: Avoid full git URLs for large repositories
192-
193-
**VSCode extensions not showing**: Restart VSCode after installing extensions
194-
19598
## Development
19699

197100
```sh

hooks/backend_list_versions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function PLUGIN:BackendListVersions(ctx)
1919
local current_os = platform.normalize_os(RUNTIME.osType)
2020
local current_arch = RUNTIME.archType:lower()
2121

22-
local success, data, response = nixhub.fetch_metadata_cached(tool, 3600)
22+
local success, data, response = nixhub.fetch_metadata(tool)
2323

2424
-- Validate tool metadata and throw error if not found
2525
nixhub.validate_metadata(success, data, tool, response)

lib/cmd.lua

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)