forked from gytis-ivaskevicius/flake-utils-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
53 lines (41 loc) · 1.63 KB
/
flake.nix
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
{
description = "Pure Nix flake utility functions";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, flake-utils }:
let
inherit (builtins) isList isAttrs mapAttrs;
fupArgs = { flake-utils-plus = self; };
mkFlake = import ./lib/mkFlake.nix fupArgs;
exportModules = import ./lib/exportModules.nix fupArgs;
exportOverlays = import ./lib/exportOverlays.nix fupArgs;
exportPackages = import ./lib/exportPackages.nix fupArgs;
internal-functions = import ./lib/internal-functions.nix;
overlay = import ./lib/overlay.nix;
in
rec {
inherit overlay;
nixosModules.autoGenFromInputs = import ./lib/options.nix;
devShell.x86_64-linux = import ./devShell.nix { system = "x86_64-linux"; };
lib = flake-utils.lib // {
inherit mkFlake exportModules exportOverlays exportPackages;
# DO NOT USE - subject to change without notice
internal = internal-functions;
# merge nested attribute sets and lists
mergeAny = lhs: rhs:
lhs // mapAttrs
(name: value:
if isAttrs value then lhs.${name} or { } // value
else if isList value then lhs.${name} or [ ] ++ value
else value
)
rhs;
patchChannel = system: channel: patches:
if patches == [ ] then channel else
(import channel { inherit system; }).pkgs.applyPatches {
name = if channel ? shortRev then "nixpkgs-patched-${channel.shortRev}" else "nixpkgs-patched";
src = channel;
patches = patches;
};
};
};
}