Skip to content

Commit

Permalink
flake-compat: use builtins.fetchTree if available
Browse files Browse the repository at this point in the history
  • Loading branch information
jbgi committed Mar 17, 2022
1 parent a8c62d0 commit 78a66fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions nix/flake-compat.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ let
lock = builtins.fromJSON (builtins.readFile (src + "/flake.lock"));
flake-compate-input = lock.nodes.root.inputs.flake-compat;
nixpkgs-input = lock.nodes.haskellNix.inputs.${builtins.elemAt lock.nodes.root.inputs.nixpkgs 1};
flake-compat = import (builtins.fetchTarball {
url = "https://api.github.com/repos/input-output-hk/flake-compat/tarball/${lock.nodes.${flake-compate-input}.locked.rev}";
sha256 = lock.nodes.${flake-compate-input}.locked.narHash;
});
pkgs = import
(builtins.fetchTarball {
url = "https://api.github.com/repos/NixOS/nixpkgs/tarball/${lock.nodes.${nixpkgs-input}.locked.rev}";
sha256 = lock.nodes.${nixpkgs-input}.locked.narHash;
})
{ };
fetchTree = builtins.fetchTree or (info:
builtins.fetchTarball {
url = "https://api.github.com/repos/${info.owner}/${info.repo}/tarball/${info.rev}";
sha256 = info.narHash;
});
flake-compat = import (fetchTree lock.nodes.${flake-compate-input}.locked);
pkgs = import (fetchTree lock.nodes.${nixpkgs-input}.locked) { };
in
flake-compat {
inherit src pkgs;
Expand Down

0 comments on commit 78a66fe

Please sign in to comment.