nix-helpers: e75beb750e029cd0f0df5694c9738b96e7a32a95

     1: # Allows nixpkgs overlays to be used with nixpkgs repositories prior to 17.03.
     2: # We use the old 'packageOverrides' config value to emulate the behaviour of
     3: # 'overrides'.
     4: { attrsToDirs', nixpkgs-lib, writeScript }:
     5: 
     6: # The 'name' is just used for the Nix store names. The 'repo' should be an old
     7: # (pre 17.03) nixpkgs repo; either a derivation (like 'fetchgit {...}') or a
     8: # path, or a string of a path. Returns a derivation which can be used in place
     9: # of the 'repo' argument, for example:
    10: #
    11: #     with import (backportOverlays {...}) { overlays = [ ... ]; }; myPkg
    12: #
    13: { name, repo }:
    14: with { clean-helpers = nixpkgs-lib.cleanSource ../..; };
    15: attrsToDirs' name {
    16:   "default.nix" = writeScript "${name}-default.nix" ''
    17:     { overlays ? [], ... }@args:
    18:       with rec {
    19:         inherit (import "${clean-helpers}" {}) nixpkgs-lib;
    20:         inherit (nixpkgs-lib) fix foldl;
    21:       };
    22:       fix
    23:         (self: import "${repo}" (removeAttrs args [ "overlays" ] // {
    24:           config = (args.config or {}) // {
    25:             packageOverrides = super:
    26:               foldl (old: f: old // f self super) {} overlays;
    27:             };
    28:         }))
    29:   '';
    30: }

Generated by git2html.