27 lines
719 B
Nix
27 lines
719 B
Nix
|
|
{ pkgs ? import <nixpkgs> {} }:
|
|
let
|
|
inherit (pkgs) fetchgit fetchzip callPackages lib;
|
|
|
|
manifest = (builtins.fromJSON (builtins.readFile ./repos.json)).repos;
|
|
lockedRevisions = (builtins.fromJSON (builtins.readFile ./repos.json.lock)).repos;
|
|
|
|
repoSource = name: attr:
|
|
let
|
|
revision = lockedRevisions.${name};
|
|
in if lib.hasPrefix "https://github.com" attr.url then
|
|
fetchzip {
|
|
url = "${attr.url}/archive/${revision.rev}.zip";
|
|
inherit (revision) sha256;
|
|
}
|
|
else
|
|
fetchgit {
|
|
inherit (attr) url;
|
|
inherit (revision) rev sha256;
|
|
};
|
|
|
|
createRepo = (name: attr: callPackages (repoSource name attr) {});
|
|
|
|
in {
|
|
repos = lib.mapAttrs createRepo manifest;
|
|
}
|