-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-deps.nu
More file actions
executable file
·35 lines (28 loc) · 936 Bytes
/
update-deps.nu
File metadata and controls
executable file
·35 lines (28 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env nu
def prefetch_hash [remote: string, revision: string] {
let args = ["--url", $remote, "--rev", $revision]
let result = (^nix-prefetch-git ...$args | from json)
$result.sha256
}
def main [lute_path: string] {
let repo_root = ($env.PWD | path expand)
let lute_path = ($lute_path | path expand)
let extern_dir = ($lute_path | path join "extern")
let tunes = (ls $extern_dir | where name ends-with ".tune" | sort-by name)
let deps = ($tunes | each { |t|
let doc = (open --raw $t.name | from toml)
let depinfo = $doc.dependency
let name = $depinfo.name
let remote = $depinfo.remote
let revision = $depinfo.revision
let sha256 = (prefetch_hash $remote $revision)
{
name: $name,
url: $remote,
revision: $revision,
sha256: $sha256,
}
})
let out_path = ($repo_root | path join "deps.json")
$deps | sort-by name | to json | save -f $out_path
}