Matrix AI public Nix package and module distribution flake.
This repository exists to provide one coherent producer interface for Matrix AI Nix consumers.
Without this layer, teams consume many independent flakes directly and drift over time on pins, output shapes, and composition behavior. Here, curation is intentionally centralized so downstream repositories can depend on one stable contract instead of many floating contracts.
In short:
- this repo owns what is distributed and how it is composed,
- downstream repos own environment-specific rollout and runtime operations.
Technical contract summary:
- public API is the
outputsshape inflake.nix, - canonical constructor path is
lib.mkPkgs, - constrained
builtins.getFlakeis allowed only under policy (path allowlist, commit pinning, and check enforcement).
Allowlist metadata is maintained in checks/policy-pin-allowlist.nix, while enforcement logic lives in checks/policy-pin.nix.
The public contract is the outputs shape in flake.nix.
| Output | Purpose |
|---|---|
lib |
Public helper scope from lib/default.nix; includes upstream nixpkgs.lib under lib.lib, source filtering helpers under lib.gitignore, and constructor helpers such as lib.mkPkgs. |
overlays.default |
Canonical project overlay from overlays/default.nix. |
legacyPackages.${system} |
Compatibility package set produced via lib.mkPkgs. |
packages.${system} |
Curated flat top-level installables projection from pkgs/default.nix (exportTopLevel). |
templates.default |
Minimal OSS starter template (alias of templates.oss). |
templates.oss |
Minimal OSS starter template using flake-parts and nixpkgs-matrixai.lib.mkPkgs. |
nixosModules.default |
Public aggregate NixOS module entrypoint. |
nixosModules.procpath |
Public NixOS Procpath module entrypoint. |
homeModules.default |
Public Home Manager module entrypoint. |
checks.${system} |
Local contract/policy/smoke gates consumed by nix flake check. |
devShells.${system}.default |
Developer shell for local repository maintenance workflows. |
Current policy is explicit single-system materialization (x86_64-linux).
Initialize a new project using the exported starter:
nix flake init -t github:MatrixAI/nixpkgs-matrixai#ossEquivalent alias:
nix flake init -t github:MatrixAI/nixpkgs-matrixai#defaultThe template emits one minimal flake.nix that:
- uses flake-parts,
- imports
nixpkgs-matrixaifrom GitHub, - constructs
pkgsthroughnixpkgs-matrixai.lib.mkPkgs, - defines a small
devShellconsumingnixpkgs-matrixaipackages.
lib.mkPkgs is the canonical constructor for downstream composition.
Overlay ordering in lib/mkPkgs.nix is:
- upstream nixpkgs constructor,
- project default overlay,
- caller-provided overlays.
Implementation shape:
mkPkgsUpstream {
inherit system config;
overlays = [ overlay ] ++ overlays;
}This flake pins and re-exports hercules-ci/gitignore.nix under lib.gitignore.
gitignore.nix is a Nix library helper, not an installable package. Its main helpers are:
lib.gitignore.gitignoreSource: filter a local source tree using Git ignore rules.lib.gitignore.gitignoreFilter: produce a composable source filter function.
Downstream flakes that already consume this repository should prefer the centralized helper unless they need independent pin control:
{ inputs, ... }:
let
inherit (inputs.nixpkgs-matrixai.lib.gitignore) gitignoreSource;
in
{
packages.x86_64-linux.example = pkgs.stdenv.mkDerivation {
pname = "example";
version = "0.1.0";
src = gitignoreSource ./.;
};
}Projects should add hercules-ci/gitignore.nix as their own input only when they deliberately need a separate version or different nixpkgs follow policy.
If a wrapper producer flake such as nixpkgs-matrixai-private is the only Matrix AI input pinned by a downstream repository, that wrapper must explicitly re-export this public library surface, for example by exposing lib.gitignore from its own lib output. Flake outputs do not automatically pass through transitive input outputs.
pkgs/default.nix is the package registry and projection hub:
registry.topLevelmaps top-level package names to package files,registry.scopesmaps scoped package sets (currentlypython3Packages),exportTopLevelprojects flat installables topackages.${system},overlaywires top-level + scoped entries intooverlays.default/legacyPackages.${system}.
nix build 'github:MatrixAI/nixpkgs-matrixai#packages.x86_64-linux.matrixai-public-hello'
nix build 'github:MatrixAI/nixpkgs-matrixai#legacyPackages.x86_64-linux.matrixai-public-hello'Enter the repository maintenance shell:
nix developThe shell is intentionally curated for this repository's maintenance workflows and includes tools like nix, git, jq, GNU text/core utilities, curl, and wget.
Use these as the standard local gates:
nix flake show path:. --no-write-lock-file
nix flake check path:. --no-write-lock-fileCurrent checks:
checks.${system}.contract-outputschecks.${system}.contract-packageschecks.${system}.contract-moduleschecks.${system}.policy-pinchecks.${system}.smoke-hello
Use this when you need to inspect the upstream nixpkgs revision that this
repository currently pins.
Start a REPL from the repository root:
nix replLoad this flake using path-source semantics:
:lf path:.Then inspect the upstream input and its resolved source:
inputs.nixpkgs
inputs.nixpkgs.rev
inputs.nixpkgs.outPath
inputs.nixpkgs.lib.versionInstantiate the pinned upstream package set directly when you need to inspect packages as they exist before this repository's overlay and constructor logic:
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; }
pkgs.lib.version
pkgs.hello.version
pkgs.stdenv.hostPlatform.systemCompare that with this repository's exported package surfaces when you need to
see what the public flake contract exposes after lib.mkPkgs composition:
self.legacyPackages.x86_64-linux.lib.version
self.packages.x86_64-linux.matrixai-public-helloUse path:. for high-churn local exploration because it reads the working tree
path directly. If you want parity with Git-backed flake acquisition, load the
flake with :lf . instead and stage newly added files first:
:lf .The flake.lock file remains the baseline pinned state for non-overridden
inputs. Temporary --override-input usage supersedes the selected input edge in
memory for that invocation only; it is not a persistent lock update.
For one-off shell checks outside the REPL, quote flake refs that contain #:
nix eval 'path:.#legacyPackages.x86_64-linux.lib.version'Use:
./scripts/nixpkgs-pin-policy.sh info
./scripts/nixpkgs-pin-policy.sh info --tracking-ref refs/heads/nixos-unstable
./scripts/nixpkgs-pin-policy.sh update <commit-sha>update rewrites the managed nixpkgs block in flake.nix, refreshes flake.lock, and verifies rev consistency.
External builtins.getFlake usage is allowlisted and enforced by checks.${system}.policy-pin.
Allowlist metadata lives in:
checks/policy-pin-allowlist.nix
These scripts improve maintainer decision-making inside this repository. They are ergonomics helpers, not the contract authority (the contract authority remains flake outputs and checks).
- External pin lifecycle visibility:
./scripts/external-pin-lifecycle.sh info
./scripts/external-pin-lifecycle.sh info --tracking-ref refs/heads/mainReports include:
- allowlisted entry metadata,
- pinned commit date,
- pin age in days,
- review cadence and due state,
- tracking branch head SHA visibility.
- Package version intelligence for policy decisions:
./scripts/package-version-intel.sh current vscodium
./scripts/package-version-intel.sh compare vscodium --candidate-ref refs/heads/nixos-unstable
./scripts/package-version-intel.sh compare matrixai-public-hello --system x86_64-linux --candidate-ref <commit-sha>Reports include current pinned metadata and candidate metadata (version, pname, name) plus a simple changed/unchanged status.
- Add or update package definitions under
pkgs/top-levelorpkgs/development/python-modules. - Register package paths in
pkgs/default.nixunder:registry.topLevel, orregistry.scopes.<scopeName>.
- Validate both surfaces:
packages.${system}viaexportTopLevel,legacyPackages.${system}via overlay composition.
Useful checks:
nix flake show path:. --no-write-lock-file
nix build '.#packages.x86_64-linux.matrixai-public-hello'
nix build '.#legacyPackages.x86_64-linux.matrixai-public-hello'Stable exported module entrypoints are:
nixosModules.defaultnixosModules.procpathhomeModules.default
The public NixOS surfaces are composed from one internal registry seam:
modules/nixos/module-list.nixis the internal list of NixOS leaf-module paths.modules/nixos/default.nixaggregates that list intonixosModules.default.modules/default.nixprojects named module exports such asnixosModules.procpathfrom the same list.
Consumers should use the exported flake module surfaces above rather than the internal registry files directly.
Current public behavior:
nixosModules.defaultaggregates the registered NixOS leaf modules.nixosModules.procpathprovidesprograms.procpath.homeModules.defaultremains a placeholder until a Home Manager-specific module exists.
Example NixOS usage:
{
imports = [
inputs.nixpkgs-matrixai.nixosModules.procpath
];
programs.procpath = {
enable = true;
};
}When iterating with nixpkgs-matrixai-private, run from the private checkout:
nix flake check --override-input nixpkgs-matrixai ../nixpkgs-matrixaiFor lock-based validation in private:
nix flake update nixpkgs-matrixai
nix flake check