forked from Princemachiavelli/flake-utils-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
61 lines (48 loc) · 1.97 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
52
53
54
55
56
57
58
59
{
description = "Pure Nix flake utility functions";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, flake-utils }:
let
inherit (builtins) isList isAttrs mapAttrs;
inherit (flake-utils.lib) defaultSystems eachSystemMap;
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;
genPkgOverlay = import ./lib/genPkgOverlay.nix;
internal-functions = import ./lib/internal-functions.nix;
overlay = final: prev: {
__dontExport = true;
fup-repl = final.callPackage ./lib/fup-repl.nix { };
};
in
rec {
inherit overlay;
blueprints.fup-repl = ./lib/fup-repl.nix;
nixosModules.autoGenFromInputs = import ./lib/options.nix;
darwinModules.autoGenFromInputs = import ./lib/options.nix;
devShell = eachSystemMap defaultSystems (system: import ./devShell.nix { inherit system; });
lib = flake-utils.lib // {
inherit mkFlake exportModules exportOverlays exportPackages genPkgOverlay;
# 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;
};
};
};
}