1
0
Fork 0
mirror of https://github.com/mitchellh/zig-overlay.git synced 2025-05-08 18:46:02 +03:00

add an overlay, clean up package names for nix flake check

This commit is contained in:
Mitchell Hashimoto 2022-08-22 19:31:09 -07:00
parent de6bcff2cf
commit 5ce840257e
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC
3 changed files with 37 additions and 20 deletions

View file

@ -23,25 +23,26 @@ let
'';
};
# The packages that are tagged releases
taggedPackages = lib.attrsets.mapAttrs
(k: v: mkBinaryInstall { inherit (v.${system}) version url sha256; })
(builtins.removeAttrs sources ["master"]);
# The master packages
masterPackages = lib.attrsets.mapAttrs'
(k: v: lib.attrsets.nameValuePair
(if k == "latest" then "master" else ("master-" + k))
(mkBinaryInstall { inherit (v.${system}) version url sha256; })
)
sources.master;
# This determines the latest /released/ version.
latest = lib.lists.last (
builtins.sort
(x: y: (builtins.compareVersions x y) < 0)
(builtins.filter (x: x != "master") (builtins.attrNames sources))
(builtins.attrNames taggedPackages)
);
# This is the full list of packages
packages = lib.attrsets.mapAttrs (k: v:
if k == "master" then
lib.attrsets.mapAttrs (k: v: (mkBinaryInstall {
inherit (v.${system}) version url sha256;
})) v
else
mkBinaryInstall {
inherit (v.${system}) version url sha256;
})
sources;
in
# We want the packages but also add a "default" that just points to the
# latest released version.
packages // { "default" = packages.${latest}; }
taggedPackages // masterPackages // { "default" = taggedPackages.${latest}; }