-
Notifications
You must be signed in to change notification settings - Fork 25
/
flake.nix
123 lines (114 loc) · 2.99 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# SPDX-FileCopyrightText: 2022 The Standard Authors
#
# SPDX-License-Identifier: Unlicense
{
description = "The Hive - The secretly open NixOS-Society";
inputs.paisano.follows = "std/paisano";
inputs.std = {
url = "github:divnix/std";
inputs.nixpkgs.follows = "nixpkgs";
inputs.devshell.follows = "devshell";
inputs.nixago.follows = "nixago";
};
inputs.devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.nixago = {
url = "github:nix-community/nixago";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixago-exts.follows = "";
};
# override downstream with inputs.hive.inputs.nixpkgs.follows = ...
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs.colmena.url = "github:divnix/blank";
outputs = {
nixpkgs,
std,
paisano,
colmena,
nixago,
devshell,
self,
} @ inputs: let
inherit (std.inputs) haumea;
hive = haumea.lib.load {
src = ./src;
loader = haumea.lib.loaders.scoped;
inputs = removeAttrs (inputs // {inherit inputs;}) ["self"];
};
# compat wrapper for haumea.lib.load
inherit (nixpkgs) lib;
load = {
inputs,
cell,
src,
}:
# modules/profiles are always functions
args @ {pkgs, ...}: let
cr = cell.__cr ++ [(baseNameOf src)];
file = "${self.outPath}#${lib.concatStringsSep "/" cr}";
i = args // {inherit cell inputs;};
defaultWith = import (haumea + /src/loaders/__defaultWith.nix) {inherit lib;};
loader = defaultWith (scopedImport i) i;
in
if lib.pathIsDirectory src
then
lib.setDefaultModuleLocation file (haumea.lib.load {
inherit src;
loader = haumea.lib.loaders.scoped;
transformer = with haumea.lib.transformers; [
liftDefault
(hoistLists "_imports" "imports")
];
inputs = i;
})
# Mimic haumea for a regular file
else lib.setDefaultModuleLocation file (loader src);
findLoad = {
inputs,
cell,
block,
}:
with builtins;
lib.mapAttrs'
(n: _:
lib.nameValuePair
(lib.removeSuffix ".nix" n)
(load {
inherit inputs cell;
src = block + /${n};
}))
(removeAttrs (readDir block) ["default.nix"]);
in
paisano.growOn {
inputs =
inputs
// {
hive = {inherit findLoad;};
};
cellsFrom = ./aux;
cellBlocks = [
{
type = "pkgsFunc";
name = "pkgsFunc";
}
{
type = "profiles";
name = "profiles";
}
{
type = "shell";
name = "shell";
}
(std.blockTypes.nixago "configs")
(std.blockTypes.devshells "shells" {ci.build = true;})
];
}
{
inherit load findLoad;
inherit (hive) blockTypes collect;
inherit (paisano) grow growOn pick harvest winnow;
}
haumea.lib;
}