Skip to content

Support sparse checkout for package subdirectories #1191

Description

@ahmet-cetinkaya

Problem

NUR supports selecting a package entry point below a repository root via the file field, for example:

{
  "repos": {
    "example": {
      "url": "https://github.com/example/dotfiles",
      "file": "nixos/pkgs/nur.nix"
    }
  }
}

This controls evaluation, but NUR still fetches the entire Git repository. For monorepos such as dotfiles repositories, that can pull unrelated configuration, history, and large files even though only one package subtree is needed.

Proposed solution

Add an optional manifest field such as dir / subdirectory that limits the fetched checkout to a repository-relative directory (for example through Git sparse checkout, where supported). NUR could then evaluate default.nix within that directory, or resolve file relative to it.

Example:

{
  "repos": {
    "example": {
      "url": "https://github.com/example/dotfiles",
      "dir": "nixos/pkgs",
      "file": "nur.nix"
    }
  }
}

If sparse checkout is not feasible for the current fetch/update implementation, documenting that file changes only the evaluation entry point—not the fetched repository—and recommending a dedicated package repository would still make this constraint clearer.

Related: #133

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions