-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathglib.nix
More file actions
74 lines (68 loc) · 1.52 KB
/
glib.nix
File metadata and controls
74 lines (68 loc) · 1.52 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
inputs:
let
m = {
configurations = {
common = loadDir ./configurations/common;
nixos = loadDir ./configurations/nixos;
darwin = loadDir ./configurations/darwin;
};
home-manager = loadDir ./home-manager;
modules = loadDir ./modules;
packages = loadDir ./packages;
secrets = ./secrets/default.nix;
users = loadDir ./users;
};
replaceContents =
string: set:
builtins.replaceStrings (builtins.map (k: "{${k}}") (
builtins.attrNames set
)) (builtins.map toString (builtins.attrValues set)) string;
loadModules =
src:
inputs.haumea.lib.load {
inherit src;
loader = inputs.haumea.lib.loaders.path;
};
collectPaths =
attrs:
builtins.concatMap (
v:
if builtins.isAttrs v then collectPaths (builtins.attrValues v)
else if builtins.isPath v then [ v ]
else [ ]
) (if builtins.isList attrs then attrs else builtins.attrValues attrs);
loadDir =
src:
let
mods = loadModules src;
in
mods
// {
__all = collectPaths mods;
__without = exclude: collectPaths (builtins.removeAttrs mods exclude);
};
supportedSystems = [
"aarch64-darwin"
];
forEachSupportedSystem =
f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = import inputs.nixpkgs {
inherit system;
};
}
);
in
{
inherit
replaceContents
loadModules
loadDir
supportedSystems
forEachSupportedSystem
m
;
}