summary refs log tree commit diff
path: root/pkgs/development/compilers/mint/crystal2nix.cr
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/mint/crystal2nix.cr')
-rw-r--r--pkgs/development/compilers/mint/crystal2nix.cr15
1 files changed, 11 insertions, 4 deletions
diff --git a/pkgs/development/compilers/mint/crystal2nix.cr b/pkgs/development/compilers/mint/crystal2nix.cr
index f2ef5dafdbc3..9b84b20d03a3 100644
--- a/pkgs/development/compilers/mint/crystal2nix.cr
+++ b/pkgs/development/compilers/mint/crystal2nix.cr
@@ -5,16 +5,23 @@ class PrefetchJSON
   JSON.mapping(sha256: String)
 end
 
+class ShardLock
+  YAML.mapping(
+    version: String,
+    shards: Hash(String, Hash(String, String))
+  )
+end
+
 File.open "shards.nix", "w+" do |file|
   file.puts %({)
-  yaml = YAML.parse(File.read("shard.lock"))
-  yaml["shards"].as_h.each do |key, value|
-    owner, repo = value["github"].as_s.split("/")
+  yaml = ShardLock.from_yaml(File.read("shard.lock"))
+  yaml.shards.each do |key, value|
+    owner, repo = value["github"].split("/")
     url = "https://github.com/#{value["github"]}"
     rev = if value["version"]?
             "v#{value["version"]}"
           else
-            value["commit"].as_s
+            value["commit"]
           end
 
     sha256 = ""