WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Allow github: fetcher to fetch subtrees using the trees API #14715

@arianvp

Description

@arianvp

Is your feature request related to a problem?

It is overkill to pull in all of nixpkgs if you just want nixpkgs/lib. Currently we work around this by vendoring out lib out of the nixpkgs monorepo but I am proposing a more elegant solution:

Proposed solution

% sha=$(curl https://api.github.com/repos/NixOS/nixpkgs/git/trees/master:lib | jq -r .sha)
% curl -L https://github.com/NixOS/nixpkgs/archive/$sha.tar.gz -o $sha.tar.gz
% tar xzvf $sha.tar.gz
% ls nixpkgs-$sha
README.md		deprecated		generators.nix		network			tests
ascii-table.nix		derivations.nix		gvariant.nix		options.nix		trivial.nix
asserts.nix		fetchers.nix		kernel.nix		path			types.nix
attrsets.nix		fileset			licenses.nix		source-types.nix	versions.nix
cli.nix			filesystem.nix		lists.nix		sources.nix
customisation.nix	fixed-points.nix	meta.nix		strings-with-deps.nix
debug.nix		flake-version-info.nix	minfeatures.nix		strings.nix
default.nix		flake.nix		modules.nix		systems

We now have a tarball with just the lib subfolder!

Alternative solutions

The current solution is https://github.com/nix-community/nixpkgs.lib which is complex and complicated and doesn't work for arbitrary refs. It relies on github actions to keep things manually in sync

Additional context

Sparked out of Matrix discussions with @emilazy and @alyssais

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions