nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, lib }:
2{
3 kernel = stdenv.hostPlatform.parsed.kernel.name;
4 abi = stdenv.hostPlatform.parsed.abi.name;
5 cpu = stdenv.hostPlatform.parsed.cpu.name;
6 updateFeatures =
7 f: up: functions:
8 lib.deepSeq f (
9 lib.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions
10 );
11 mapFeatures = features: map (fun: fun { features = features; });
12 mkFeatures =
13 feat:
14 lib.foldl (
15 features: featureName:
16 if feat.${featureName} or false then [ featureName ] ++ features else features
17 ) [ ] (lib.attrNames feat);
18 include =
19 includedFiles: src:
20 builtins.filterSource (
21 path: type:
22 lib.any (
23 f:
24 let
25 p = toString (src + ("/" + f));
26 in
27 p == path || (lib.strings.hasPrefix (p + "/") path)
28 ) includedFiles
29 ) src;
30 exclude =
31 excludedFiles: src:
32 builtins.filterSource (
33 path: type: lib.all (f: !lib.strings.hasPrefix (toString (src + ("/" + f))) path) excludedFiles
34 ) src;
35}