mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Add inputs.self.lfs
This commit is contained in:
parent
693a38ae2e
commit
b2d352e6a3
2 changed files with 32 additions and 1 deletions
|
@ -381,7 +381,7 @@ static FlakeRef applySelfAttrs(
|
|||
{
|
||||
auto newRef(ref);
|
||||
|
||||
std::set<std::string> allowedAttrs{"submodules"};
|
||||
std::set<std::string> allowedAttrs{"submodules", "lfs"};
|
||||
|
||||
for (auto & attr : flake.selfAttrs) {
|
||||
if (!allowedAttrs.contains(attr.first))
|
||||
|
|
|
@ -193,5 +193,36 @@
|
|||
|
||||
assert fetched_lfs == fetched_flake, \
|
||||
f"fetching as flake input (store path {fetched_flake}) yielded a different result than using fetchGit (store path {fetched_lfs})"
|
||||
|
||||
|
||||
with subtest("Check self.lfs"):
|
||||
client.succeed(f"""
|
||||
printf '{{
|
||||
inputs.self.lfs = true;
|
||||
outputs = {{ self }}: {{ }};
|
||||
}}' >{repo.path}/flake.nix
|
||||
""")
|
||||
client.succeed(f"{repo.git} add : >&2")
|
||||
client.succeed(f"{repo.git} commit -m 'add flake' >&2")
|
||||
client.succeed(f"{repo.git} push origin main >&2")
|
||||
|
||||
# memorize the revision
|
||||
self_lfs_rev = client.succeed(f"{repo.git} rev-parse HEAD").strip()
|
||||
|
||||
with TemporaryDirectory() as tempdir:
|
||||
client.succeed(f"mkdir -p {tempdir}")
|
||||
client.succeed(f"""
|
||||
printf '{{
|
||||
inputs.foo = {{
|
||||
url = "git+{repo.remote}?ref=main&rev={self_lfs_rev}";
|
||||
}};
|
||||
outputs = {{ foo, self }}: {{ inherit (foo) outPath; }};
|
||||
}}' >{tempdir}/flake.nix
|
||||
""")
|
||||
fetched_self_lfs = client.succeed(f"""
|
||||
nix eval --debug --raw {tempdir}#.outPath
|
||||
""")
|
||||
|
||||
client.succeed(f"cmp {repo.path}/beeg {fetched_self_lfs}/beeg >&2")
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue