~aasg/nixexprs

ref: a23e94b448d9188b3b1511616a96f0be6b546b56 nixexprs/ci.nix -rw-r--r-- 1.6 KiB
a23e94b4 — Aluísio Augusto Silva Gonçalves ci: Print call trace on error 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ pkgs ? import <nixpkgs> { }
, flake-utils-lib ? import (fetchTarball {
    url = "https://github.com/numtide/flake-utils/archive/588973065fce51f4763287f0fda87a174d78bf48.tar.gz";
    sha256 = "17h8rcp246y3444l9fp92jz1h5gp4gvgpnnd8rmhq686mdbha02r";
  })
}:
let
  inherit (pkgs.lib.attrsets) filterAttrs getAttrFromPath isDerivation listToAttrs mapAttrsToList nameValuePair recurseIntoAttrs;
  inherit (pkgs.lib.strings) concatStringsSep splitString;
  inherit (pkgs.lib.trivial) pipe;

  newPackages = pipe (import ./pkgs { inherit pkgs; }) [
    flake-utils-lib.flattenTree
    (filterAttrs (_: isDerivation))
    (mapAttrsToList (name: _: splitString "/" name))
  ];

  patchedPackages = pipe (import ./patches { inherit pkgs; }) [
    flake-utils-lib.flattenTree
    (filterAttrs (_: isDerivation))
    (mapAttrsToList (name: _: splitString "/" name))
  ];

  flattenAttrsFromPaths = paths: set:
    listToAttrs
      (map
        (path: nameValuePair (concatStringsSep "__" path) (getAttrFromPath path set))
        paths);
in
{
  lib = builtins.deepSeq (import ./lib/tests.nix { lib = pkgs.lib; }) { };

  newPackagesDirect = pipe { inherit pkgs; } [
    (import ./pkgs)
    (flattenAttrsFromPaths newPackages)
    recurseIntoAttrs
  ];

  newPackagesOverlay = pipe [ ./pkgs/overlay.nix ] [
    (map import)
    pkgs.appendOverlays
    (flattenAttrsFromPaths newPackages)
    recurseIntoAttrs
  ];

  patchedPackagesOverlay = pipe [ ./pkgs/overlay.nix ./patches/overlay.nix ] [
    (map import)
    pkgs.appendOverlays
    (flattenAttrsFromPaths patchedPackages)
    recurseIntoAttrs
  ];
}