forked from timbertson/opam2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
23 lines (23 loc) · 963 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Note: This file is generated by nix-wrangle
# It can be regenerated with `nix-wrangle default-nix`
let
systemNixpkgs = import <nixpkgs> {};
fallback = val: dfl: if val == null then dfl else val;
makeFetchers = pkgs: {
github = pkgs.fetchFromGitHub;
url = builtins.fetchTarball;
};
fetch = pkgs: source:
(builtins.getAttr source.type (makeFetchers pkgs)) source.fetch;
sourcesJson = (builtins.fromJSON (builtins.readFile ./nix/wrangle.json)).sources;
wrangleJson = sourcesJson.nix-wrangle or (abort "No nix-wrangle entry in nix/wrangle.json");
in
{ pkgs ? null, nix-wrangle ? null, ... }@provided:
let
_pkgs = fallback pkgs (
if builtins.hasAttr "pkgs" sourcesJson
then import (fetch systemNixpkgs sourcesJson.pkgs) {} else systemNixpkgs
);
_wrangle = fallback nix-wrangle (_pkgs.callPackage "${fetch _pkgs wrangleJson}/${wrangleJson.nix}" {});
in
(_wrangle.api { pkgs = _pkgs; }).inject { inherit provided; path = ./.; }