diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-05-28 14:20:39 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-05-28 14:20:39 +0200 |
| commit | e1e1dfcaedbd9c6920fb111a81edb196fa6049fb (patch) | |
| tree | 4fdda766729c893b2f0be7cde38e0546993784e7 /scripts/npins_to_unflake.jq | |
| parent | treewide: Format (diff) | |
| download | nixos-config-e1e1dfcaedbd9c6920fb111a81edb196fa6049fb.zip | |
treewide: Use unflake to de-duplicate flake inputs
Otherwise, we still have a lot of `nixpkgs` in the closure (they are just not visible with npins).
Diffstat (limited to 'scripts/npins_to_unflake.jq')
| -rw-r--r-- | scripts/npins_to_unflake.jq | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/npins_to_unflake.jq b/scripts/npins_to_unflake.jq new file mode 100644 index 00000000..80e6b5a3 --- /dev/null +++ b/scripts/npins_to_unflake.jq @@ -0,0 +1,34 @@ +def make_url(value): + value.repository as $repo | + if value.type == "Git" then + if $repo.type == "Git" then + "git+\($repo.url)?ref=\(value.branch)" + elif $repo.type == "GitHub" then + "github:\($repo.owner)/\($repo.repo)/\(value.branch)" + elif $repo.type == "Forgejo" then + "git+\($repo.server)/\($repo.owner)/\($repo.repo)?ref=\(value.branch)" + else + error("Invalid repository type: '\($repo.type)'") + end + elif value.type == "GitRelease" then + if $repo.type == "GitHub" then + "github:\($repo.owner)/\($repo.repo)/\(value.version)" + else + error("Invalid repository type: '\($repo.type)'") + end + elif value.type == "Channel" then + empty + else + error("Invalid value type: '\(value.type)'") + end + ; + +"{ +\( + .pins | to_entries | map( + " \"\(.key)\" = { + url = \"\(make_url(.value))\"; + };" + ) | join("\n") + ) +}" |
