File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed
tests/nixos/fetch-git/test-cases/lfs Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 11---
22synopsis : " Git LFS support"
3- prs : [10153]
3+ prs : [10153, 12468 ]
44---
55
66The Git fetcher now supports Large File Storage (LFS). This can be enabled by passing the attribute ` lfs = true ` to the fetcher, e.g.
77``` console
88nix flake prefetch 'git+ssh://[email protected] /Apress/repo-with-large-file-storage.git?lfs=1' 99```
1010
11+ A flake can also declare that it requires lfs to be enabled:
12+ ```
13+ {
14+ inputs.self.lfs = true;
15+ }
16+ ```
17+
1118Author: [ ** @b-camacho ** ] ( https://github.com/b-camacho ) , [ ** @kip93 ** ] ( https://github.com/kip93 )
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ static FlakeRef applySelfAttrs(
381381{
382382 auto newRef (ref);
383383
384- std::set<std::string> allowedAttrs{" submodules" };
384+ std::set<std::string> allowedAttrs{" submodules" , " lfs " };
385385
386386 for (auto & attr : flake.selfAttrs ) {
387387 if (!allowedAttrs.contains (attr.first ))
Original file line number Diff line number Diff line change 193193
194194 assert fetched_lfs == fetched_flake, \
195195 f"fetching as flake input (store path {fetched_flake}) yielded a different result than using fetchGit (store path {fetched_lfs})"
196+
197+
198+ with subtest("Check self.lfs"):
199+ client.succeed(f"""
200+ printf '{{
201+ inputs.self.lfs = true;
202+ outputs = {{ self }}: {{ }};
203+ }}' >{repo.path}/flake.nix
204+ """)
205+ client.succeed(f"{repo.git} add : >&2")
206+ client.succeed(f"{repo.git} commit -m 'add flake' >&2")
207+ client.succeed(f"{repo.git} push origin main >&2")
208+
209+ # memorize the revision
210+ self_lfs_rev = client.succeed(f"{repo.git} rev-parse HEAD").strip()
211+
212+ with TemporaryDirectory() as tempdir:
213+ client.succeed(f"mkdir -p {tempdir}")
214+ client.succeed(f"""
215+ printf '{{
216+ inputs.foo = {{
217+ url = "git+{repo.remote}?ref=main&rev={self_lfs_rev}";
218+ }};
219+ outputs = {{ foo, self }}: {{ inherit (foo) outPath; }};
220+ }}' >{tempdir}/flake.nix
221+ """)
222+ fetched_self_lfs = client.succeed(f"""
223+ nix eval --debug --raw {tempdir}#.outPath
224+ """)
225+
226+ client.succeed(f"cmp {repo.path}/beeg {fetched_self_lfs}/beeg >&2")
196227 '' ;
197228}
You can’t perform that action at this time.
0 commit comments